The following is a comparison of several commonly used communication protocols and protocol performance in the Java language
1.RMI
RMI call As expected, RMI is of course the fastest, taking the fewest milliseconds in almost all cases. Especially when the data structure is complex and the amount of data is large, the gap with other protocols is particularly obvious. In order to give full play to the performance of RMI, a test class was created. Instead of using Spring, the original RMI form (inheriting the UnicastRemoteObject object) was used to provide services and make remote calls. The efficiency was compared with Spring's RMI packaged by POJO. The results show that the two are basically the same, and the service provided by Spring is slightly faster. It is initially believed that this is because Spring's proxy and caching mechanisms are relatively powerful, which saves the time of re-acquiring objects.
2.Hessian
Hessian calls caucho company's resin server, which is known as the fastest server and has a certain reputation in the java field. As a component of resin, Hessian's design is also very streamlined and efficient, and the actual operation has proven this. On average, Hessian is about 20% slower than RMI, but this can only be reflected when the amount of data is particularly large and the data structure is complex. When there is medium or small amounts of data, Hessian is not slower than RMI. The advantage of Hessian is that it is streamlined and efficient, can be used across languages, and the protocol specifications are public. We can develop implementations of its protocols for any language. The currently implemented languages include: java, c, .net, python, and ruby. There is no implementation of delphi yet. In addition, Hessian is very well integrated with the WEB server. With the functions of the WEB server, it will have great advantages in handling concurrent access from a large number of users. Resource allocation, thread queuing, exception handling, etc. can all be guaranteed by a mature WEB server. RMI itself does not provide a multi-threaded server. Moreover, RMI needs to open a firewall port, but Hessian does not.
3.Burlap
Burlap and Hessian are both open source products of Caucho Company, but Hessian uses binary format, while Burlap uses xml format. The test results show that Burlap's efficiency is still acceptable when the data structure is not complex and the amount of data is medium, but if the amount of data is large, the efficiency will drop sharply. On average, Burlap's call time per millisecond is 3 times that of RMI. I think there are two reasons for its low efficiency. One is that there are too many XML data description contents, and the transmission volume of the same data structure is much larger. On the other hand, as we all know, parsing xml is relatively resource-intensive, especially This is especially true for large data volumes.
4.HttpInvoker
HttpInvoker is a JAVA remote calling method provided by Spring Framework, which uses java's serialization mechanism to handle the transmission of objects. Judging from the test results, its efficiency is still acceptable, basically the same as RMI. However, it can only be used for communication between JAVA languages, and both the client and the server are required to use the SPRING framework. In addition, HttpInvoker has not been tested in practice, and no projects that apply this protocol have yet been found.
5.web service
This test selected the AXIS component of apache as the implementation of WEB SERVICE. AXIS is relatively mature and established in the field of WEB SERVICE. In order to only test the time of data transmission, encoding, and decoding, both the client and the server use caching, and the object only needs to be instantiated once. However, test results show that the efficiency of web service is still 10 times slower than other communication protocols. If you take into account the transfer of multiple references pointing to the same object, web services lag even further behind. Because RMI, Hessian and other protocols can pass references, and the number of references a web service has depends on how many copies of object entities it has. The excessive redundant information transmitted by the Web service is one of the reasons for its slow speed. Monitoring found that for the same access request, describing the same data, the amount of data returned by the Web service is 6.5 times that of the Hessian protocol. In addition, the processing of WEB SERVICE also takes a lot of time. The current XML parser is generally not efficient, and processing xml beans takes a lot of resources. From the test results, remote calls are faster than local calls, which also shows that the time is mainly spent on 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 load capacity of the server. (MS engineers once said that WEB SERVICE cannot load more than 100 concurrent users.) During the test, it was also found that web service coding is not very convenient. For non-basic types, serialization and deserialization classes need to be registered one by one, which is very difficult. Troublesome, generating stub is more tiring and not as smooth and concise as spring RMI/hessian processing. Moreover, the web service does not support collection types and can only use arrays, which is inconvenient.
The above is the detailed content of What protocols does the java language support?. For more information, please follow other related articles on the PHP Chinese website!

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version
Useful JavaScript development tools

Notepad++7.3.1
Easy-to-use and free code editor

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.