วันพฤหัสบดีที่ 11 กุมภาพันธ์ พ.ศ. 2553

xcache opcode/optimizer for php tunning

Installing xcache can help php-apache app responding faster.

1) installing xcache
gentoo :
#emerge cache
ubuntu/debian
#apt-get install php5-xcache

after installing you will see path for xcache admin
2) set xcache config and admin password
#echo -n "yourpassword" | md5sum
edit xcache.ini this line :
xcache.admin.pass="" (from previous command)
http://xcache.lighttpd.net/wiki/XcacheIni

3) point apache to xcache admin path

4) browse xcache admin with browser

use this admin page to see what variable need to be adjusted.

I'll point some importtatn config

xcache.size
- set just fit, not too low or too high. see OOM(out of memory column) from admin page. If there are lots of OOM, please consider increasing.

xcache.count
- set to number of your cpu : cat /proc/cpuinfo | grep -c processor

xcache.slots
- the more slot, the faster PHP code accessing


More reading here :

วันอังคารที่ 9 กุมภาพันธ์ พ.ศ. 2553

rrdtool tune rra file

Using SNMP and cacti, you need to adjust rrd file manually for displaying graph correctly.

/cacti/rra
show file info to see the limitation of value
#rrdtool info filename.rrd

tunning it
#rrdtool tune filename.rrd --maximum cpu_user:800

วันจันทร์ที่ 8 กุมภาพันธ์ พ.ศ. 2553

gentoo SNMP

Installing SNMP in gentoo for system monitoring.


#emerge net-snmp

edit /etc/snmp/snmpd.conf add the following
com2sec Mybox localhost public
com2sec cacti 192.168.1.0/24 public

group RWGroup v2c Mybox
group ROGroup v1 cacti
group ROGroup v2c cacti

view all included .1 80
view system included system fe

access ROGroup "" any noauth exact all none none
access RWGroup "" v2c noauth exact all all all

#rc-update add snmpd default

วันพฤหัสบดีที่ 21 มกราคม พ.ศ. 2553

timer shell script

To measure performance, you might want to know how much does it take to complete the task.
Here are shell script to help you.

The following measure hard disk performance by creating 10 GB file.
#!/bin/bash
START=$(date +%s)
# do something
# start your script work here

dd if=/dev/zero of=/home/user/hd2/file.img bs=1M count=1000

# your logic ends here
END=$(date +%s)
DIFF=$(( $END - $START ))

echo "It took $DIFF seconds"

Nginx / lighttpd light weight web server.

Apache is a standard for web server. But, you can help apache and utilize computing resource by using lighttpd and nginx as a helper for static content/load balancer for your website.

nginx :
http://wiki.nginx.org/NginxModules
lighttpd
http://redmine.lighttpd.net/wiki/lighttpd

วันพุธที่ 20 มกราคม พ.ศ. 2553

webserver http-caching header

Here are link to speed up your http server :

http://www.mnot.net/cache_docs/
http://www.web-caching.com/

User & group management : uid, gid user

If you share file about variety distro of linux, you might experience with permission error.

The following command help to change uid, gid of user apache group apache to 81 :
#usermod -u 81 apache
#groupmod -g 81 apache
#id apache


Read more: