Previously we’ve looked at how to choose the specifications you need for building a VPS to meet your needs. Last time we covered what the specifications do and how to go about working out how much storage is required. This time we’ll look at memory and CPU.
Memory is used by programs as they are run. If you are running a web application on your server then the two main users of memory will be the scripts that create the web pages that your visitors see, and the database that holds the data that the scripts reference. In most cases the heavier user of memory will likely be the database.
Storage and Memory
Unfortunately there’s no easy way to figure out how much memory that your database will require. This is determined by the amount of data that it is referencing, how complex the queries are that it is running, and also how many concurrent connections are being made to the database. This means that even a basic database can benefit from plenty of memory if it’s on a busy server. Wherever possible the database server will attempt to ensure that it is keeping accessed data in memory, though if it runs out of memory it will automatically use the disk storage instead. However this is far from ideal as storage is significantly slower than memory is for the database to do its work. So if your database server on the VPS starts using its data from storage then you are going to notice a performance degradation compared to when it’s running in memory. In general you’d want at least 0.5GB of RAM on your VPS if you are running a MySQL database and double that would be a good starting point for a system running other components such as a web server.
A database may not be the only reason why you may need to use a VPS; many pieces of software will give you an idea of a minimum specification that you should be looking at in order for it to run well so it’s worth paying attention to those where provided. It’s also worth noting again that as your software gets busier you may need to increase the amount of RAM available for it.
Finally there are CPU requirements. These are generally harder to call as it is normally related to how hard your server is working. If you are migrating a service from a shared hosting environment then the chances are that your CPU requirements may be reasonably low in its existing configuration. Once you have the system up and running, though, it’s easy to tell how the performance is going to be affected by your CPU by looking at the server’s Load averages. This can be seen either by using the “load” command, or when you look at your system resources using the “top” command.
System load is measured using a number – generally a number lower than 1 is preferred. The load is a measure of how busy the CPU is. A load of 1 shows that a CPU core is busy all of the time. A load of 2 on a single core server means that the core has twice as much work to do than it is able to, though a load of 2 on a 2 core CPU server means that both cores are in use all of the time.
There are main two situations that can see your server running high loads: the first is that your server is so busy that it is running more processes than the CPU can deal with in a timely manner. In this case, a processor upgrade will normally relieve the problem. The second situation is if the CPU is waiting long periods of time to retrieve data from the disk storage to process. This normally shows up in the “top” command as IO Wait, measured as a percentage.
If you have a high percentage of IO Wait then you are hitting the limits at which you can transfer files from your disks. Increasing CPU resources is unlikely to help here, for two reasons: first, if you are running a number of disk intensive programs, for which the solution is generally to split your disk intensive processes off to separate VPS servers. Second, if you have run out of memory the system may start to SWAP, which is where it uses some disk space instead of memory, and the CPU may be waiting to get data from SWAP memory. In this case adding more RAM to the server may help prevent this from happening.
As you have probably realized, it’s difficult to set hard and fast rules about what resources your server may need in different situations as each server setup and use case is unique. It is important to monitor the resources that your server is using in order to keep on top of it’s needs and ensure that you are running the best setup.
We can cut your latency and keep your site visitors coming back for more. Get started today by visiting VPS.NET.
This article was brought to you by VPS.net, for dedicated server hosting, cloud servers and 24/7 support visit our site here vps.net