So, I have been experimenting with Digital Ocean Servers. If you remember, there was a time when I was using Linode, because they offered more bang for your buck. It seems now though, Linode has memory optimized plans and digital ocean has CPU optimized plans. Granted, for testing purposes I enjoy the way Digital Ocean works much better. But this article is not about these companies. This article is supposed to be more about WordPress optimization and servers.
You may also remember too, that I was wondering if I should switch to another CMS. But, I have had WordPress installed for how long? My archives go back to 2005. That is 13 years. Since then PHP has become more mature, new web servers have emerged, and wordpress has became better, despite all the badly written plugins. So let me tell you my current setup that seems to be running pretty well.
- DO Server: 1GB ram and 1vCPU
- PHP v7.2 running as PHP-FPM
- Percona v5.7
- Cloudflare CDN
- Ubuntu 16.04
- Let’s Encrypt for SSL
This is the cheapest server you can get from Digital Ocean at $5/mo. Everything else is either open source or free. Since I do not get much traffic, it seems to be working fine. Depending on how you have wordpress setup, depends on how much CPU you need and RAM. I try to keep my installation clean and with as few plugins as possible. I also use caching that works with Nginx. You will notice this setup also has a SSL installed. This is great and free! If you want I can post what some of my configurations files are so you can set this up yourself. If you want though, I can set it up for you at a cost. That way you will have a nicely priced VPS setup.
I want to tell you about some issues I ran into. The default PHP-FPM setup, only starts you off with a max of 5 processes. so if you get a bunch of people going to your website, it could fill those 5 processes up pretty quick. Each process will take up memory. Each process will use CPU. So, it is very easy to use up a bunch of server resources. I figured since each process will be low in CPU and memory footprint I could set this to be pretty high. Let’s say I have an extra 500mb of RAM, not including mysql and any other stuff to run on the server. I can check that the average process runs at about 10mb per PHP page. I am sure some may use more, depending, or less. I could then set it to max 50 children. This would allow for me to fully utilize the ram on the machine. the bottleneck would probably end up being the vCPU.
Another real cool thing about this setup is I can run multiple versions of PHP. PHP 7.1 and PHP 7.2, specifically because mcrypt does not run on PHP 7.2. I and choose for each application which PHP version I want to run, based off of nginx. I limit the PHP 7.1 usage though, because I use it for programs mainly only i use, so it won’t use up most of the memory.
I am hoping to build a control panel in which to make all this much easier and to add new sites. I want it to be very light, so looking into a nodejs application that can update all the information through a web console.
If you have any ideas or would like to know more, leave a comment below!