Форумы

Модераторы: tastelinux, Frizze, andrey, Bender
Автор Добавил
andrey
Птн Авг 27 2010, 01:30

ID пользователя #2
Зарегистрирован: Срд Май 05 2010, 10:56

Сообщений: 69
суть теста, php скрипт инклюдит 10 000 пустых файлов по маске test*.php

eAccelerator
Including 10000 blank files takes: 77.408 seconds.
Including 10000 blank files takes: 0.964 seconds.
Including 10000 blank files takes: 1.241 seconds.
Including 10000 blank files takes: 1.010 seconds.
Including 10000 blank files takes: 1.085 seconds.


xCache
Including 10000 blank files takes: 58.574 seconds.
Including 10000 blank files takes: 0.631 seconds.
Including 10000 blank files takes: 0.889 seconds.
Including 10000 blank files takes: 0.748 seconds.
Including 10000 blank files takes: 0.639 seconds.


в итоге xCache победил, думаю на bitrix это существенно.

как готовился тест и как его повторить:

for i in `seq 1000 10000`; do touch test$i.php; done


в той же директории php-шный скрипт который инклюдит и выводит page generation time
<?
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];


function include_all_once ($pattern) {
    foreach (glob($pattern) as $file) {
            include $file;
                }
                }
    include_all_once('test*.php');



$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Including 10000 blank files takes: %.3f seconds.', $totaltime);

?>


Устанавливаем xCache с php 5.2.6 на CentOS

[tastelinux@rhca /]# wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
[tastelinux@rhca /]# tar zxf xcache-1.2.2.tar.gz
[tastelinux@rhca /]# cd xcache-1.2.2
[tastelinux@rhca /]# phpize
[tastelinux@rhca /]# ./configure --enable-xcache
[tastelinux@rhca /]# make &&  make install


теперь правим php.ini примерно так:

[tastelinux@rhca /]# cat /usr/local/Zend/etc/php.ini
[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
 zend_extension =  /usr/local/lib/php/extensions/no-debug-non-zts-20060613/xcache.so
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
;; For windows users, replace xcache.so with php_xcache.dll
;zend_extension_ts = c:/php/extensions/php_xcache.dll
;; or install as extension, make sure your extension_dir setting is correct
; extension = xcache.so
;; or win32:
; extension = php_xcache.dll

[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "mOo"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = ""

[xcache]
; ini only settings, all the values here is default unless explained

; select low level shm/allocator scheme implemenation
xcache.shm_scheme =        "mmap"
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size  =                32M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count =                 1
; just a hash hints, you can always store count(items) > slots
xcache.slots =                8K
; ttl of the cache item, 0=forever
xcache.ttl   =                 0
; interval of gc scanning expired items, 0=no scan, other values is in seconds
xcache.gc_interval =           0

; same as aboves but for variable cache
xcache.var_size  =            0M
xcache.var_count =             1
xcache.var_slots =            8K
; default ttl
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300

xcache.test =                Off
; N/A for /dev/zero
xcache.readonly_protection = Off
; for *nix, xcache.mmap_path is a file path, not directory.
; Use something like "/tmp/xcache" if you want to turn on ReadonlyProtection
; 2 group of php won't share the same /tmp/xcache
; for win32, xcache.mmap_path=anonymous map name, not file path
xcache.mmap_path =    "/dev/zero"


; leave it blank(disabled) or "/tmp/phpcore/"
; make sure it's writable by php (without checking open_basedir)
xcache.coredump_directory =   ""

; per request settings
xcache.cacher =               On
xcache.stat   =               On
xcache.optimizer =           Off

[xcache.coverager]
; per request settings
; enable coverage data collecting for xcache.coveragedump_directory and xcache_coverager_start/stop/get/clean() functions (will hurt executing performance)
xcache.coverager =          Off

; ini only settings
; make sure it's readable (care open_basedir) by coverage viewer script
; requires xcache.coverager=On
xcache.coveragedump_directory = ""

[Zend]
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.2.so
zend_extension_ts = /usr/local/ioncube/ioncube_loader_lin_5.2_ts.so

zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.3
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3

zend_optimizer.version=3.3.3

zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so
zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so



Установка eAccelerator
[tastelinux@dev /]# wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
[tastelinux@dev /]# tar xjf eaccelerator-0.9.5.3.tar.bz2
[tastelinux@dev /]# cd eaccelerator-0.9.5.3
[tastelinux@dev /]# phpize
[tastelinux@dev /]# ./configure
[tastelinux@dev /]# make && make install


Теперь нужно включить extension, для этого в конфиг php.ini вставим:

extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"


Создаём папку под кэш и рестартим Apache:

[tastelinux@dev /]# mkdir -p /var/cache/eaccelerator
[tastelinux@dev /]# chmod 0777 /var/cache/eaccelerator
[tastelinux@dev /]# /etc/init.d/httpd restart
Наверх
eAccelerator vs xCache   eAccelerator   xCache   

 

Перейти:     Наверх

Транслировать сообщения этой темы: rss 0.92 Транслировать сообщения этой темы: rss 2.0 Транслировать сообщения этой темы: RDF
Powered by e107 Forum System