1
votes

I have developed custom API with Magento(1.9 community edition) SOAP API V2 to fetch orders. The problem is APIs are taking more than 25 seconds to respond. There are couple of API calls involved.

  1. /login to get API key
  2. /customOrdersApi to get orders

Both calls are taking too long to respond. CPU utilization is also maxed out during calls.

CPU-apache2

An interesting behavior I found while monitoring Magento cache (var/cache), it created a WSDL file every time and deleted it after an end of execution. That WSDL cache file's id was in upper case mage---345_WSDL_CONFIG_GLOBAL. There was already cached WSDL file in lower case mage---345_wsdl_config_global but Magento didn't pick it. After that I dug deep in Magento core files and found in code/Mage/core/Model/Cache.php, function _id($id) was turning ids in to upper case. I commented that out and Magento started to pick cached lower cased WSDL file. Response time decreased drastically and both calls started to take less than 3 seconds.

FYI Magento Core API WSDL cache is already set to true.

Has anyone experienced this behavior of Magento? Is there an efficient way to improve the speed of Magento SOAP API?

Thanks

1

1 Answers

0
votes

I am had and still having the same issue. The only thing I found so far:

Looking at the MySQL Database with the SQL command show processlist; I saw, that it tries to update the sales_flat_quote table on every request. If the table is huge it takes a lot of time.

If found this query DELETE FROM sales_flat_quote WHERE updated_at < DATE_SUB(Now(),INTERVAL 60 DAY) to only keep the last 60 days. MagentoExchange - How to handle huge sales_flat_quote tables

If I set it to 5 days the time my API call takes has reduced by 50%.