0

I inherited a project from a work colleage about a year ago now. It's a Magento 1.9.2.1 store (heavily customised) and after reviewing areas of code, I almost had a heart attack.

Up until the beginning of February the site has been running fast without any issues. However the site has suddenly slowed up. Page load times have gone from 1-2 seconds to 7-11 seconds.

No code or updates have been made to the store, which makes me think it could be a database issue. However, I have checked all of the culprit tables (log tables truncated and optimised, Core URL rewrites at a stable amount), but no joy.

This is happening on all pages across the site, category, home and product pages.

I have resorted to creating a copy of the site and turning on the profiler (first time using this). Looking through the output of the profiler it seems the speed decrease is coming from the following areas in the profile tree:

mage    8.6182
mage::dispatch::routers_match   8.5354
mage::dispatch::controller::action::catalog_category_view: 8.5129
layout/db_update: default   8.4524
layout/db_update: MAP_popup 8.4476  
layout/db_update: SHORTCUT_popup    8.4465  
layout/db_update: SHORTCUT_uk_popup 8.4452  
layout/db_update: catalog_category_layered  8.4444  
layout/db_update: CATEGORY_260  8.4434  
layout/db_update: customer_logged_out   8.4423
mage::dispatch::controller::action::catalog_category_view::layout_render    8.3916

All caches are turned on, but yet after the initial load of a page, any subsequent load is still just as slow.

Can anybody point me in the right direction as I have come to a dead end.

The admin area is still quick and nippy.

  • Did you logging slow queries ? That could be a huge help to help you debugging such issue. You can get more information here if you don't know how to proceed: blog.nexcess.net/2011/04/15/logging-database-queries-in-magento – Raphael at Digital Pianism Feb 22 '16 at 15:42
  • Did you turn of flat catalog options? – Phoenix128_RiccardoT Feb 22 '16 at 15:48
  • Yes i'm not using flat catalog or products. Turning flat catalog on stops the category pages from working.. I am trying the slow queries advice right now. – rosey85uk Feb 22 '16 at 15:50
  • I have followed the guide you mentioned about turning on logging slow queries, however after enabling it and trying. No log file is created.. – rosey85uk Feb 22 '16 at 16:01
  • 1
    Your profiling tells you you have a "template" bottleneck (8.3916 secs on layout render). It may depends on unoptimized templates. Maybe "load" methods on your templates or something like that. Swith back to default template for a test and see if you notice a drastical performance change. You can also check sales_flat_quote table. Sometimes too many saved carts slow down your Magento in a significant way. – Phoenix128_RiccardoT Feb 22 '16 at 16:08
1

Just and idea. This could be due to some module making an http request and not getting a response.

Try to debug this lib/Zend/Http/Client.php :: request()

Place a die(); statement there and see if it breaks your frontend. Sometimes modules check their license on every request

  • Hi Eugen! Thanks I will give this a try tomorrow when I'm back in the office. I did see some errors in the logs about http requests failing. – rosey85uk Feb 22 '16 at 19:37
  • Hey Eugen, just tried this, added the die(); into the request() and parts of the site stopped loading, but it was still just as slow.. :-( any other ideas? – rosey85uk Feb 22 '16 at 20:31
  • You can try to disable modules one by one and test.. this way you will find which module is causing this – Eugen Bogdanovich Feb 23 '16 at 11:19
0

Make sure you have not been hacked too. I've seen a lot of Magento websites suddently slowing down because they had maliciuous code sending POST information outside with a simple curl request.

If you see several HTTP request in your error log this may be the cause, because they are usually stopped by server admins.

Check in you PHP files if you have call to eval, $_POST or suspect base64_decode.

They usually inject malicious code directly in index.php or Mage.php.

Hope this can help you, but I hope is not your case ;) .

  • Oh god, so I just greped for those commands in PHP files and no signs of malicious code. Though I feel I'm going to have to search more tomorrow. – rosey85uk Feb 22 '16 at 21:21
  • Nice to know ;) If you do not find anything I suggest you to try a deeper analysis with cachegrind. Consider it a PHP-level profiler. It helped me a lot of time debugging performance issues. – Phoenix128_RiccardoT Feb 22 '16 at 21:24
  • Thanks for the tip, I'll take a look tomorrow I've spent over 8 hours on this today :( – rosey85uk Feb 22 '16 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.