• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Tuning Server and testing with Blitz.IO

kingston

Well-known member
#1
I have two VPS running (one as a DB server and one as the app server) running Xenforo and Wordpress installations. I am working on tuning the servers to handle some peek points during the year. For my website about 6 or 7 times during the year there are certain weekends we are flooded with up to 1000% higher traffic. Xenforo has done a way better job than I ever had with VB with these weekends, but I still need to tune my setup more. I have found a website called blitz.io to help test it. This site creates some virtual users to basically rush your site and see if there are any performance issues. When I test it with Wordpress it performs beautifully. When I do it with Xenforo my site basically crawls to a halt once 35 users are all requesting at once. I have to believe it is because of something I have setup incorrectly.

I am running nginx 1.4.2, php-fpm (php 5.4), and mysql 5.5 (which again is on its own server). I have memcache running on my app server(also tried APC). Hasn't seemed to make a difference. Both servers are the exact same: Intel Xeon running at 2ghz with 4 gig of ram each.

Anyone have any ideas as to what I can do? Thanks for the help.
 

MattW

Well-known member
#2
Swap MySQL 5.5 for Percona 5.5

Have you set up InnoDB in your my.cnf since moving from VB?

If you have memcache set up, you could install it on both of your VPSs and spread the sessions across and have it clustered (that is the whole point of memcache, and why I went the Xcache for a single server instance).

That set up should easily handle several thousand visits with XenForo.

EDIT: Also, do you have any OPCode Cache installed (you can run memcache to deal with back end stuff, and use APC/Xcache to cache the compiled PHP pages).
 

kingston

Well-known member
#3
I have memcache and APC installed but couldn't figure out how to use them both from the cache instructions posted by the Xenforo team. It looked like you could use one or the other but not both.

I'm on mysql 5.5 and innodb is set by default I think?

How hard is moving to percona?

How do you setup a cluster of memcache?
Just install on both servers and put the connection information in the xenforo config.php and that's it?

Thanks for the help @MattW
 

MattW

Well-known member
#4
Are you able to post the contents of your my.cnf? InnoDB is enabled by default, VB uses MyISAM tables, so if you've upgraded, you might not have tuned MySQL for InnoDB.

Swapping to Percona is as easy as uninstalling MySQL, and re-installing Percona. It's a drop in replacement, and is tuned for InnoDB.
Guide by @Slavik : http://xenforo.com/community/resources/upgrade-to-percona-server-on-a-whm-cpanel-server-or-vps.2071/ (granted it's for cpanel/whm, but shows how to remove MySQL and install Percona)

For the cache back end. APC will work out of the box for compiling the PHP pages. That's that is does. You don't need to set anything in config.php to use it.

To have multiple memcache servers, you add them in an array in config.php :

PHP:
$config['cache']['backendOptions']=array(
        'compression'=>false,
        'servers' => array(
                array(
                        'host'=>'localhost',
                        'port'=>'11211'
                ),
                array(
                        'host'=>'IP ADDRESS 2',
                        'port'=>'11211'
                ),
                array(
                        'host'=>'IP ADDRESS 3',
                        'port'=>'11211'
                )
        )
);
 

kingston

Well-known member
#5
@MattW

I turned on memcache on my other machine and added it to the config. I wouldn't expect to see a difference today (we are in an off period and it is already pretty quick now) and I didn't. When I ran blitz.io it didn't produce any different results. I imagine that would be something I would see later one when we hit heavy traffic.

Here is my my.cnf:

Code:
#
[client]
port        = 3306
socket        = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket        = /var/run/mysqld/mysqld.sock
nice        = 0
[mysqld]
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket        = /var/run/mysqld/mysqld.sock
port        = 3306
basedir        = /usr
datadir        = /var/lib/mysql
tmpdir        = /tmp
lc-messages-dir    = /usr/share/mysql
skip-external-locking
key_buffer              = 300M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size      = 300
join_buffer_size        = 512M
tmp_table_size          = 512M
max_heap_table_size    = 256M
table_cache            = 3200
innodb_buffer_pool_size = 1024M
innodb_flush_method    = O_DIRECT
table_definition_cache    = 800
myisam-recover        = BACKUP
max_connections        = 200
query_cache_limit    = 64M
query_cache_size        = 64M
log_error = /var/log/mysql/error.log
log_slow_queries    = /var/log/mysql/mysql-slow.log
long_query_time = 2
expire_logs_days    = 10
max_binlog_size        = 100M
[mysqldump]
quick
quote-names
max_allowed_packet    = 16M
[mysql]
[isamchk]
key_buffer        = 16M
!includedir /etc/mysql/conf.d/
 

kingston

Well-known member
#6
So I decided to watch htop while I was running the blitz and it looks like it is php-fpm that is causing the bottleneck. It is spawning a lot of processes and the system load goes to 10.00. So I need to find a way to better control php I guess.