Deconstructing the cache image path on Magento

The image URL that you’ve given is impossible to have with a Magento store. I’m guessing you wanted it to be obfuscated, but in doing so have made it impossible to answer. So using a real example. Eg /media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/m/e/me-d1_2.jpg De constructing the cache image path /media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/m/e/me-d1_2.jpg |___________________________|_|_____|________________________________|_|_|__________| | | | | | | | Cache Directory | | | | | | Mage/Catalog/Model/Product/Media/Config.php | | | | getBaseMediaPath() | | | | | | | | | | | | | | | | | | Store ID | | | | Mage::app()->getStore()->getId() | | | | | | | | | | | | | Subdirectory | | | | Mage/Catalog/Model/Product/Image.php | | | getDestinationSubdir() | | | | | | | | | | | | MD5 of Image Params | | | See below | | | Mage/Catalog/Model/Product/Image.php Line +324 | | | | | | | … Continue reading

APC and Memcache with Magento

You need to understand the clear distinction between these two products to understand how to use them. APC is both an OPCode Cache and Fast Backend Memcache is just a Fast Backend Using APC as an OPCode Cache Simply install the module on your server pecl install apc And enable it in your php.ini echo “extension=apc.so” >> /usr/lib/local/php.ini (RedHat/Centos) echo “extension=apc.so” >> /etc/php5/conf.d/20apc.ini (Debian) You then enable and fine-tune the runtime configuration to suit, eg. apc.enabledapc.shm_segmentsapc.shm_sizeapc.optimizationapc.num_files_hintapc.user_entries_hintapc.ttlapc.user_ttl… Then restart PHP/Apache /etc/init.d/httpd restart (RedHat/Centos) /etc/init.d/apache2 restart (Debian) After that, there is nothing else to do. Confirm APC is enabled with a quick phpinfo() – but otherwise, at this point, the OPCode cache portion of APC is active. Nothing needs to be configured on Magento’s side. Using APC as a Fast Backend You need to add the following to your ./app/etc/local.xml <global> … <cache> <backend>apc</backend> <prefix>mystore_</prefix> </cache> … </global> Then flush your existing … Continue reading

MySQL and Magento Peformance Tuning

Define performance Do you mean the page load time for a single user, or the overall capacity/total concurrency? The two are very distinctly different – and not strictly related. It is entirely possible to have a fast store with limited capacity; or a slow store with lots of capacity. So when addressing either type of performance: Single user perceived page load time Total capacity/concurrency You have to tackle each independently with their own solutions – especially since each have their own bottlenecks. Lets make the assumption you are with a competent host that has already configured the server optimally for your store. Single user perceived page load time Is MySQL the bottleneckNo. Not directly. Its all about latency, in the majority of cases when testing page load time – only the caches will be hit. So the key here is to minimise latency. Tune MySQL cache sizes appropriately (there is … Continue reading

Multiple SOLR Cores for Magento on Debian/Ubuntu/CentOS/RedHat

On Debian/Ubuntu The most straightforward installation is pretty easy using tomcat and your package manager. The dependencies will be met automatically. apt-get install tomcat6 On CentOS/RedHat You need to grab some alternative repo’s to make this possible Eg. rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm Then you can install the package from yum yum install yum-priorities ant tomcat6 tomcat6-admin cd /usr/src/ mkdir sun-java cd sun-java Now it gets a little trickier. Sun used to permit direct downloads; but they now have a stupid session validation in place – so download the binary via your PC and upload it to the machine. You need both the Linux JDK and JRE. The commands would have been: wget -O jdk.rpm.bin http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64-rpm.bin wget -O jre.rpm.bin http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jre-6u29-linux-x64-rpm.bin You can alternatively use OpenJDK wget http://jpackage.org/jpackage50.repo -O /etc/yum.repos.d/jpackage50.repo yum install -y java-1.6.0-openjdk Once you’ve uploaded the binaries chmod +x *.bin ./jre.rpm.bin ./jdk.rpm.bin ln -s /var/lib/tomcat6 … Continue reading

Magento with Varnish

Is Varnish right for you? Varnish isn’t the be-all and end-all of Magento performance. Its great to offset load from bots & window-shoppers – but it shouldn’t be your first port of call to actually making your store faster. In fact, implementing Varnish should be the last performance modification to your store. Only drop it in once you are seeing the page load times Magento is capable of delivering without it (Eg. <600ms page load times). Your store still needs to be fast As Varnish still requires at least a single page load to prime the cache, it means your un-cached performance still needs to be very good. A vast majority of unique URLs (layered navigation hits, search queries etc.) will never really end up being served from Varnish unless either: a) Your TTLs are so high, that a search query from 4 days ago is still valid today b) … Continue reading