I’m using a LEMP stack on a 512mb droplet.
My site gathers news articles from many different RSS feeds and adds them to a MySQL database. This process happens every 15 minutes. The users can choose to view what kind of articles they’d like to see but cannot interact with the content any more than that. The site displays content from the database via PHP through a template engine.
I’ve figured a full page caching solution would be a good balance between amount of work put in and and performance gained. Previously I’ve been caching full pages on disk and purging them every 15 minutes when the MySQL database updates.
So mostly, I’m just serving static html, css, js, jpg files with a PHP file here and there.
Now I’m trying to cache the webpages in RAM instead. From my tests it doesn’t seem to load any faster, but I’m guessing loading from RAM than HDD would be better under load?
I’ve tried FastCGI_cache and memcached so far. They both seem identical. Would you guys know what might be better for my situation? I noticed FastCGI_cache hits my index.php far more often than memcached.
Does this mean my server can handle more but the server environment / my code isn’t optimized enough? Also these load tests are for only 30 - 60 seconds, can I expect CPU+Memory usage to go up with time with a constant rate of hits?
I checked my NGINX log and found hundreds of these:
2014/05/09 22:26:38 [alert] 1347#0: *18163 socket() failed (24: Too many open files) while connecting to upstream, client: xxx.xxx.xxx.xxx server: xxxxxxxxx, request: “GET / HTTP/1.1”, upstream:
After some Googling it seems like I have to raise my ulimit and tweak NGINX workers and worker_processes. Since I’m on the 512 droplet, I have them set at 1 worker and 1024 connections, like a lot of tutorials recommended.
My next course of action is to slowly raise worker_connections, ulimits and keep doing load tests.
It is a tedious process and I’d very much appreciate and tips or tricks you might have for me :)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.