cancel
Showing results for 
Search instead for 
Did you mean: 

Checkout loading times for Shipping & Payment methods

Checkout loading times for Shipping & Payment methods

Experience issues again with Magento Checkout

Issue:  Long loading times for calculations during checkout
Steps to reproduce:  Add item to cart, go to checkout, select country/province/city/zipcode

Checkout:   Shipping Method, Payment Method, and Summary have excessive loading times during checkout process.

Typical recalculation times are about 0.7-1 second to reload the shipping information and payment information, however, on our site; it takes between 5-12 seconds now.

www.gamergearguru.com


5 REPLIES

Re: Checkout loading times for Shipping & Payment methods

Ok! Very nice, very nice. You've significantly reduced the number of CSS and JS files from your last post. Your webpage itself actually loads in 3 seconds, which could be sped up by optimizing your Jpeg images, reducing how many images you're using in your theme design AND implementing LAZY LOADER for your images.

 

But the primary focus right now should be on your server. Your server is taking seven seconds before it even begins sending data to the user. Caching should really only be used as a last resort. Caching should never be used as a first defense against a slow website. So here's my giant list of things that you need to look at fixing, try to get to as many of these items as possible, and when you're done, here's a good article about Optimizing Magento that you can look at too.

 

Enable Flat Products and Catalog Tables

This should cut your load speeds in half if you have complex product attributes. Magento built a lot of flexibility into their system with their EAV Models, which allow administrators to create customized data fields for products and categories. With this flexibility does come a cost and that cost is speed. The amount of time that it takes Magento to join together the many different database tables can cost more than ten seconds in some cases.

 

Enable Magento’s Compiler

I have to be honest, this is difficult to enable because not all extensions are compatible with it. Enable this after you install every plugin, make sure that you've disabled all caching and deleted the cache directory before attempting to enable the compiler.

 

Magento uses an autoloading system in PHP which gives developers a lot of flexibility in their code. As soon as a chunk of code is called, Magento attempts to locate the file that contains the code by searching in more than three different locations for the file. Unfortunately, it will always find the file in the last location because the first locations are designed for class overriding.

 

Use more Ajax

When users have to reload an entire webpage just to add a product to their carts, or reload entire web pages when they only need a small section refreshed, they have to wait. Reloading an entire page is also much more memory intensive on a server. The server is required to re-cache data, rebuild data, and serve more requests than are necessary.

Enable Apache KeepAlive

Each time that a user needs to request something new from the server, a complete HTTP handshake needs to take place. This can cause a massive slow down in your server’s ability to respond to every request. Keepalive removes the requirement to renew the handshake every time.

 

Place a faster web server in front of Apache, like Nginx

When a request is made to an Apache server, Apache loads all of it’s modules and then serves the request. Therefore, it’s true that Apache will load the PHP module even when it’s only serving a text file or an image file. When Apache does this, it earmarks memory on the server that it does not use. Another problem with Apache is that it will not serve multiple requests at the same time. It’s a single threaded application by default and can only serve one request at a time.

 

Other webservers like Nginx and Varnish are multi-threaded and they do not work with PHP by default. So the memory to run PHP will not be earmarked and these servers will serve multiple requests at the same time. The end result is a massively faster server.

 

Use A File Storage Location For Images, Like Amazon S2

I cannot tell you enough how much stress will be taken off of your server when you use an asset server to load your images, css files and js files. You'll easily double the amount of traffic that your hosting server can handle.

 

Compress your Media files

Inside of your images there’s a lot of data that you don’t get to see, most of this data you will never need on a website. Who needs geolocation data hidden in the images of an Ecommerce store? Yes that information exists in each of your images, but that’s a topic for another day. You can clean out all of this unnecessary data by optimizing and compressing your images.

 

Now you can Enable Caching

Now that you've attempted to solve the actual problems which are slowing your server, it's time to begin enabling caching mechanisms. Here are a few:

  • Expires Headers In Your HTACCESS File
  • GZIP Compression
  • APC (Advanced PHP Caching)
  • MySQL Caching!!! Super important to give MySQL lots of RAM and lots of room to cache queries
  • Magento Caching
  • Full Page Caching
  • CDN (Content Delivery Networks)

 

Phew... Long winded... hopefully you can understand all of that, I got into rant mode a few times, so I hope that it's still easy to understand. A few of these items are pretty complex to get setup, so do the ones that you know you can and hire somebody else to do the other ones. Additionally, some of these items cannot be done on shared hosting accounts, another reason to use a VPS with Magento!

 

Good Luck my Friend!

Enterprise Architect

800-207-1221
https://merchantprotocol.com

Magento Extension Developers

Re: Checkout loading times for Shipping & Payment methods

Thanks for all of the suggestions,

At the moment we've completed about 85% of the list already,

Cache is turned off completely right now to debug the issue;

I think the issue is more of a script issue or php coding thats wrong and doing unessisary loading of stuff or something.

Re: Checkout loading times for Shipping & Payment methods

You're going to need to locate the issue in order to fix it. If you've tried to speed up the store, but you still feel like there's a memory leak or CPU leak somewhere, then you're going to have to isolate systems in order to determine the system with the leak.

 

I suggest that you install a second magento along side of your current one. Test the load times of this new magento install, put it through the speed test and save the speed test for later referencing.

 

Begin moving over one plugin from your current store, to your test store and repeat the speed testing. Move your theme over last and record the speed test.

 

If an obvious problem presents itself, then you'll be able to fix it. Otherwise the problem is going to be your hosting server. You may not be receiving enough RAM or CPU for your store. Magento is a bit of a beast and requires lots of both.

 

I know it's a long and frustrating process to go through all of this trouble, but unfortunately there's no easy fix. Create a new reply to this message as a follow along of your progress. Make sure to link to your speed tests throughout the processes. It might even be a food idea to post the overview data from the speed tests here as well.

Enterprise Architect

800-207-1221
https://merchantprotocol.com

Magento Extension Developers

Re: Checkout loading times for Shipping & Payment methods

That'll be impossible unfortunately.  

Most the modules we have use serial keys tied to the domain so that would require thousands of dollars to purchase additional keys for a test domain. 

And its not the server as I have a 2nd magento store running an older version of Magento that has no issues on the same VPS.

Its something wrong with the app/code/mage/checkout folder most likely

Re: Checkout loading times for Shipping & Payment methods

You could create the second store at yourdomain.com/staging which would allow you to use the same license keys. Your alternative is going to be disabling 100% of your plugins and your theme and testing your store at every step.

 

I know that you are confident that the problem is within a specific area, but unfortunately there's no way of zeroing in on the problem until we find the exact module responsible for the slow down.

 

You do have a third option, that is to install XDebug on your server and enable the XDebug profiler. This will require a webserver restart. You can confirm that it's running with phpinfo();

 

The XDebug profiler will create cachegrind.logs each time you request a page load from your Magento install. The cachegrind logs are an extensive version of Magento's profiler. I had a look at the profiler data from your store and it seems that the MAGE class and the url matching are taking the vast majority of your resources. The XDebug profiler will show the resource usage of every single function in your Magento install.

 

You'll need to install cachegrind to interpret the profiler logs generated by XDebug, Here's a good tutorial on how to use XDebug profiler and Cachegrind.

 

This setup will allow you to locate even the most micro resource usage and optimize your platform with a microscope. I hope that this helps.

Enterprise Architect

800-207-1221
https://merchantprotocol.com

Magento Extension Developers