Lazy fellow's guide to running Lighty+PHP+MySQL/MariaDB on a small NAT VPS
Excuse me if being too lazy, I've been trying to get up to speed on tuning LightHTTPD, PHP-FPM and MariaDB to work well on a small NAT VPS (specifically 256 MB RAM no swap in my case). But there seems to be quite some reading and testing to do.
I think I got Lighty tuned pretty well, though probably not optimal. For PHP I only followed some guide and it works, no idea if I should tune it to be nice resource wise somehow.
But reading about tuning MariaDB/MySQL, it strikes me as quite complex, and I'm bound to miss some points I should consider.
So, I'm boldly asking if someone here might have a nice cheatsheet/fitting template to share here?
(I'm running this on Debian 10 ATM, also considering Alpine to free up more resources.)
Thanked by (1)uptime
Comments
Have you tried mysqltuner?
I bench YABS 24/7/365 unless it's a leap year.
Nope, sounds promising. I guess I can afford installing Perl for doing the tuning.
I am happily running several blog sites with 128 MB NAT.
I don't have any template for you to follow, but I don't think there should be any.
Everyone's usage are different, so ways to optimize those should be different too.
If you can explain your use case (like what DB engine do you use, is your usage heavy write.... etc) and post you
top
result, may be we can suggest you something?https://phpbackend.com/
Right now it's just idling, waiting for tasks. But considering one for a Wordpress site, another for testing a forum thingie (can use mysql/mariadb or sqlite, not sure when sqlite will be best or not) ...
If you can spare some Ram (40+ mb), I would suggest MySQL/MariaDB.
I have been running a wordpress site too, but that one is totally cached in memory, so PHP/MySQL don't need to do anything. In other word, a static site.
https://phpbackend.com/
The old Lowendspirit forum is running on a 128mb vps. 256mb is too much.
Action and Reaction in history
Have you tried running it without tuning anything?
Doesn't lighttpd has FastCGI memory leakage issues? nginx and lighttpd are both lightweight event-based web servers, I doubt you need to change the default config.
Try using static process manager with max_children = 2 (constantly keep 2 PHP workers running), max_requests = 10000 (to protect against memory leakage).
You can expect your PHP workers to use between 10 and 40 MB RAM. If the queue gets too busy, PHP will send a warning to its log file.
256 MB is lots of RAM! Try running your WordPress and forum DB without any tuning, it shouldn't go above 100 MB.
PHP-FPM pool config file is a great place to start. It's well documented and easy to understand.