Web Service performance numbers--plenty fast for UI work
While designing Web Services, the question of "interface granularity" often comes up. Conventional wisdom is that Web Service calls are slow, so the interface must be quite coarse to prevent performance problems.
Four years ago, a partner and I built a 2-tier system, a rich client app that talked directly to a database. Towards the end of the development cycle, the users said, "We know we said this was for internal use, but we want to use this application over the Internet."
Bam! That is the kind of major requirements change that can kill projects. After some research, we factored the database calls into an IDataAccess interface that had two implementors: the original database layer and a web service layer that then called the original database layer. On startup, the app figures out which interface to use. As our research and prototyping showed, web services are plenty fast for this scenario.
My current project is also a rich client backed by web services, and we are discussing how quickly the UI needs to respond to the user. Microsoft's performance guidelines suggest one threshold, "A good guideline for interactive response is 500 milliseconds."
Jim Webber estimates that SOAP adds 14 milliseconds round trip. Network latency is usually less than 50 milliseconds round trip in the US, increasing roughly linearly to a rough maximum of 300 milliseconds worldwide.
In my experience, a hit to an optimized database costs roughly 20 ms, plus latency to the database machine of another 5-10 ms. So we are looking at 14 + 50 + 20 + 10 = 94ms. Add in another 50 ms for authentication, authorization and business logic on the server, which leaves the UI well under the 500 ms limit. Anyone have numbers for how much SSL increases latency?
I just did some performance testing that supports these numbers as reasonable. Using a unit test that connects to the web service and uses it to insert a row in a database (everything on the same machine), I was seeing average call times of 15 ms. That leaves room for a lot of latency before the application slows down.
On my project four years ago, we were forced into a finer grained (more talkative) interface by previous decisions. These days, I'm choosing this architecture with my eyes open, and I like the view.