且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento SOAP v1 与 v2 的性能

更新时间:2022-12-14 14:30:49

WSDL 请求可能需要很长时间的原因有很多,但我首先要检查的是 WSDL 的设置强>缓存.当您对 Magento 进行 API 调用时,Magento 使用 PHP 的 SoapServer 对象.SoapServer 对象需要获取自己的 WSDL 文件才能运行,而这个文件的生成和获取可能是一件耗时的事情.

There's lots of reasons a WSDL request might be taking a long time, but the first thing I'd check is the settings for the WSDL cache. When you make an API call into Magento, Magento uses PHP's SoapServer object. The SoapServer object needs to fetch its own WSDL file to operate, and the generation and fetching of this file can be a time consuming thing.

前往

System -> Configuration -> Magento Core API -> General Settings

并查找启用 WSDL 缓存".将此设置为 yes,您将看到一些 API 性能改进.

and look for "Enable WSDL Cache". Set this to yes and you'll see some API performance improvement.

您的 Magento 版本中可能不存在此设置 — 如果是这种情况,您可能对 Mercury API 扩展(由我创建和销售),其中包含针对旧版 Magento 的此功能的 API 改进.如果您没有扩展的预算,Mage_Api_Model_Server_Adapter_Soap 是旧版本的 Magento 禁用此缓存的类.

This setting may not exist in your version of Magento — if that's the case you might be interested in the Mercury API extension, (created and sold by me) with API improvements that include this functionality for older versions of Magento. If you don't have budget for an extension, Mage_Api_Model_Server_Adapter_Soap is the class where older versions of Magento disable this cache.