Friday, June 29, 2007

Web Services vs Distributed Objects

There's always been this one sided debate on which is better in terms of performance - Web Services or RMI (Remote Method Invocation). However, most of the purists have termed the former as being really slow compared to the latter in all scenarios. Even then Web Services have evolved which has been attributed to the fact that they provide a convenient way to work with UI and also automatic firewall protection.
However, saying that Web Services fare poorly when compared to RMI isn't always true, as suggested by the work of Prof. William R. Cook and Janel Barfield in their paper Web Services versus Distributed Objects: A Case Study of Performance and Interface Design. They conclude that Web Services can also outpeform Distributed Objects and RMI if the scenario under question is well suited for document oriented communication.
Cook and Barfield take a simple example of a File Server, where the client requests multiple files from the server. The RMI approach in such a case would require multiple requests being sent to the server and hence the total service delay would depend on the number of such requests being made, and such a delay can be huge when large number of files are being requested from the server.
According to them, Web Services on the other hand with its document oriented approach would fare much better, since the request and response cycle would be run only once and thereby not depending on the number of files being requested. The paper provides skeletal snippets of code, but maintains that the Web Services implementation is difficult to maintain. However, they do provide an alternative object oriented approach to the same. Interesting read, find the paper here..

1 comment:

William Cook said...

Hi... William Cook here. Thanks for responding to my paper. Of course the RMI interface can be rewritten to be faster, but this basically involves making it "document-oriented". The point is that RMI doesn't necessarily encourage this approach, while web services do encourage more batch-oriented designs. Eli Tilevich and I have done some more work in this design space, allowing RMI to be document-oriented without much effort. Explicit Batching for Distributed Objects. Eli Tilevich and William R. Cook :