0

I have an extension built that programatically creates an order based on a REST API. It is working fine on a number of sites, but on 2 it recently has started showing a new behavior.

After about 3 to 5 days the site slows to a crawl (from maximum 3 seconds to load a page to as much as 12) and the site begins to run well again as soon as the extension is uninstalled. Nothing else is changed in the backend except installing/uninstalling the extension.

My theory was a forced log being left on and creating massive log files. It's looking like I was wrong. Now I don't have another theory. As I follow the code with xdebug and phpstorm, nothing seems to be going wrong, and nothing seems to take a long time.

What are some other possible ways that an extension can cause slow-down, but only after a couple of days?

Any ideas that might lead me in the right direction would be VERY appreciated.

EDITS:

re:can you explain "that programatically creates an order based on a REST API" a bit more? – andrewkett

  1. A jquery script run on the cart redirects a customer to a 3rd party hosted checkout based on the customers geoip
  2. the customer is redirected back with a new param on the url to my custom controller
  3. the controller makes a call to a RESTful API which returns an xml with order details
  4. the details are then used to build an order with the quote items in magento and the customer/payment info in the XML (based fairly heavily on http://www.devinrolsen.com/creating-magento-orders-programmatically/ )
  5. order is submitted, confirmation emails sent, etc.

this all is working well on a number of sites.

6
  • can you explain "that programatically creates an order based on a REST API" a bit more? Commented Feb 16, 2015 at 8:02
  • 1
    Have you checked for Sleeping processes in MySQL? Have you looked for slow queries? Have you considered running New Relic, they have a 30 day trial. Commented Feb 16, 2015 at 8:29
  • @brentwpeterson - I don't have DB access on this site, so no. Is that a big possibility? The connection is a singleton, so shouldn't it only allow one instance of itself? Does it need to be explicitly closed with Magento? Also the only connection that my extension is the cause of is on the controller I mention above. So based on the number of customers that came through the sites that are having problems, it should really only be less than 10 connection even if they are left open forever. mySQL is definitely not my strong point, so please tell me where I don't understand it.
    – Matt Flamm
    Commented Feb 16, 2015 at 12:31
  • @andrewkett - added info in an edit to the question above.
    – Matt Flamm
    Commented Feb 16, 2015 at 12:32
  • You can access your SQL box by using the credentials in your local.xml file. From there you can type show processlist; and it will show you if there are any sleeping processes Commented Feb 16, 2015 at 12:40

1 Answer 1

2

i suggest you enable Magento Profiler and compare its output with and without that extension.

System > Configuration > Advanced > Developer > Debug > Profiler set to Yes

in index.php uncomment Varien_Profiler::enable()

Magento Extensions might slow down your website because of:

  • Observers, the extension might do something on every page load
  • Additional cron event that might be run too frequent
  • Overwritten controller, that is also doing something on every page request
3
  • @golvvy.com - it's a live site, so they may not agree to the profiler. I'll try though since it sounds like a good idea. The only observer is on sales_order_place_after, there isn't any cron that is active, and my controller only effects the "success" page when an order has been placed. The slow down occurs to every page on the site, and only starts after a few days of running well.
    – Matt Flamm
    Commented Feb 16, 2015 at 12:45
  • Hi, profiling would definitely help here. Install Aoe_Profiler (fbrnc.net/blog/2012/08/magento-profiler) - it will allow you to hide the profiler from front, and only show if you add ?profile=1 to the request. Apart from that, it is just a lot easier to read, and use.
    – ProxiBlue
    Commented Feb 16, 2015 at 13:02
  • I've requested they turn on profiling. No reply yet. While I'm waiting is there anything else to check?
    – Matt Flamm
    Commented Feb 17, 2015 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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