Whether you understand SOA or not, this is a buzzword that is here to stay. One of the side effects of this is that every architect and developer worth his/her salt is recommending and building web services (which is synonymous with SOA even if it is strictly not so)
So one of the main decisions you need to take as a designer/architect is on the different protocols you can choose from for implementing web services. There is obviously SOAP and the huge set of supporting standards to choose from (all the WS-** standards). Then there is the new kid (relatively..) on the block REST..
So one of the criteria to look at is the performance impact of these standards. Note, this is one of the criteria and there may be multiple others to consider based on your particular needs.
When I was searching the internet for details, I found few actual measures on the performance impact of these protocols (it was a near universal claim that REST was faster than SOAP, but rarely any data to back this up). Especially there was almost no data on the impact of these different protocols when implemented using WCF and .NET.
So I setup a test project to check out the performance impact of these. The idea was to measure the difference in performance of these protocols, removing other factors as far as possible. So I just ran everything on my machine, no network impact, in a single program. Obviously this is not a fully controlled atmosphere and do take the benchmarks with a bit of salt. But this should give you enough data on the relative overheads of each of these protocols.
All this data is based on using WCF with the services hosted in local IIS. The response time I measure is for the entire call to complete from the client (caller) code. So includes going thru the service proxy and for the data to be marshaled back.
I tested the impact when the data transported is small and large. A single int return value is small data and an string array of 100 is the large data.
The initial benchmark data is as follow:
| | | Client Response Time (ms) |
| Less Data | SOAP/HTTP - UnSecure | 0.37 |
| SOAP/HTTP - Secure | 1.62 |
| SOAP/HTTPS - UnSecure | 0.61 |
| REST JSON | 0.31 |
| REST XML | 0.38 |
| SOAP - UnSecure - ESB | 2.27 |
| SOAP/TCP UnSecure | 0.06 |
| SOAP/TCP Secure | 1.00 |
| More Data | SOAP/HTTP - UnSecure | 0.54 |
| SOAP/HTTP - Secure | 3.20 |
| SOAP/HTTPS - UnSecure | 1.01 |
| REST JSON | 0.48 |
| REST XML | 0.54 |
| SOAP - UnSecure - ESB | 3.33 |
| SOAP/TCP | 0.20 |
| | SOAP/TCP - Secure | 2.41 |
No brainer here, the TCP SOAP call are the fastest and literally leaves everything else in the dust. No comparison here, if you can use TCP, go for it every time, no confusion on SOAP vs. REST.
When I say Secure/UnSecure above, I am taking about using WS-Security, not HTTPS. I also measure HTTPS impact separately (roughly doubles response time for small data, but is less of an overhead for larger payloads).
Also you see the impact of XML processing in the REST times. REST JSON is faster than REST XML and the overhead here is purely the size of the data passed (more on this later) and the XML processing time.
Also you see the impact of adding more processing by the impact of addition of WS-Security. This is the default WCF binding and if you do not want this you need to choose the wsbasicHTTPbinding.
The other parameter I looked at, though very unscientifically is the size of data that is passed. This becomes even more important when the network is involved.
| Data Serialization(Less Data) | Data Size (Bytes) |
| REST JSON | 45 |
| REST XML | 215 |
| SOAP – UnSecure | 384 |
| SOAP – Secure | 5370 |
So you can see the amount of data overhead due to WS-Security. When very little data is interchanged the overhead can be almost 100 times.
(Also I measured the actual service execution time and that is quite constant for all these. So this is a measure of the performance of the different protocols/standards involved only.)