Articles

How Many Apps Can I Run on My Server?

Numerous factors can determine how many apps you can run on your size server.

The most important things to consider when adding apps are memory, disk space, and CPU.

Memory

When thinking about your server's memory usage pay close attention to

  • how much traffic your apps get (the number of simultaneous connections) and
  • how long your PHP scripts take to execute.

A simple app with a small codebase, a single database, and low traffic will use about 50MB of memory, and your server's operating system and core services will use around 150MB of memory.

As you add apps to your server, keep this formula in mind with to determine approximately how much memory your apps will use (ten apps, for example):

150MB (OS memory usage) + 10 (number apps) * 50MB (app memory usage) = 650MB

Based on that formula, if you have a 1GB server with ten apps, you will have roughly 350MB left to theoretically add another seven apps to your server.

Remember, however, that a best practice is to keep at least 50% of your server's memory free in case of traffic spikes, unknown slow PHP code, or any other unexpected events that could use up memory.

If your server sees a sudden surge in memory usage, it can run out of memory and shut down MySQL, making your apps inaccessible to your site's visitors.

It's always better to provide a consistent user experience for your visitors than to have them not be able to visit your site at all.

Disk Space

Running out of disk space will only be a concern if you have a large number of huge media files, such as many large videos.

For example, you might have the same WordPress installation and plugins running on multiple apps; however, your media libraries for each of those apps can consume vastly different amounts of disk space.

If you have large quantities of high-quality video stored on your server, you can quickly run out of the disk space needed to install more apps.

CPU

It's very rare for CPU to cause a bottleneck on servers. Instead, memory generally causes the first bottleneck when apps receive large amounts of traffic or have bugs in their PHP code.

If you do see high CPU, you should always check to see if you also have high memory usage. If you do, especially if your server has run out of memory and is using swap space, you will see high CPU even though the CPU is not the source of the bottleneck. CPU will become high any time the server has run out of memory.

If you see high CPU usage and you've confirmed you have plenty of free memory on the server, it generally means there are performance problems in your app's code or you may be receiving much more traffic than you expect.