Methods To Speed Up Magento - A Guide To Making Magento Faster

来源:互联网 发布:linux系统可以ghost吗 编辑:程序博客网 时间:2024/06/15 20:32

Methods To Speed Up Magento 

Hi Guys, 

Ok. Figuring out how to get this puppy purring over the last few days. 

Thought I would post a ‘How To Speed up Magento’ Guide based on what I have found out. And maybe others can chip in afterwards with their top tips, and we can turn this into a one-stop thread to getting Magento installs working nice and fast smile 

1/ Install Fooman Speedster 

This one made a massive difference to page loads for the first site I am testing. 

http://www.magentocommerce.com/extension/457/fooman-speedster 

2/ Enable Gzip Compression in .htaccess 

http://www.magentocommerce.com/boards/viewthread/7100/ 

To do this, uncomment this part in the .htacess: (Line 52) 

#php_flag zlib.output_compression on 

(ie Remove the # save and reupload) 

(Next 4 are from - http://www.magentocommerce.com/blog/comments/performance-is-key-notes-on-magentos-performance/) 


3/ Install APC or Xcache 

APC - http://pecl.php.net/package/APC 

Xcache - http://xcache.lighttpd.net/ 

Looking at benchmarks and folks comments, it seems to be a toss of coin which one to go for. 

I will probably go for APC on balance. 

Will be asking my host to install this. 

Ok. My host installed it. And further to Discovery posting below, thought I would add that in here to the main body. Discovery pointed out that thread here had extra tips once APC had been installed:http://www.magentocommerce.com/boards/viewthread/9882/ 

Essentially, after APC has been installed, you locate the local.xml file in the install. (Mine was here - /home/yoursitename/public_html/app/etc/local.xml 

You then add the following code to just below: 

<global>

<cache>
<
backend>apc</backend>
<
prefix>alphanumeric</prefix>
</
cache>

I have to say that I actually have installed APC, and then tried this, but that it actually slowed down my server. Response times went up from about 2 seconds to 3 seconds. 

Your mileage may however vary, so give it a go grin 

Edit to My Edit....  wink Turns out I didn’t have APC installed properly. Thought it was odd that I had no speed improvements when everyone else seemed to, so I went hunting for the reason. 

Found this thread here on php.net 

http://uk3.php.net/manual/en/apc.configuration.php 

Point this part out to your host: 

Once you have a running server, you should copy the apc.php script that comes with the extension to somewhere in your docroot and load it up in your browser. It provides you with a detailed look at what is happening in your cache. If you have GD enabled in PHP, it will even have pretty graphs.

Then you can check out http://www.yourdomain.com/apc.php and decide whether its working. 

(If you compare the one on your own server to this one on the PHP server: 

http://www.php.net/~rasmus/apc.php 

then it becomes clearer whether it is working correctly) 

4/ “Make sure your Apache configuration has KeepAlives enabled. KeepAlives are a trick where multiple HTTP requests can be funneled through a single TCP connection. Since the setup of each TCP connection incurs additional time, this can significantly reduce the time it takes to download all the files (HTML, JavaScript, images) for a website.” 

No idea what this is. And there is no further mention of it anywhere. So I will ask my host to enable it.  Would be good to have some more info on this, if anyone knows what it is? 


5/"Modify the configuration for your MySQL server to take better advantage of your server’s RAM. Most Linux distributions provide a conservative MySQL package out of the box to ensure it will run on a wide array of hardware configurations. If you have ample RAM (eg, 1gb or more), then you may want to try tweaking the configuration. An example my.cnf is below, though you will want to consult the MySQL documentation for a complete list of configuration directives and recommended settings.” 

They have a list of settings there for my.cnf as follows: 

key_buffer = 512M 
max_allowed_packet = 64M 
table_cache = 512 
sort_buffer_size = 4m 
read_buffer_size = 4m 
read_rnd_buffer_size = 2m 
myisam_sort_buffer_size = 64m 
tmp_table_size = 128m 
query_cache_size = 96m 
query_cache_type = 1 
thread_cache_size = 8 
max_connections = 400 
wait_timeout = 300 

Again, get your host to do it, (which is what I will be doing smile) or figure it out. 


6/ “Use a memory-based filesystem for Magento’s var directory. Magento makes extensive use of file-based storage for caching and session storage. The slowest component in a server is the hard drive, so if you use a memory-based filesystem such as tmpfs, you can save all those extra disk IO cycles by storing these temporary files in memory instead of storing them on your slow hard drive.” 

Ok. Rather unhelpfully, there is no mention anywhere of how to do this. 

So, if someone could post a step by step on this, then that would be useful.
 


7/ This thread here - http://www.magentocommerce.com/boards/viewthread/5366/P60/ - Includes a post from a Server Admin at Rackspace who had experience optimizing for Magento 

The two that jumped out at me were: 

a/ First off, I made some changes to your system, I increased the APC.shm.size to 128 This will allow more data to be cached by apc, in theory it’ll store more data.



(This sounds like it is linked to APC above - So maybe install APC first before doing this smile

(Continued in next post because I ran out of characters… grin)


ref  http://www.magentocommerce.com/boards/viewthread/36225/

原创粉丝点击