Communication framework

Popular Java NIO based communication frameworks include Mina, Netty, Grizzly, etc. Here’s how they compare. Two. Their origins

1. Mina is from Apache, a giant organization in the open source industry; 2. Netty was born from the commercial open source tycoon Jboss; Grizzly came from Grizzly Sun Company.

Third, their design concept

Mina Mina(Multipurpose Infrastructure for Network Applications) is a relatively new project of Apache organization, which provides a very convenient framework for developing high performance and high availability Network Applications. The current release of Mina version 2.04 supports TCP/UDP application development and serial communication applications based on Java NIO technology, and Mina support is being extended. Currently, applications using Mina include: Apache Directory Project, AsyncWeb, Advanced Message Queuing Protocol (AMQP), RED5 Server (Macromedia Flash Media RTMP), ObjectRADIUS, Openfire, etc.

Netty is an asynchronous, event-driven network application framework and tool used to rapidly develop maintainable, high-performance and scalable protocol servers and clients. In other words, Netty is a NIO client/server framework that enables fast and easy development of network applications, such as protocol servers and clients. It greatly simplifies network programming such as TCP and UDP socket servers.

3. Grizzly Grizzly is an application framework designed to solve the problems that arise when writing tens of thousands of users to access a server. Use JAVA NIO as a base and hide the complexity of its programming. Easy to use high-performance API. Bring a non-blocking socketD to the protocol processing layer. Leverage high-performance caching and buffer management using high-performance thread pools.

From the perspective of design concept, Mina’s design concept is the most elegant. Of course, since Netty’s lead author is the same as Mina’s lead author, the design philosophy of Netty and Mina is basically the same. Grizzly, on the other hand, is a lesser design concept and almost a simple encapsulation of JavaNIO.

Here I recommend an architecture learning exchange group. Exchange learning group number: 575745314 inside will share some senior architects recorded video video: Spring, MyBatis, Netty source analysis, high concurrency, high performance, distributed, microservice architecture principle, JVM performance optimization, distributed architecture, and so on these become architects necessary knowledge system. I can also get free learning resources, which I benefit a lot from now

Why is Netty so popular? Netty is the most popular Java open source framework NIO framework provided by JBOSS. Netty provides asynchronous, event-driven network application framework and tools for rapid development of high performance, high reliability network server and client programs. Compared to JDK native NIO, Netty provides a relatively simple and easy-to-use API that is ideal for network programming. Netty is implemented entirely based on NIO, so Netty is asynchronous. As an asynchronous NIO framework, all I/O operations of Netty are asynchronous and non-blocking. Through the Future-Listener mechanism, users can obtain the RESULTS of I/O operations proactively or through notification mechanism. Netty is NIO’s unquestionably superior framework in terms of robustness, functionality, performance, customizability, and extensibility. It has been validated by hundreds of commercial/commercial projects, such as Avro, RocketMQ, Hadoop’s RPC framework, and Dubbo, the leading distributed communication framework. There’s a reason why it’s so popular.

The advantages of Netty can be summarized as follows: 1. The API is simple to use and the development threshold is low. 2, powerful, preset a variety of codec functions, support a variety of mainstream protocols; 3. With strong customization ability, the communication framework can be flexibly extended through ChannelHandler; 4, high performance, through the comparison with other industry mainstream NIO framework, Netty’s overall performance is the best; 5, mature, stable, Netty has fixed all the JDK NIO bugs found, business developers do not need to worry about NIO bugs; 6. Active community, short version iteration cycle, found bugs can be fixed in time, at the same time, more new functions will be added; 7, experienced large-scale commercial application test, quality has been verified. It has been successfully used in Internet, big data, online games, enterprise applications, telecom software and many other industries, proving that it has been fully able to meet the commercial applications of different industries.

What are the advantages compared with Mina: 1. Both works are by Trustin Lee, Netty is later; 2. Mina tied the kernel to some features too closely, so that users could not get rid of these features when they did not need them, which caused performance degradation. Netty solved this design problem. 3. Netty documentation is clearer. Many Mina features are available in Netty. 4, Netty update cycle is shorter, the release of the new version is faster; 5. Their architectures are not very different. Mina lives on Apache, while Netty lives on JBoss. More complete IOC container support (Spring, Guice, JBOSSMC and OSGi); 6. Netty is easier to use than Mina. In Netty, you can customize upstream events or/and downstream events, and use decoder and encoder to decode and encode the delivered content. 7. There are some differences between Netty and Mina when dealing with UDP. Netty exposes UDP as connectionless. Mina abstracts UDP at a high level and can be treated as “UDP”. Connection-oriented “; And Netty to do this is more difficult. 8. From the perspective of task scheduling granularity, MINA will write the sessions with IO tasks into the queue. When the tasks are executed ina loop, it will poll all sessions and take out all tasks in the session in turn for running. Such coarse-grained scheduling is unfair and results in high latency for some requests.