Netty Source Code Analysis--Length Field Based Frame Decoder

This article mainly introduces the use of Length Field BasedFrameDecoder decoder custom protocol. Usually, the format of the protocol is as follows: Length Field BasedFrameDecoder is an important class for netty to solve the problem of unpacking and sticking. Its main structure is header+body structure. We only need to pass in the correct pa ...

Posted on Sun, 22 Sep 2019 21:05:34 -0700 by googlit

netty Case, netty 4.1 Source Code Analysis: NioEventLoopGroup Source Code Analysis

In this chapter, we analyze the source code of NioEventLoopGroup from an infrastructure-based Netty Server, including EventLoopGroup event loop group, NioEventLoopGroup asynchronous event loop group, Multithread EventLoopGroup multi-threaded event lo ...

Posted on Tue, 17 Sep 2019 05:28:41 -0700 by Megienos

Leader Selector for Multiple Copies of RocketMQ DLedger for Source Code Analysis

This article will follow RocketMQ Multi-copy Preface: A Preliminary Study of raft Protocol Learn RocketMQ's main logic by thinking. First, I will review some thoughts about Leader: Node stateThree kinds of node states need to be introduced: Follower (follower) and Candidate (candidate). In this state, the node will make a voting request and Le ...

Posted on Sun, 15 Sep 2019 07:34:08 -0700 by agent_smith_sp

Netty Source Analysis - How Data Flows in Pipelines

In the previous article, we have learned about the role of pipeline in netty, such as a pipeline that controls the reading and writing of byte streams. In this article, we continue to dig deeper into the pipeline's role in event propagation. Unsafe As the name implies, unsafe means to tell you not to use Unsafe and its derivatives directly in ...

Posted on Tue, 10 Sep 2019 01:45:26 -0700 by karnul

How to design a compact and extensible RPC framework? (with implementation code)

brief introduction If you know something about RPC, you will hear some famous RPC frameworks, such as Dobbo and gRPC. But most people don't really understand the underlying principles of their implementation. There is a better way to learn: if you want to understand the principle of a framework, you can try to write a simple version of the fra ...

Posted on Sun, 08 Sep 2019 06:12:29 -0700 by venom999

[RPC] Implementation of RPC framework based on netty+zookeeper step by step

The last one realizes the current limitation of service, and this one realizes the service fuse. First of all, you should post the GitHub code address, and you can download and run it directly if you want to see the code: https://github.com/whiteBX ...

Posted on Wed, 04 Sep 2019 23:44:14 -0700 by glossary

PullConsumer Message Pull Source Analysis in RocketMQ

RocketMQ provides many API s for pulling messages in PullConsumer, but in general there are two kinds: synchronous and asynchronous message pulling. Synchronized message pull-outThe pullSyncImpl method of DefaultMQPullConsumerImpl is used to pull and cancel messages synchronously: 1 private PullResult pullSyncImpl(MessageQueue mq, Subscrip ...

Posted on Tue, 13 Aug 2019 05:35:01 -0700 by ainoy31

Magic in Java - Unsafe

Unsafe is a class located under the sun.misc package. It mainly provides some methods to perform low-level, unsafe operations, such as direct access to system memory resources, self-management of memory resources, and so on. These methods have played a significant role in improving Java efficiency and enhancing the operation capabilities of Jav ...

Posted on Sat, 10 Aug 2019 23:44:40 -0700 by Simmo

Netty Source Analysis--FastThreadLocal Analysis

The source code for ThreadLocal was discussed in the previous section, so let's look at FastThreadLocal in this section.I think it's simpler than ThreadLocal because it's more efficient due to the lack of cleanup and cleanup of Entry. Like ThreadLocal, we'll start with a structure diagram:        See how this diagram differs from ThreadLocal by ...

Posted on Sun, 04 Aug 2019 10:48:05 -0700 by tllewellyn

Netty memory pool and allocation of hit cache

Memory specifications for memory pools: In the previous source code analysis process, we should have some impressions about the size of memory specifications. In fact, there are four main sizes of memory in Netty memory pool: tiny refers to the size between 0-512Byte, small refers to the size between 512Byte-8KB, normal refers to the size betw ...

Posted on Thu, 01 Aug 2019 21:48:03 -0700 by RogerInHawaii