Have spent the past week moving the wordpress half of a website over to a cloud server on digital ocean. A lot of it was spent refreshing myself on how DO works, linux etc. Meghan and I did a lot of the move by hand rather than copying directories/and the db over. We wanted a fresh start. I don't know how important that is in the grand scheme of things but it seemed like a good idea at the time.
I spent the past couple days working on speeding up the service. The day to day traffic of the site is small, but during it's peak it sees 15k people per day. Most of those are in a short amount of time. I wanted to make sure the server could handle it.
I ran some tests on loader.io and my site completely froze up at @ 140 concurrent users. Woulldn't load after the test stopped and forced me to restart the server. I'm not sure but I think mySql locked up.
I had been looking into caching the server using fastcgi and varnish, but the instructions I found online seemed to indicate I would need to run nginx as a proxy server to intercept https. I found other information that nginx was flat out quicker than apache. If I needed nginx anyway, it made sense to drop apache and switch to nginx. However, the varnish installation seemed difficult and I found a very easy set of instructions to use nginx and redis.
Redis is used to cache requests to the DB while fastcgi is used to cache pages. At least, I think this is what's happening. After spending several hours tweaking the site settings, reading and rereading the instructions and scouring the internet for explanations about why things weren't working I was able to get things switched over and running.
My issues with concurrent users dropped away immediately. During the first test, before the crash, response times were approaching ten seconds. After switching to nginx, even though it didn't cause the server to crash I was still getting 8-10 second response times before the test program would start to receive too many 500 responses to keep going.
After setting up fastcgi, my problems fell away. I was able to easily serve 250 concurrent user with an average response time of 44ms. I did a follow up test today with 1000 users and the response time went up to 170ms.