Long story short: My idea of tuning has been pasting tutorial code for 2GB of swap on a 1GB droplet and calling it a day (PS: yes, I know 1GB is crazy small, and I do have a 4GB two core server for a few paid client sites, but when you’re a musician, sometimes paying for groceries weighs heavier than a website nobody goes to…). Eventually this practice caught up with me in 2023 when I decided to re-roll on Vultr and couldn’t turn back to my old server. Let’s just say I’ve had a pretty rough two years hosting on Ubuntu 22 and PHP 8.2.
Well… last night I bit the bullet and just started sending screenshots of my htop to Gemini and ChatGPT and let them both argue out the best tuning method for a 1GB server. I’ll share the final results it came up with, but any advice is greatly appreciated. I trust AI as far as I can throw it…
- Back up everything
- Swap (10/60)
- Zram
- Remove/disable: netdata, snapd, avahi, lxd/lxc, multipath, cups/postfix/whoopsie,
- Mask apport/cloud-init
- Increase max open files/listen.backlog
- Tune MySQL
[mysqld]
innodb_buffer_pool_size = 128M # or 256M
innodb_buffer_pool_instances = 1
max_connections = 25 # or 50
wait_timeout = 60
interactive_timeout = 60
tmp_table_size = 32M
max_heap_table_size = 32M
innodb_file_per_table = 1
innodb_flush_method = 0_DIRECT
innodb_flush_log_at_trx_commit = 2
query_cache_type = 0
query_cache_size = 0
performance_schema = OFF
- Tune PHP conf (disable www-two.conf, debug.conf)
[custom]
user = www-data
group = www-data
listen = /var/run/php/php81-fpm.sock
listen.owner = root
listen.group = www-data
listen.mode = 0660
pm = ondemand
pm.max_children = 5 # or 2-3
pm.process_idle_timeout = 10s
pm.max_requests = 500 # or 250
chdir = /
#optional
request_terminate_timeout = 300
catch_workers_output = yes
listen.backlog = 32768
- Restart mariaDB on crash in override.conf
[Service]
Restart=on-failure
RestartSec=5
#optional
StartLimitIntervalSec=0
many thanks to everyone in the forums. I've learned so much over the years from this forum and EasyEngine. Otherwise I would have probably bricked my server letting AI suggest terrible practices like editing core files, etc.