debian上快速安装xcache

作者:admin,2010年一月5日 8:28 上午,分类:linux, php

不用phpize安装了,debian上可以迅速安装上,需要保证你的/etc/apt/sources.list下面是新的。

然后直接 apt-get install php5-xcache

/etc/init.d/apache2 restart

很快就看到结果了。可以用phpinfo看下。

php -r “phpinfo();”|grep “xcache”

/etc/php5/cli/conf.d/xcache.ini,
xcache.admin.enable_auth => On => On
xcache.cacher => On => On
xcache.coredump_directory => no value => no value
xcache.count => 1 => 1
xcache.coveragedump_directory => no value => no value
xcache.coverager => Off => Off
xcache.gc_interval => 0 => 0
xcache.mmap_path => /dev/zero => /dev/zero
xcache.optimizer => On => On
xcache.readonly_protection => no value => no value
xcache.shm_scheme => mmap => mmap
xcache.size => 0 => 0
xcache.slots => 8K => 8K
xcache.stat => On => On
xcache.test => no value => no value
xcache.ttl => 0 => 0
xcache.var_count => 1 => 1
xcache.var_gc_interval => 300 => 300
xcache.var_maxttl => 0 => 0
xcache.var_size => 0M => 0M
xcache.var_slots => 8K => 8K
xcache.var_ttl => 0 => 0

上面的就是配置相关信息,如果xcache_size=0就是关闭xcache的使用

具体配置参数的意义可以参考http://xcache.lighttpd.net/wiki/XcacheIni#XCacheCacher

然后可以做下压力测试,看看结果。

ab -c5 -n3000 http://liufb.kuxun.cn  并发连接为5,3000次请求

具体我用的是sudo ab -n 1000  http://liufb.kuxun.cn/beijing
安装xcache后的
Server Software:        Apache/2.2.9
Server Hostname:        liufb.kuxun.cn
Server Port:            80

Document Path:          /beijing
Document Length:        98026 bytes

Concurrency Level:      1
Time taken for tests:   373.665 seconds
Complete requests:      1000
Failed requests:        974
(Connect: 0, Receive: 0, Length: 974, Exceptions: 0)
Write errors:           0
Total transferred:      97639210 bytes
HTML transferred:       97172210 bytes
Requests per second:    2.68 [#/sec] (mean)
Time per request:       373.665 [ms] (mean)
Time per request:       373.665 [ms] (mean, across all concurrent requests)
Transfer rate:          255.18 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   330  374 191.1    347    3689
Waiting:      139  188 190.8    162    3502
Total:        330  374 191.1    347    3689

Percentage of the requests served within a certain time (ms)
50%    347
66%    352
75%    355
80%    359
90%    374
95%    414
98%    753
99%   1298
100%   3689 (longest request)

Server Software:        Apache/2.2.9
Server Hostname:        liufb.kuxun.cn
Server Port:            80

Document Path:          /beijing
Document Length:        96315 bytes

Concurrency Level:      1
Time taken for tests:   401.374 seconds
Complete requests:      1000
Failed requests:        914
(Connect: 0, Receive: 0, Length: 914, Exceptions: 0)
Write errors:           0
Total transferred:      97633782 bytes
HTML transferred:       97166782 bytes
Requests per second:    2.49 [#/sec] (mean)
Time per request:       401.374 [ms] (mean)
Time per request:       401.374 [ms] (mean, across all concurrent requests)
Transfer rate:          237.55 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   372  401  81.0    390    1504
Waiting:      185  213  80.5    202    1311
Total:        372  401  81.0    390    1504

Percentage of the requests served within a certain time (ms)
50%    390
66%    394
75%    398
80%    400
90%    413
95%    443
98%    561
99%    749
100%   1504 (longest request)

后用webbench测试结果可以看到:

没有安装xcache的测试。
liufb@kooxoo240:~/webbench/webbench-1.5$ webbench -c1000 -t 20 http://liufb.kuxun.cn/
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://liufb.kuxun.cn/
1000 clients, running 20 sec.

Speed=903 pages/min, 318838 bytes/sec.
Requests: 301 susceed, 0 failed.

xcache的测试 xcache.size  =               32M

liufb@kooxoo240:~/webbench/webbench-1.5$ webbench -c1000 -t 20 http://liufb.kuxun.cn/
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://liufb.kuxun.cn/
1000 clients, running 20 sec.

Speed=2388 pages/min, 430682 bytes/sec.
Requests: 796 susceed, 0 failed.

的安装不上可以看

http://www.howtoforge.com/xcache-php5-apache2-debian-etch

发表评论