vps上面装了xcache,速度明显快了很多。

安装方法

wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
tar -xvf xcache-1.2.2.tar.gz
cd xcache-1.2.2
phpize

./configure –enable-xcache –enable-xcache-coverager
make
make install

得到结果:
Installing shared extensions: /usr/lib/php/modules/
将配置加入php.ini
cat xcache.ini >> /etc/php.ini
directAdmin中的php.ini是/usr/local/php.ini

编辑php.ini文件
php.ini 将 xcache.so的路径改为 /usr/lib/php/modules/xcache.so
修改php.ini xcache.admin.pass=”” 为md5(”密码”)的值


extension = ../xcache.so
;../为installing shared extensions
; xcache
xcache.admin.user = “admin”
xcache.admin.pass = “md5("password")”

复制xcache下面admin文件夹到网站目录。
如:$ cp -a ~/src/xcache/admin /var/www/example.com/htdocs/xcache-admin
config.php.example改为config.php,同样填入用户名和密码
$_SERVER["PHP_AUTH_USER"] = “admin”;
$_SERVER["PHP_AUTH_PW"] = “md5(“password”)”;

性能测试

测试语句
ab -n 100000 http://localhost/phpmyadmin
未安装xcache:
Requests per second: 5910.08 [#/sec] (mean)

安装xcache后
Requests per second: 6267.32 [#/sec] (mean)


相关日志