开发者

socket -V- rest performance

I have done some searching but haven't come up with anything on this topic. I was wondering if anyone has ever compared (to some degree) the performance difference between an RPC over a socket and a REST web service. If both do the same thing, which would have a tendency to be the better performer? I've already started building some socket code and would like to know if REST would give better performance before I progress much further. Any input would be really ap开发者_运维百科preciated. Thanks indeed


RMI

Feels like a local API, much like XMLRPC

Can provide some fairly nice remote exception data

Java specific means this causes lock in and limits your options

Has horrible versioning problems between different versions of clients

Skeleton files must be compiled in like CORBA, which is not very flexible

REST:

easy to route around firewalls

useful for uploading files as it can be rather lightweight

very simple if you just want to shove simple things at something and get back an integer (like for uploaders)

easy to proxy security behind Apache and let it take the heat

does not define any standard format for the way the data is being exchanged (could be JSON, YAML 1.0, YAML 2.0, arbitrary XML format, etc)

does not define any convention about having remote faults sent back to the caller, integer codes are frequently used, but method of sending back data is not defined. Ideally this would be standardized.

may require a lot of work on the client side caller of the library to make use of data (custom serialization and so forth)

In short from here

web services do allow a loosely coupled architecture. With RMI, you have to make sure that the objects stay in sync in all applications

RMI works best for smaller applications, that are not internet-related and thus not scalable


Its hard to imagine that REST is faster than a simple socket connection given it also goes over a Socket.

However REST may be performant enough, standard and easier to use. I would test whether REST is fast enough and meets your requirements first (or one of the many other existing solutions) before attempting your own Socket solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜