Yireo - Extensions, tutorials and blog for Magento and Joomla!

Blog Tags

MageBridge Standard

Put your hardware to use

Friday, 03 September 2010

Software needs hardware, and when looking at a heavier software-application like Magento, you also need heavier hardware. But is buying a 16-CPU 128Gb-RAM server enough? Or do you need to do something else as well? When working in the field, we came to the conclusion that a lot of hosting environments are not optimized to make use of the underlying hardware - this is a waste of money.

Optimizing the LAMP applications

When adding more memory to your Linux server, you need to realize that - while Windows is a memory-hog in general - Linux applications are dealing with memory very neatly: When you assign a lot of memory to those applications, they will use it. But the default is often to assign as little memory as possible: This allows the same configuration to be applied to your heavy-weight server as well as an old i686 PC.

Change the default settings

The clue is: Change the default settings. All the applications in the LAMP stack have options that allow tuning of memory: With Apache it's a bit more difficult, but PHP offers plenty of options that can easily be configured. Also MySQL has a my.cnf file that allows an awful lot of optimizations - mainly concerning the memory consumption of MySQL.

... and Linux

But there's more: A generic Linux installation is fine to serve as mailserver, webserver, database-server, SMB-fileserver or even desktop. Each purpose has it's own optimization. But if your server should perform best as webserver, there are various Linux kernel-settings that should be optimized just for that purpose: A webserver most commonly needs to serve a lot of small files very fast. Also the type of filesystem (ext4, XFS, ReiserFS) is part of the optimization.

With Magento, the default is worse

With Magento, more resources are actually needed but if you don't assign these resources, your shop will run dead-slow. For instance, the PHP memory_limit on most systems is 32Mb while Magento requires 256Mb at a minimum.

Another fun PHP-setting is realpath_cache_size which contains all to the paths to PHP-scripts that are included in Magento. The default is 16Kb. Let's assume a ridiculous case that all Magento files are required at a specific page-load: If we create a file with a list of all the Magento filenames we end up with a file of 650Kb. This shows that 16Kb is by far not enough.

Conclusion

This list goes on and on. The main point of this blog is not to list all the tricks, but to wake you up to the reality: Buying more hardware is a waste of money unless you spend time on tuning it.

About Yireo

Yireo tries to help webdevelopers build successful Joomla! and Magento sites.

More about Yireo