Technical Recipes

How to choose hosting service

By the time when you need to make decision on which hosting site you are going to go production, you may look into:
 
    - Shared Hosting/Virtual Dedicated Hosting (VPS) /Dedicated Hosting
    - Windows or Linux platform
    - CentOS or Fedora
 
It depends on your requirement and budget to run your production site. If it's a WordPress, maybe a simple web hosting is enough if you use all the tools provided by the hosting site and you are willing to pay whatever service you need from them.
 
If you have a very small budget and run a prototype kind of site, a Shared Hosting may fit your need. Be aware that you have to share your memory and hard disk with other company, you don't have much control with the root access.
 
Virtual Dedicated Hosting with a Virtual Private Server (VPS) is good in the sense that the cost is much lower than a Dedicated Server. If your application does not requirement multiple server instances for MySQL and Tomcat server, It may meet your requirement.
 
However, VPS does not work for me. Right after I re-provisioning the VPS, an Apache HTTPD server instance occupies 283MB memory instead of 5MB. After I run one Tomcat server instance, it takes up to 1GB of memory which stops me from running multiple server instances. I worked with the technical support from the hosting closely to diagnose the problem with no result. Then I did some more research and finally found that VPS uses the virtualization software which causes the abnormal "usage" or "allocated" of memory. Here are some opinions quoted from the referenced articles:

"Godaddy's control panel application was using 218 Megabytes of the 256 Megabytes of memory I had purchased. That left me with 34 Megabytes of memory."
 
"This is actually a common problem with Virtuozzo VPSs. I hate to tell you this, but what GoDaddy told you is probably correct. Virtuozzo limits the number of open files you can have, and if you reach this limit no new processes can start causing a whole slew of errors. This is the most common support issue among VPS providers."
 
"As installed, the mysql installation that comes with Kloxo uses about 280 mb of memory."
 
"This is an OpenVZ VPS correct? If so, 'free -m' reports allocated memory, not actual used. I have Kloxo running on an OpenVZ box that's "using" around 350 MB as reported by 'free -m.'"

When I turned to a Dedicated Server with 4GB memory, everything is normal. I have the full control of the box including setting up static IPs and firewall rules as well as created multiple Apache, Tomcat, MySQL server instances and run it smoothly. Of course, if the traffic increased, more memory is needed for providing enough bandwidth and server response speed.
 
The memory footprint for the typical server instances are:
 
    - Apache HTTPD: 5MB
    - Tomcat: 60MB
    - MySQL: 70MB
 
The rest are easy to choose. I tried to have a VPS  with Windows 2008 Server version before, it takes more than 1GB of memory, and the deluxe package I can afford only gave me 2GB memory. Compared with the 50MB memory footprint, unless you have no idea what Linux is, do you want to pay more to host your production site on Windows?
 
After you choose the Linux OS, you have to decide whether you need to go for the CentOS or Fedora.  Many people are more comfortable with the GUI tools compared with the command line. You can refer to the next blog page on "How to choose Linux Distributions", and finally it's your choice.