We have a Magento site running 1.9.0 that we run a handful of stores out of. Today we ran into huge performance issues, primarily dealing with Add to Cart (and all other pages involving cart operations).

Add to Cart is taking 10-15 seconds on all of our secondary stores, but if I go to the primary store (the one whose domain magento is installed behind), Add to Cart takes less than 3 seconds. We don't really know how long it was taking to add to cart before, but we hadn't had any complaints in the past and we've had several today, so we suspect this is a new issue.

I've gone through everything I can figure out and read about. The performance of the site in general has clearly improved from these things (browser caching, deflate compression, single file js and css, etc), but I've seen no improvement at all on the slow cart operations.

I've tried disabling modules (rss, log, paypaluk, and a few others), but that hasn't shown any noticeable improvement.

I've cleared my logs from the database and made sure cron is running successfully.

Hard drive space on the machine is fine (it uses SSD, by the way).
I've got the cache using tmpfs. System has 500+ MB of free RAM.

These delays are flat out killing us. Any guidance would be very appreciated!

Edit: I've got the Aoe_Profiler running. I've turned on profiling for all pages so I can see times for Add to Cart. The puzzling thing is this difference depending on which store it is.

Times for loading the checkout cart page (same items in each cart):

Store 1 - 1.253 seconds
store 2 - 5.933 seconds
Store 3 - 7.475 seconds

Store 1 has magento physically installed in its directory. Store 2 is a redirect via .html meta. Store 3 is a redirect using apache settings (DocumentRoot).

I don't think the difference between Store 2 and Store 3 is significant. That is, if I run it a few times they have a similar average load time, while Store 1 is always much lower.

Store selection ($mageRunCode) set in index.php.

Now I'm trying to find where in the code correlates to mage::dispatch::controller::action::checkout_cart_index. So far I see that it's defined in /Controller/Varien/Action.php up to the ::action part, but it's not clear to me what code is being called for the checkout_cart_index.

(if you can't tell, I've never looked at magento code before :-)

  • have you tried to log/profile add to cart action? what is actually it is pulling out. – user2857 Dec 20 '14 at 13:42
  • I have not. Is there a good way to do that other than dropping log statements w/ timestamps into the code? – Doug Porter Dec 20 '14 at 15:10
  • Sure, you can use Magento's built-in profiler and add your IP to be allowed, as in: atwix.com/magento/finding-bottlenecks or use AOE's expanded profiler: github.com/fbrnc/Aoe_Profiler – Rob Mangiafico Dec 20 '14 at 15:31
  • Wow. I had no idea it had a built in profiler. Very cool. On to the hunt... – Doug Porter Dec 20 '14 at 15:39
  • Ok. Installed aoe profiler, which worked great. On displaying cart contents, mage::dispatch::controller::action::checkout_cart_index is taking all the time. Looks like it's taking all the time on Add to Cart, too. – Doug Porter Dec 20 '14 at 16:59