The performance over head when doing client-server communication I believe has always been under estimated.
I would like to give you just a small example.
I guess a webservice can’t be any simpler than this – it’s the Visual Studio default Hello World service – invoked via a 100 mBit connection – and yes, the response time is above 1 second!!! Let me stress this out once more: If you call a web service you should expect the response time to be at least one second!
Now, perhaps you can fine tune things, but even if you make it twice as fast, your user will still be spending half a second waiting for your server round trip.
This really – in a practical manner – makes it very clear why there is a difference between a service architecture and an object oriented architecture.
If you have, say, 100 objects, and for each object you have to do a server roundtrip, well – your users will be spending lots of time waiting for you. Luckily, in the later .NET versions the response time is not linear, so you users won’t spend 100 seconds if you make 100 almost similar calls. For instance, if I call my HelloWorld service 10 times, the response time is 1.3 seconds. If I call the service 100 times within the same thread it is 2.6 seconds.
However, while .NET is smart enough to cache all the serialization info within the same thread, you will pay the overhead per thread each time you make the service call.
The figure below illustrates this point. The left column is the distinct Thread ids, while the right column is the duration for each call. At the bottom you will see the total time spent.
So – the point being: When performing service oriented operations, you shouldn’t treat your services as object initializers – i.e. you should not for every object call the service and and get one object in return. Do batch, do client side caching – do what you have to, to make it work, but treat the service as a service.
Also, please remember that this was the simplest service possible – it had no connection to any database or other integration points, it performs no calculations – BUT it has to serialize and deserialize a lot of soap and transmit the soap over the wire via http.
- Nested Regular Expressions explained
- Æ, ø og å på hjemmesider
- How to debug HTTP Error 401 UnAuthorized in ASP.NET via IIS
- Server to Client notification using ASP.NET with Comet Approach
- Regex balancing group in depth
- Registry settings in mono on Linux
- Setup Mono, mod_mono, and Apache - An Introduction do Windows developers