I. SummaryThis article compares the transmission performance of five communication protocols, including RMI, Hessian, burlap, httpinvoker, and Web Service, in different data structures and data volumes. RMI is a remote communication protocol provided by the Java language. It is stable and efficient and is the basis of EJB. But it can only be used in Java Program Communication. Hessian and burlap are open source protocols provided by Caucho. Based on HTTP transmission, the server does not need to open firewall ports. The protocol specification is public and can be used in any language. Httpinvoker is a remote communication protocol provided by springframework. It can only be used for communication between Java programs, and springframework must be used by the server and client. Web Service is the preferred protocol for connecting heterogeneous systems or languages. It uses soap for communication and can be used in any language. Many development tools currently support it well. The test results show that the communication efficiency of several protocols is as follows:
RMI> httpinvoker> = Hessian> burlap> Web ServiceRMI is the preferred Remote Call Protocol for Java, which is very efficient and stable. Especially when the data volume is large, the gap between RMI and other communication protocols is particularly obvious. Httpinvoker uses Java serialization technology to transmit objects, which is essentially the same as RMI. In terms of efficiency, the two are almost the same, and the transmission time of httpinvoker and RMI is basically the same. Hessian is faster and more efficient than RMI when transmitting a small number of objects, but it is about 20% slower than RMI when transmitting objects with complicated data structures or a large number of data objects. Burlap can only transmit one piece of data at a high speed. Generally, it is three times faster than RMI. The low efficiency of Web Services is well known. On average, the communication speed of Web Services is 10 times that of RMI.
Ii. Result Analysis1. Direct callAll direct calls are close to 0, which means that there is almost no time spent in program processing and all the recorded time is spent in remote calls.
2. Rmi callLike the assumption, RMI is, of course, the fastest. In almost all cases, RMI is the least. Especially when the data structure is complex and the data volume is large, the gap with other protocols is particularly obvious. In order to give full play to the performance of RMI, the test class is also used. Without spring, the original RMI form (inheriting unicastremoteobject object) is used to provide services and remote calls, compare the efficiency of RMI encapsulated by pojo with spring. The results show that the two are basically the same, and the services provided by spring are a little faster. Initially, this is because spring's proxy and cache mechanisms are relatively powerful, saving time for re-obtaining objects.
3. Hessian callCaucho's Resin server claims to be the fastest server and has a certain popularity in the Java field. Hessian is an integral part of resin, and its design is also very simple and efficient. The actual running situation also proves this point. On average, Hessian is about 20% slower than RMI, but it can only be reflected when the data volume is very large and the data structure is very complex, hessian is not slower than RMI. The advantage of Hessian is that it is simple and efficient, can be used across languages, and protocol specifications are made public. We can develop the implementation of the Protocol for any language. Currently, the following languages are available: Java, C ++,. net, Python, and Ruby. There is no Delphi implementation yet. In addition, Hessian works very well with Web servers. With the mature functions of web servers, Hessian has a great advantage in processing a large number of concurrent user accesses. In terms of resource allocation and thread queuing, exception Handling can be ensured by mature web servers. RMI does not provide multi-threaded servers. In addition, RMI needs to enable the firewall port, not Hessian.
4. burlap callBoth burlap and Hessian are open-source products of Caucho, except that Hessian uses binary, while burlap uses XML format. The test results show that burlap is still acceptable when the data structure is not complex and the data volume is medium. However, if the data volume is large, the efficiency will decrease sharply. In average calculation, burlap calls are three times the RMI. I think there are two reasons for its low efficiency: one is that XML data has too many descriptions and the same data structure requires a large amount of transmission; the other is well known, parsing XML is more cost-effective, especially when there is a large amount of data.
5. httpinvoker callHttpinvoker is a Java Remote Call method provided by springframework. It uses the Java serialization mechanism to process object transmission. From the test results, the efficiency is still acceptable, which is basically the same as that of RMI. However, it can only be used for communication between the Java language, and requires both the client and the server to use the Spring framework. In addition, httpinvoker has not been tested in practice, and no project has been found to apply the Protocol.
6. Web service call In this test, the Apache axis component is used as the Web service implementation, and axis is relatively mature and established in the Web service field. To test the data transmission, encoding, and decoding time only, the client and the server use the cache, and the object only needs to be instantiated once. However, the test results show that the efficiency of Web Services is 10 times slower than that of other communication protocols. If multiple references point to the same object for transmission, the Web service will lag behind more. Because RMI, Hessian, and other protocols can transmit references, and how many references a Web Service has, how many object entities will be copied. Excessive redundant information transmitted by the Web service is one of the reasons for its slow speed. monitoring shows that the same access request describes the same data, and the data volume returned by the Web Service is 6.5 times that of the Hessian protocol. In addition, when the web service processing is very poor, the current XML parser is not efficient, and the processing of XML <-> bean is very resource-free. From the test results, remote calls are faster than local calls, and it is also explained from the aspect that they are mainly used for encoding and decoding XML files. This is more serious than redundant information. redundant information only occupies network bandwidth, and the resource consumption of each call directly affects the server load capacity. (MS engineers once said that Web Services cannot load more than 100 concurrent users .) During the test, we also found that the Web Service encoding is not very convenient. For non-basic types, We need to register serialization and deserialization classes one by one. This is very troublesome, and it is more tiring to generate stub, it is not as smooth and concise as spring + RMI/Hessian processing. In addition, the web service does not support the collection type and can only use arrays, which is inconvenient.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.