It has come to my attention that I have been using too much CPU resources. The page can be seen at http://support.netfirms.com/account-management/netfirms-resource-policy-and-enforcement.
Therefore, I decided to look into the reasons for it. http://www.webhostingtalk.com/archive/index.php/t-485061.html and http://support.hostgator.com/articles/security-abuse/cpu-resource-usage will give details on the problem.
Looking over the results, I now understand what is the problem. When one is playing a flash game, it downloads itself onto the computer. Therefore, playing the flash game over and over again will not use any bandwidth, but it may utilize 100% CPU usage on the client-side.
When one is reading over a blog with no pictures, the server’s CPU may utilize 100% for a 1/4 second but go back down to 0% when loaded.
PHP, which WordPress is based on, is a server-side language. This means that when a user visits this page, the server, that this page is hosted on, will need to execute the instructions passed to it. The server will have to extract the information from the MySQL database and then pass it back to the page that requested the information.
Does not seem like a lot of work, but hosting several websites on one server can quickly be a problem for others on the same server.
If one looks at Google, it most likely has over 400,000 or more servers set-up to handle the load. With millions of people doing searches every hour, the database(s) that holds all the cached web pages and links are massive. Google servers can be seen at http://en.wikipedia.org/wiki/Google_platform#Current_hardware
Based on this fact, many will assume that a simple solution will be just to increase the number of connections to one database to 100 million people. This is possible, but one may need several I7 CPU’s with 2TB of RAM to handle the workload. Furthermore, there is no guarantee that this will handle the load without the clients seeing that it is taking much longer to load your page, locking up the server or crashing the server. http://dev.mysql.com/doc/refman/5.1/en/too-many-connections.html.
Therefore, in order to eliminate this problem, one will have to move to a dedicated server. This can be done by buying a computer for you home and running a web server on it, or purchasing a dedicated web server plan from a web host.
The more busier a website becomes, the better the chances that a second, third, or more computer will need to be used to handle the workload. One may be forced to implement a balanced-load system at http://en.wikipedia.org/wiki/Computer_cluster#Load-balancing_clusters, or something else altogether.
A Virtual Private Server or VPS can be an economical solution for those tired of receiving messages from their web host about hogging the CPU. http://www.askwebhosting.com/article/124/What_is_a_VPS_Virtual_Private_Server.html.
Although, one will find out that since everything is divided, there is a limit to how much their server can handle. Therefore, if thousands of people are trying to access a MySQL database that is set up to accept thousands of people accessing it at once, the server may get really slow, lock up or even crash. If this happens, moving to a larger VPS or faster dedicated server maybe the only option since VPS’s may also have a maximum of 20% of the CPU dedicated to your server. For example, a 5GHz CPU will have 1GHz or 20% of the CPU dedicated to a VPS. Therefore, the VPS’s 1GHz CPU can be utilized 100%. Unfortunately, 100% = 20% of the actual CPU speed.
What to look for in a VPS
Knowing quite a bit about Linux, I know what is required to make it work.
- Xen – Xen gives the user the ability to create swap space on the hard drive. OpenVZ does not. Therefore, for Linux VPS, Xen is a must.
- Dedicated IP address – For those that have a domain name hosted elsewhere, a dedicated IP address enables one to point that domain name elsewhere. In this case, to the dedicated IP address. Although, pointing to another domain name can work also.
- Unmanaged or managed – When it comes to shared hosting, it is managed. When it comes to VPS, it is unmanaged. Therefore, it is up to the user to install, update, fix, and troubleshoot the software installed. Managed VPS’s are supported by the providers IT personnel. Unfortunately, how much they are willing to help varies between providers. Therefore, ask what kind of support paying extra for a managed VPS will provide. In some cases, a user maybe better off hiring their own IT personnel to manage the VPS if he/she is unable to do it himself/herself.
- LAMP – A server for Linux. It seems that with cheap packages, LAMP is not provided. Therefore, it is good to ask if a user can install it manually. It could also be possible that the hardware is not powerful enough to run a full LAMP server. In this case, HTML pages may be the only option.
- CPU – Many providers do not mention how much CPU power is provider for each VPS. I assume that the CPU power is dedicated to each VPS. Therefore, ask what percentage and MHz is dedicated to your VPS.
- GUI (Graphical User Interface) or CLI (Command Line Interface) – One of the most overlooked parts of a server. Many people assume that a server will have an interface like Windows. Unfortunately, this is not the case. Furthermore, installing a GUI may not work with a cheap VPS. Therefore, one may be required to run all programs from the command line. Furthermore, only text-only versions of software will run. Simple to learn and use, but may seem intimidating to those used to using Windows. See https://help.ubuntu.com/community/Installation/SystemRequirements#Ubuntu%20Server%20%28CLI%29%20Installation for hardware minimum requirements.
Remember that a server whether shared, virtual, cloud, or dedicated has a finite number of resources available. Setting the MySQL database to accept a maximum of 1 million connections can crash the database if it cannot handle that many requests at once. Therefore, moving up is an option if the current solution is not good enough. Otherwise, one needs to accept that you get what you pay for.
Of course doing Google searches for cheap VPS, cheap cloud server, or cheap dedicated server may provide better web hosts.
For those considering an option to deal with times when the server goes down for a period of time, a dns failover service is feasible. Unfortunately, this service is not cheap. For those people that must have 99.999% uptime, this should be considered.