Build Your Own Netty — Foreword

kezhenxu94
2 min readApr 2, 2019

--

Richard Feynman

What is Netty

If you are a Java developer, you must have heard about Netty more or less, and it’s likely that you have used it, directly or indirectly. If not, there is a brief introduction from the Netty Project.

Netty project — an event-driven asynchronous network application framework. http://netty.io/

Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

Why I Write This Series of Articles

I’ve been interested in Netty for a long time, and I have read many blog posts that address Netty’s performance, architecture, and package structures, which makes me more curious about how Netty do that, and want to dive into the source code of Netty.

Evolution of Netty

Image above is taken from the post Netty: Probably the Best Package Structure in the World.

Also, there are already many excellent articles on Netty source code analysis,
but this series of articles will provide another point of view to inspect how Netty is structured, how Netty works, and how it is so performant.

How this Series of Articles are Organized

This series of articles respect a bottom-top approach to analyze the source code of Netty.

In this series of articles, we will firstly start with a simple Echo server that is written in Java Old I/O library(OIO for short), and take a look at what’s the disadvantages of OIO.

After that, we’ll try to solve the problems using Java New(or Non-blocking) I/O library(NIO for short) to rewrite the Echo server, and make ourselves acquainted with Java NIO API, which is fundamental in the source code of Netty.

To start the journey to Netty’s source code, we will also need some basic knowledge about Reactor Pattern and Event Driven, so the next part of this series of articles will introduce both of them and apply them to our Echo server.

Now that we have completed an Echo server by applying the core concepts that Netty uses, we can start the journey to Netty’s source code. We’ll take a detailed look at the core components of Netty, say EventLoop, Channel, Handler, Pipeline etc. and how they work together.

After that we will dive deeper into the source code of Netty to find out why it is blazingly fast and how it works, (hopefully) including every aspect of optimization in Netty.

So, let’s get started and hope you enjoy it.

--

--

kezhenxu94

Apache SkyWalking Core Maintainer and PMC member; Apache Incubator PMC member; Open-source enthusiast. GitHub@kezhenxu94