ServerMom’s New Server Setup v2
It’s been more than a year since me last server setup which I used combination of LiteSpeed-powered shared hosting, 1 web server on Ramnode VPS, 1 MySQL server and 1 Varnish server (load balancing) – see my old server setup here. Recently I decided to change my old server setup with the new one. What’s my reason behind the change?
Firstly because my shared hosting account at Crocweb has expired and it is too pricy to extend. Secondly, I’ve been so lucky because that the founder of Atlantic.net contacted me with special offer allowing me to host my blog in their cloud infrastructure. Thirdly, I just want to try different server setup.
So here is my new server setup which I currently use to run Servermom.org:
- Atlantic.net 4GB Cloud VPS to host all web files and MySQL database.
- Atlantic.net 512MB RAM Cloud VPS to run Varnish Cache server.
- Ramnode 512MB RAM OVZ VPS to Backup all web files
- Ramnode 256MB RAM OVZ VPS as MySQL Slave
- 4GB RAM + 2 vCPU + 100GB SSD + 5TB bandwidth on KVM cloud (New York City)
- 512MB RAM + 1 vCPU + 20GB SSD + 2TB bandwidth on KVM Cloud (New York City)
- 512MB RAM + 2 Cores CPU + 50GB SSD + 2TB bandwidth on OpenVZ (Atlanta)
- 256MB RAM + 1 Core CPU + 25Gb SSD + 1TB bandwidth om OpenVZ (Atlanta)
- CentOS 6.6 64-bit running full Vesta CP stack (LAMP plus Nginx frontend proxy minus DNS server / named)
- CentOS 6.6 32-bit running Varnish Cache server v3.0.7 (release date 23 March, 2015)
- CentOS 6.6 32-bit running Apache and PHP5. File syncing with rSync.
- CentOS 6.6 32-bit running MySQL server
Short of explanation:
Initially I just want to use single server which is the 4GB RAM cloud VPS from Atlantic.net but then I got downtime about 3 minutes. That was expected down time though. Atlantic.net contacted days before it happens and it’s not caused by the server itself but their upstream service providers were performing maintenance on their circuits.
While every effort will be made to minimize any interruption in service, customers may experience a 2-5 minute network service interruption during BGP re-convergence
So I decided to replicate my server to RamNode when in case the downtime is more than expected I can still minimize the downtime by switching my A record to RamNode. So then came the downtime which was not more than 3 minutes.
Few days after that (it’s yesterday exactly), NixStats told me that CPU load on my main server (the one with 4GB RAM and 2 vCPU) is rising high.
Here’s the statistic of that time:
As what we can see above, while the CPU usage is going high (because httpd process) and so the Network I/O. The weird thing is the number of real visitors were not increasing. So I believed it was someone being so jobless to play around with my server. I didn’t have time to check whether it’s a DOS, DDOS, SYN Floods, or HTTP Floods attack. What I did remember that is in such situation (light attack) Varnish will come in handy. So I installed Varnish and put it running in very front of my Vesta CP server.
Shortly my server configuration as below:
Visitors -> Cloudflare (DNS) -> Varnish -> Nginx -> Apache + PHP + MySQL.
The result, CPU Load on my Vesta CP server is now normal (from 5.0 4.8 4.5 to 0.8 1.0 0.9)
You can view all my servers’ performance at:
Conclusion: I think Varnish is really effective to reduce high CPU load. This time I simply use it as frontend caching not load balancing.
Some interesting articles being my consideration in using Varnish:
- The penultimate guide to stopping a DDoS attack (Unixy blog)
- How to block rate-limited traffic with Varnish (Dan Singerman blog)
- Withstanding DDOS attacks with Varnish (Varnish blog)
- Good steps to survive from denial-of-service / DOS attack (Stack Exchange)
- Me and Varnish against DOS attack (homeofficekernel @ blogspot)
How to setup all of those? I already wrote all the tutorial needed:
- How to install Vesta CP on CentOS
- How to setup MySQL Master-Slave Replication
- How to setup rSync and configuration
- How to Install Varnish Cache server
Any comment? Do not hesitate to drop comment regarding my current server setup. Or if you found any glitch, bug or problem while accessing this blog, I really appreciate if you can tell me. Thanks.
Very nice stuff out there, congratulations for your new server.
I would like to know, did you facing bandwith quota issue by using separate Mysql database server since every query to the database will need bandwith to process ? if so, how you manage that problem?