Netty core source code analysis

Netty thread model The essence of Netty’s high-concurrency and high-performance architecture design Master-slave Reactor thread model NIO multiplexing non-blocking Lock-free serialization design ideas Supports high-performance serialization protocols Zero copy (direct memory usage) ByteBuf memory pool design Flexible TCP parameter configuration capability Concurrency optimization Lock-free serialization design idea In most scenarios, parallel multi-thread processing can improve […]

Netty optimization-parameter optimization

Netty optimization-parameter optimization 1.1 Parameter tuning 1) CONNECT_TIMEOUT_MILLIS 2) SO_BACKLOG 3) ulimit -n 4)TCP_NODELAY 5) SO_SNDBUF & SO_RCVBUF 6) ALLOCATOR 7)RCVBUF_ALLOCATOR 1.1 Parameter tuning Parameter configuration: Server: new ServerBootstrap().option() //Configure the parameters of ServerSocketChannel new ServerBootstrap().childOption() //Configure the parameters of SocketChannel Client: new Bootstrap().option() //Configure the parameters of SocketChannel 1) CONNECT_TIMEOUT_MILLIS Belongs to SocketChannal parameter […]

Netty encoder and decoder

Article directory 1. Decoder principle and practice 1. ByteToMessageDecoder decoder 2. Custom integer decoder 1) Conventional way 2)ReplayingDecoder decoder 3. Packet decoder 3. MessageToMessageDecoder decoder 2. Netty’s built-in Decoder 1. LineBasedFrameDecoder decoder 2. DelimiterBasedFrameDecoder decoder 3. LengthFieldBasedFrameDecoder decoder 3. Encoder Principle and Practice 1. MessageToByteEncoder encoder 2. MessageToMessageEncoder encoder 4. Combination of decoder and encoder […]

Netty practice — Netty handles sticky packet unpacking

TCP packet sticking/unpacking TCP processes data in a streaming manner. Unpacking: A complete data packet may be split into multiple packets by TCP for sending. Sticky packets: TCP may stick multiple small packets into one large data packet. Introduce dependency packages: <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>4.1.29.Final</version> </dependency> Example of sticky package unpacking: Server EchoServer: /** * […]

Netty optimization – extending the serialization algorithm in custom protocols

Netty optimization – extending the serialization algorithm in custom protocols 1. Optimization and source code 1. Optimization 1.1 Extend the serialization algorithm in custom protocols 1. Optimization and source code 1. Optimization 1.1 Extend the serialization algorithm in custom protocols Serialization and deserialization are mainly used in the conversion of message body. When serializing, the […]

Netty+SpringBoot creates a TCP long connection communication solution

Source: blog.csdn.net/u013615 903/article/details/129044283 Welcome to join Xiaoha’s Planet, you will get: Exclusive project practice/Java learning route/One-to-one questions/Learning check-in Currently, I am leading my friends to work on the first project within Planet: Back-end separation blog, hands-on, back-end + front-end full-stack development, explaining the development steps of each function point from 0 to 1. 1v1 Q&A […]

(3) Netty file programming

Netty file programming Directory Netty file programming 1. FileChannel 1. Obtaining method 2. Reading method 3. Writing method 4. Close method 5. Location method 6. Size method 7. Forced writing method 2. Two Channels transmit data 3. Path 4. Files 1. Check if the file exists 2.Create a directory 3.Copy files 4. Move files 5. […]

Netty source code practice–echo

Netty source code practice To learn netty, you can start from the netty-example module of netty source code. netty-example has an example echo, which is very suitable for introductory learning. Here it is slightly modified and used as an example for learning. Introduce dependency packages: <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>4.1.29.Final</version> </dependency> Server After receiving the client’s […]

java design springcloud design and implementation of medical seeking and medicine seeking system based on Netty

Welcome to like, collect, follow and comment. Due to limited space, only part of the core code is shown. Article directory Preface 1. Project introduction 2. Development environment 3. Function introduction Database design overview 4. Core code 5. Effect drawing 6. Article Table of Contents Foreword This paper mainly discusses how to use JAVA language […]