2

Does anyone know any techniques for speeding up Magento's API?

We have recently been working on an integration that is heavily dependant on a variety of API calls running at a reasonable speed, however it is taking a very long time to complete even basic updates.

I do appreciate that there is a lot going on behind the scenes in terms of EAV lookups (product updates etc) and that for obvious reasons caching is not an option but I am keen to know where the main bottlenecks lie.

Can anyone provide any useful suggestions here?

2
  • How do you do the API calls? Soap or XML-RPC? Mar 29, 2013 at 15:25
  • Forgot to say! Using SOAP..
    – Boots
    Mar 29, 2013 at 15:33

2 Answers 2

5

Try using the Mercury API: http://store.pulsestorm.net/products/mercury-api - it adds several things to improve performance, including WSDL caching and pagination.

2
  • FYI: WSDL caching is supported natively in Magento CE 1.7+ Mar 29, 2013 at 18:56
  • Oh interesting. I probably should have known that! Mar 29, 2013 at 19:15
1

Depends on what do you mean by "slow". ~2 seconds for a save operation is normal in Magento. Yet, I have seen systems where a product save operation (being part of an API call or not) takes > 10 seconds. Most of the time this is due to the indexes. The save operation is fast, but indexes tend to become slow as catalog size increases. A quick solution is to set the indexes on Manual (System->Index Management). This will of course result in some changes not being visible in the frontend, e.g. setting the price index to manual will not update the price on the frontend.

By far, the slowest index is catalog url rewrites. The good news is that having an "on save" update makes a difference only when you add a product/change its url. Even in this case, the product will still be visible, only that the URL will not be "nice". I find setting this indexer on manual (with a daily full reindex) being a reasonable compromise. Try this, and if the save operations are still slow, look at the other indexes and see what you can live without.

Further than this, you could to a xdebug profile on your operation. If you use a mostly-default Magento, this will most likely not result in anything actionable. But if you are using a fair amount of community/custom modules you may be amazed on the results. It is not uncommon to realize that most of the time is spent in some non-essential operation added by custom code.

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