XenForo in limited resource server


Well-known member
I'm trying to learn how to run xenforo forum in limited resource. :D

Right now my VPS has 1GB RAM, serving only 1 xenforo forum. 20-25 active user each day, 40-50 post each day. 150-250 UV.

Discussions: 1.660
Messages: 40.060
Members: 456

Debian 7, nginx + PHP-FPM + xcache + Percona

Can this site running in 512MB VPS? Or even lower?
Nginx + PHP-FPM are easy.

The problem is cache and database.

The problem with the cache is it doesn't really go up or down with traffic so your low traffic won't help much. It caches compiled PHP code which is a constant depending on the app. My XenForo install directory has 4758 PHP files. Of course not all of those will be cached, but there is a fairly static number that will be cached as different pages on the site are requested.

The database is going to be the most tricky. There's no flag to set to limit process memory usage wholesale. You have to play with your InnoDB settings to find the right values and it's not a simple or quick process. It would help to know your physical on-disk database size for fine tuning your database settings.

You might try checking out uWSGI instead of PHP-FPM. It has a lot more powerful memory control settings. The only RAM control setting in PHP-FPM other than control the amount of workers is recycling workers after X amount of requests. In uWSGI you can recycle workers once they reach a certain size to create a hard limit on how much RAM it can take up.
So, xcache is useless for me?

Anyway, my database size is 187MB right now.
Not useless, you just can't do much to tune the memory usage of it because it's got a static amount of information to cache regardless of the traffic on your forum unlike your database which is directly related to the size of your forum. Do you record any analytics for page load times? If so I recommend you see how much RAM your cache is taking up, disable it for a week, then compare the page load time results with and without cache to see if the RAM usage is worth the page load time improvement.

Check out this thread for tuning your database server memory usage. Most of it will be done in your InnoDB table settings.


Well-known member
Page load time is around 0.1-0.3 sec, with memory allocation 10-13MB.

The number of connection created in mysql via phpmyadmin is around 1-4 (4 is peak) So I guess I can set max connection is 10?

tmp_table_size  = 32M
max_heap_table_size  = 32M
query_cache_type  = 1
query_cache_size  = 8M
query_cache_limit  = 2M
max_connections  = 10
thread_cache_size  = 50
open_files_limit  = 65535
table_definition_cache  = 4096
table_open_cache  = 4096

innodb_flush_method  = O_DIRECT
innodb_log_files_in_group  = 2
innodb_log_file_size  = 32M
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table  = 1
innodb_buffer_pool_size  = 256M