First, the summary
This paper compares the transmission performance of 5 kinds of communication protocols such as Rmi,hessian,burlap,httpinvoker,web service in different data structures and different data volumes.
RMIIs the Java language itself provides a remote communication protocol, stable and efficient, is the basis of EJB. However, it can only be used for communication between Java programs.
HessianAndBurlapis the open source protocol provided by Caucho, based on HTTP transmission, the service side does not open firewall port. The specification of the Protocol is exposed and can be used in any language.
Httpinvokeris the remote communication protocol provided by Springframework, which can only be used for communication between Java programs, and the server and client must use Springframework.
Web Serviceis the preferred protocol for connecting heterogeneous or heterogeneous languages, it communicates in soap form, can be used in any language, and many of the development tools currently support it well.
The test results show that the communication efficiency of several protocols is:
RMI > Httpinvoker >= Hessian >> Burlap >> Web Service
RMI is the preferred remote calling protocol for Java, which is highly efficient and stable, especially in the case of large data volumes, with other communication protocols.
Httpinvoker uses the Java serialization technology to transfer objects, which are consistent with RMI in nature. In terms of efficiency, the two are similar, the transmission time of Httpinvoker and RMI is basically flat.
Hessian is faster and more efficient than RMI when transmitting a small number of objects, but it is about 20% slower than RMI to transmit objects with complex data structures or large numbers of data objects.
Burlap is only a fair speed when transmitting 1 of data, typically 3 times times more than RMI.
The inefficiencies of Web service are well known, and on average, Web service traffic is 10 times times more than RMI.
Second, the result analysis
1. Call Directly
All of the direct calls are close to 0, which means that the program processing takes almost no time, and the entire time recorded is spent on remote calls.
2. RMI Invocation
As envisaged, RMI is certainly the quickest, and in almost all cases it is the least. Especially in the case of complex data structure and large amount of data, the gap with other protocols is especially obvious.
In order to give full play to RMI performance, we have also done a test class that does not use spring, uses the original RMI form (inheriting the UnicastRemoteObject object) to serve and remotely invoke, and compares the efficiency of the RMI packaged by spring with the Pojo. The results show that the two are basically flat, and spring offers a slightly faster service.
Initially, this is because spring's proxy and caching mechanisms are powerful, saving time for object re-acquisition.
3. Hessian call
Caucho Company's resin server is known as the fastest server, in the Java domain has a certain degree of visibility. Hessian as part of the resin, its design is also very streamlined and efficient, as evidenced by the actual operating conditions. On average, Hessian is about 20% slower than RMI, but this is only possible when the data is particularly large and complex, and the Hessian is no slower than RMI when it comes to medium or small amounts of data.
The benefit of Hessian is that it is streamlined, can be used across languages, and protocol specifications are exposed, and we can develop the implementation of its protocols for any language. There are currently implemented languages: Java, C + +,. NET, Python, Ruby. There is no Delphi implementation.
In addition, Hessian and Web server is very good, with the help of the mature function of Web server, it has great advantage in dealing with a lot of users ' concurrent access, which can be guaranteed by mature Web server in resource allocation, thread queuing, exception handling and so on. RMI itself does not provide multi-threaded servers. Also, RMI needs to open the firewall port, hessian not.
4. Burlap Call
Burlap and Hessian are Caucho's open source products, but Hessian in binary mode, and burlap in XML format.
The test results show that the efficiency of burlap is acceptable when the data structure is not complex and the volume is moderate, but if the data volume is large, the efficiency will drop sharply. On average, the burlap call is 3 times times the RMI.
I think that there are two reasons for its inefficiency, one is that XML data describes too much, the same data structure, its transmission is much larger, on the other hand, it is well known that the parsing of XML is relatively cost-effective, especially for large data volumes.
5. Httpinvoker Call
Httpinvoker is the Java remote invocation method provided by Springframework, which uses the Java serialization mechanism to handle the transfer of objects. From the test results, its efficiency is still possible, and RMI basically flat.
However, it can only be used for communication between the Java languages, and requires both the client and the server to use the spring framework.
In addition, Httpinvoker has not been tested in practice and has not yet found a project to apply the protocol.
6. Web Service invocation
The test uses Apache's axis component as a Web service implementation, and axis is relatively mature in the Web service field.
In order to test only the time of data transmission and encoding, decoding, both the client and the server use caching, and the object simply instantiates once. However, the test results show that the efficiency of webservice is 10 times times slower than other communication protocols.
If you take into account the transport of multiple references to the same object, the Web service lags behind more. Because Rmi,hessian and other protocols can pass a reference, and how many references webservice have, how many copies of the object entity will be copied.
Too much redundancy in the Web Service transport is one of the reasons for its slowness, and monitoring finds that the same access request, which describes the same data, is 6.5 times times the amount of data returned by the Web service than the Hessian protocol. In addition, the processing of WEB service is very few, the current XML parser efficiency is generally not high, processing XML <-> beans is very resource. From the test results, the remote call is faster than the local call, but also from the side of the main use to encode and decode the XML file. This is more serious than redundant information, which consumes only the network bandwidth, and the resource consumption of each invocation directly affects the load capacity of the server. (MS engineers have said that using a Web service cannot load more than 100 concurrent users.) )
The testing process also found that the Web service coding is not very convenient, for non-basic types need to register the serialization and deserialization class, it is cumbersome to generate stubs more tired than spring + Rmi/hessian processing so smooth and concise. Also, Web service does not support collection types, only arrays, inconvenient.
Transferred from: http://www.cnblogs.com/jifeng/archive/2011/07/20/2111183.html
Java Common Remote Call Protocol comparison