Run Node App Forever.

Trying out forever to run stream “forever”.

Would recommend running the service using something like forever https://github.com/nodejitsu/forever

Info here: http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever

> sudo npm install forever-monitor
> cd /var/wwwnodejs/stream/js-app
> forever start app.js
info: Forever processes running
data: uid command script forever pid logfile uptime
data: [0] Cqqg /usr/local/bin/node app.js 1513 1606 /home/sysadmin/.forever/Cqqg.log 0:0:10:39.468

WP Super Cache vs Batcache / Memcache

Furthering our attempts to make our WordPress install handle real time classroom back channel usage I started testing Batcache/Memcache in our verf environment as a replacement for the good old reliable WP Super Cache . WP Super Cache is great in a single server install with traditional traffic serving cached pages but once you have a fair number of users logging in across a multi server install it maybe time to move to a  persistent backend cache for the WordPress object cache.

Install
memcache installed on a 1 CPU / 4 GB RAM VM runing RHEL 6.3 (Santiago)

on the web servers pecl memcache-3.0.7 installed *this was key 2.2.7 the default was very buggy. web server had 4GB of RAM and 2xCPU

memcache settings:

PORT="11211"
USER="memcached"
MAXCONN="2048"
CACHESIZE="512"
OPTIONS=""

Test Results comparing WP-Super-Cache vs Batcache/Memcache

using ab -n 600 -c 100 against a site running PulsePress

wpsupercache vs batcache

WP Super Cache

Concurrency Level:      100
Requests per second:    49.32 [#/sec] (mean)

Batcache/Memcache

Concurrency Level:      100
Requests per second:    1007.86 [#/sec] (mean)

That is a huge jump in requests per second.

Trying even bigger loads with 250 concurrent making 5000 requests still had a pretty solid result:

Requests per second:    333.19 [#/sec] (mean)

Tuned Apache vs Nginx

WordPress is great when used as a general CMS/Blog platform it can scale quite easily using some basic caching methods, but when you start using it as an app with a fairly large number of users logged in like in a live classroom backchannel/response system scenario some performance issues start to pop up.

We are going through all the components and trying to see how we can improve performance. One is moving away from Apache and switching to Nginx. I did a very quick test comparing a tuned Apache with PHP and APC enabled vs a Nginx PHP-FPM APC install results are below. Should note I did not do any tuning with Nginx (will be the next test) but as you can see Nginx performs much better under high load.

using: ab -n 600 -c 100

Results:

Apache

Concurrency Level: 100
Time taken for tests: 54.546 seconds
Complete requests: 600
Failed requests: 0
Write errors: 0
Total transferred: 9122400 bytes
HTML transferred: 8999400 bytes
Requests per second: 11.00 [#/sec] (mean)
Time per request: 9090.968 [ms] (mean)
Time per request: 90.910 [ms] (mean, across all concurrent requests)
Transfer rate: 163.32 [Kbytes/sec] received

Nginx

Concurrency Level: 100
Time taken for tests: 35.677 seconds
Complete requests: 600
Failed requests: 0
Write errors: 0
Total transferred: 9125400 bytes
HTML transferred: 8999400 bytes
Requests per second: 16.82 [#/sec] (mean)
Time per request: 5946.115 [ms] (mean)
Time per request: 59.461 [ms] (mean, across all concurrent requests)
Transfer rate: 249.79 [Kbytes/sec] received

Apache Default config vs Tuned

Most people go with the default Apache config and hope for the best. Generally this can be ok if the traffic is light but once you start having more concurrent connections this may not work out for you. I am not going to go into details on tuning (there are a ton of posts on it) but this is a graph of a before and after of apache under load after merely removing excess apache modules and tweaking the KeepAlive settings.

using: ab -n 600 -100

Installing phpunit with MAMP

This was kind of annoying so will document for others in our group.

Assuming you have MAMP installed in the default location and are using php 5.3+


sh-3.2# cd /Applications/MAMP/bin/php5.3/bin/


#sh-3.2 ./pear channel-update pear.php.net
#sh-3.2 pear upgrade pear
#sh-3.2 channel-discover pear.phpunit.de
#sh-3.2 channel-discover pear.symfony-project.com
#sh-3.2 pear install --alldeps phpunit/PHPUnit

If the above went smoothly you should be able run

sh-3.2# phpunit --version

returning

PHPUnit 3.6.10 by Sebastian Bergmann.

Add phpunit to your path


vim ~/.profile

Add the following:


export PATH=/Applications/MAMP/bin/php5.3/bin:$PATH

Load it from home dir :

. ./.profile

check that it’s in your $PATH


echo $PATH