Whaddya mean Web Services are too slow?
Before I start, I would like to make it clear that, yes, you might be one of
the 10-20% of developers implementing sophisticated control systems, writing
code that demands the absolute minimun call latency for any given operation, or
any number of hard-core scenarios where the time taken to serialize a request
for work to be done absolutely must be kept to the
absolute minimum. There indeed many scenarios where serializing a
request for work to be done into an XML payload, wrapping that with a SOAP
envelope, delivering the message via HTTP and then unpacking the envelope and
the payload at the recipient, may, just may be too slow.
But what about the 80% case? I pose the question - are Web Services REALLY
too slow for you?
Consider any given operation within a system that you work upon. For any
method/action on a component/service that is invoked across a process or machine
boundary, what percentage of the time taken to execute the method/action vs. the
amount of time taken to serialize the call and the response? If the time taken
to execute is significantly higher percentage of the overall call, then it
rarely matters what transport you're using. It's generally only when the cost of
transport becomes significant that it becomes a concern.
I would like to point out that anyone who has executed "benchmarks" against
code such as the following ...
[WebMethod]
class HelloWorld
{
[WebMethod]
string SayHello(string name)
{
return "Hello, " + name;
}
}
... should be ashamed of themselves!!! This tests absolutely nothing other
than how fast the call can be serialized. The instant you plug anything into
this method such as, for example, reading or writing to or from a database or
file on disk, talking to anything else across the network, performing any
worthwhile calculation, you'll see an entirely different performance
characteristic - one which is much more realistic if nothing else.
The occasions where you start to see the impact of serializing SOAP/XML are
typically when you're serializing considerable amounts of data. This is
illustrated nicely in the
ASMX/ES/Remoting performance whitepaper I published a few months back.
So, before just dismissing Web Services as being too slow, run some tests to
see if Web Services could in fact handle the volumes of data and result
in call latencies that are within your tolerance ranges - you might be surprised
and start to enjoy the benefits of these liberating technologies.