Setup for a linode 512 with a Forum
New to all this so please excuse the basic questions. First I recent got a 512 node and have set it up as follows:
Ubuntu 10.04 LTS
PHP 5.3.6 (FPM)
APC 3.1.7
Nginx 0.8.54
MySQL 5.1.41
I have a basic firewall in place that basically only opens port 80 and my SSH port. SSH root login is off. Everything is working thus far and I have installed an SMF forum and a backup database to test things out.
Now my primary question is about memory usage, I'm not sure where to start on some of the items so I'm looking for some recommendations.
APC shared memory is set to 128M, is this to high, should this be a % of system memory or based off the number of potential FPM processes?
PHP-FPM process. Right now it is set up in dynamic mode with max 50, start 8, min spare 5, max spare 10. I'm not sure how to relate the number of process to users or traffic to determine a starting point.
MySQL is set up as follows, these are basically 45% of memory from looking at one of the stackscripts. Over time I figure that I can tune these with one of the mysql scripts after I've collected some data.
key_buffer = 176M
sortbuffersize = 4M
readbuffersize = 4M
readrndbuffer_size = 4M
myisamsortbuffer_size = 16M
querycachesize = 32M
4 Replies
@spuds:
APC shared memory is set to 128M, is this to high, should this be a % of system memory or based off the number of potential FPM processes?
APC has script apc.php, this script can show, which amount of memory is used by APC. If APC has filled 50-70% of memory - it's fine. If less - you can decrease apc.shm_size.
Check, that apc.slam_defense = Off
@spuds:
key_buffer = 176M
sortbuffersize = 4M
readbuffersize = 4M
readrndbuffer_size = 4M
myisamsortbuffer_size = 16M
querycachesize = 32M
max_connections? Default 100?
Set max_connections to 50 as maximum and you will able to increase buffer's sizes.
To control memory usage, use this script:
If you will need help with tuning - paste output of script execution here.
I'd say put apc around 32MB, apc caches the files and since the files tend to be small you don't need much memory for them.
fpm set around 20-25
Mysql, your key_buffer is a bit high, do you have very large myisam indexes? You probably don't need it that high, something around 16M is more normal for a small machine.
Download and run
A couple of other tips, enable gzip compression in nginx, if you have static files that don't change very often set the expires option in nginx.
> maxconnections? Default 100?
It was 150, now its 50. Also tweaked some of the per connection buffer limits (sortbuffersize, readbuffersize, readrndbuffersize) so I did not consume massive amounts of memory on each connection.
> APC has script apc.php, this script can show, which amount of memory is used by APC. If APC has filled 50-70% of memory - it's fine. If less - you can decrease apc.shm_size.
Check, that apc.slam_defense = Off
> I'd say put apc around 32MB, apc caches the files and since the files tend to be small you don't need much memory for them.Done… it was only about 20% used so I lowered the shared memory down quite a bit, I think its at 48M now which holds all the scripts with room to spare for extra. I set the slam.defense to 25% chance.
> Mysql, your key_buffer is a bit high, do you have very large myisam indexes? You probably don't need it that high, something around 16M is more normal for a small machine.
ts an SMF 2.0 board and its still set up as an isam so it needs that value to be pretty high.
> A couple of other tips, enable gzip compression in nginx, if you have static files that don't change very often set the expires option in nginx.
Done and done, made sure it was working with pagespeed.
> I'm going to assume that the number of fpm processes is roughly equivalent to if you're running lighttpd
I think that is correct so I've adjusted the startup, min spare, max spare and max ever settings to be in line with what you have indicated. I'll have php-fpm status setup so I can see what the pools do.