Magento API – High-Loaded Service: SOAP vs REST

magento-1.7magento-1.8magento-enterpriserestsoap

I have a task to make an api for Magento using it's SOAP or REST implementation.

I've read a lot about both services, also have experience with them. But not in high-loaded projects.

The task of this service will give some extra information to client via SOAP or REST. I've configured both and everything is ok.

BUT, the questions is what would be better if I have 100 clients calling my service per second, 200, 500 and so on?

I know about SOAP overhead, but also if I use REST I need to use also oAuth, so what will fall down first?

Any experience in that?

Best Answer

You will need to define a clear use-case to get a specific answer to your question. Unless we have a detailled use-case here, I'd like to answer with general advice on that:

SOAP vs REST SOAP and REST are two ways of accessing web-services. SOAP uses XML for its requests. REST relies on HTTP requests via URL and is therefore really lightweight compared to SOAP.

(Dis-)Advantages of SOAP:

  • well defined web-service
  • has pre-built standards (SOAPv1, SOAPv2, SOAPv2 WS-I)
  • works well in enterprise environments (due to standards)
  • some tools can be automated by using the WSDL
  • heavyweight compared to REST

(Dis-)Advantages of REST:

  • easier to use
  • more flexible
  • smaller learning curve
  • effictient/lightweight compared to SOAP
  • no defined web-service structure (no WSDL)

Magento SOAP API vs REST API

Be aware that not all features are implemented for the REST API.

I created a small performance test-script which does nothing more than 10x10 login and endSession requests via SOAP API v1. No specific action was performed. 1 request took between 0,9 and 1,4 seconds with my local webserver.

To compare with rest: Once your application is authorized (where you need to authorize your application once via clicking "authorize"), it takes only a few miliseconds to be ready to perform your request after you have obtained a token and a secret: 2.0-3.0 * 10^-5 seconds locally.

Performance testing

For conducting a performance test which could finally answer you question, you need to define the requirements.

The following would be interesting:

  • Do they login once and perform multiple actions or does each of them login for only one action?
  • What kind of requests do they perform? Adding/updating products, placing orders,... ?
  • SOAP API v1, SOAP API v2 or SOAP v2 WSI vs REST?

Resources

This might be also interesting for you:

Related Topic