What caused the worldwide crash of Magento API’s yesterday?

Yesterday was a sour day for Magento API’s worldwide. One of the core components of the API (which is centrally hosted by Microsoft) crashed, and took millions of Magento APIs down with it. Are you using the Magento SOAP API with default settings? Discover how to harden your API and make it immune to crashing Microsoft servers.

Most of our professional Magento customers use New Relic to analyze the health of their shops. Yesterday, they were alerted about a worrisome spike in errors:

newrelic-soap-api-error-rate

Reported error messages are “Invalid XML” and “SOAP-ERROR: Parsing Schema: can’t import schema from ‘http://schemas.xmlsoap.org/soap/encoding/’“. Apparently, the validation schema was unavailable:

This is quite nasty, as the schema is fetched at every SOAP API call. Without it, the API call will take forever and eventually fail. Essentially, your API depends on the availability of a Microsoft server on the other side of the globe.

Eliminate dependencies

A good software engineering principle is to eliminate dependencies. You can do so easily with Magento 1.7+, as there is a configurable setting to locally cache this WSDL schema. Go to System > Config > Magento Core API > General Settings. And enable “WSDL Cache”. This will not only make your API more stable, but also will speed things up quite a bit!

If you don’t run Magento 1.7+ and are unable to upgrade, you should have a look at the Mercury plugin made by Alan Storm, which does WSDL caching and a whole lot of other optimizations.

PS. Not using New Relic yet? Byte has a unique partnership, so you can use New Relic on our platform for a huge discount.