|
Here’s a simple tutorial on how to improve Magento’s performances without changing core files.
I’m sorry this tutorial won’t help users hosting their store on a shared environment.
Installation instructions will continue my fedora / centos install guide
1 - Choose your hardware
You should try to use hardware RAID 1/5 setup in order to increase I/O rates
2 - Split the load
You should try to run apache/lighttpd/ngnix and mysql server on different servers in order to split the load of each
3 - Use php-pecl-apc extension
This module will provide some code cache of php scripts.
Installation for fedora / centos
yum install php-pecl-apc
Edit module configuration file and enable this module extension by commenting out this line
vi /etc/php.d/apc.ini
extension = apc.so
To fine tune apc performances, you may have to change other values in this default configuration file. See documentaion of APC for full configuration options.
4 - Memcache your sessions
First install a memcache server
yum install memcached
Configure memcached
vi /etc/sysconfig/memcached
And check for these lines
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS=""
To add more cache size, change the CACHESIZE option
Launch memcached server
service memcached start
Add php memcached sessions extensions
yum install php-pecl-memcache
Check extension configuration matches your memcached setup
; Enable memcache extension module extension=memcache.so
; Options for the memcache module
; Whether to transparently failover to other servers on errors ;memcache.allow_failover=1 ; Defines how many servers to try when setting and getting data. ;memcache.max_failover_attempts=20 ; Data will be transferred in chunks of this size ;memcache.chunk_size=8192 ; The default TCP port number to use when connecting to the memcached server ;memcache.default_port=11211 ; Hash function {crc32, fnv} ;memcache.hash_function=crc32 ; Hash strategy {standard, consistent} ;memcache.hash_strategy=standard
; Options to use the memcache session handler
; Use memcache as a session handler session.save_handler=memcache ; Defines a comma separated of server urls to use for session storage session.save_path="tcp://localhost:11211?persistent=1&weight;=1&timeout;=1&retry;_interval=15"
5 - Use a tmpfs filesystem for magento/var/cache
Supposing your magento leaves in /var/www/html/magento, we need to :
Stop apache
service httpd stop
Clean cache
cd /var/www/html/magento/var/cache/ rm -rf mage*
Mount a tmps cache
mount tmpfs /var/www/html/magento/var/cache -t tmpfs -o size=64m
For more space change 64m by any value (take care of your system RAM)
Restart apache
service httpd restart
6 - But not fully tested now is use mysql query cache
This need to be tested. If someone has any clue, please tell me.
7 - Some results
a) Basic setup no apc - memcached - tmpfs
ab -n 100 -c 5 http://magento.mydomain.com/
Server Software: Apache/2.2.8 Server Port: 80 ... Requests per second: 5.42 [#/sec] (mean)
b) APC setup no memcached - tmpfs
ab -n 100 -c 5 http://magento.mydomain.com/ Server Software: Apache/2.2.8 Server Hostname: magento.yves-rocher.com Server Port: 80 ... Requests per second: 10.93 [#/sec] (mean)
c) APC - memcached setup no tmpfs
ab -n 100 -c 5 http://magento.mydomain.com/ Server Software: Apache/2.2.8 Server Hostname: magento.yves-rocher.com Server Port: 80 ... Requests per second: 15.57 [#/sec] (mean)
d) Full setup
ab -n 100 -c 5 http://magento.mydomain.com/ Server Software: Apache/2.2.8 Server Hostname: magento.yves-rocher.com Server Port: 80 ... Requests per second: 17.85 [#/sec] (mean)
|