# Netty

| 必须掌握的知识                        |
| ------------------------------ |
| Netty 的设计思想，设计哲学，它是如何理解这个网络世界的 |
| Netty 的线程模型和网络处理模型             |
| Netty 对 ByteBuffer 的改进和优化      |
| Netty 开发应用的一般流程                |

### IO 模型

### Netty 线程模型和运行架构 (Reactor 模型实现)

![Netty Reactor](https://1617012602-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5PFXCiDtVclypn0iMK%2F-MRFPmFyzimpDkV3FPnJ%2F-MRFPt5vCbaqyqxS0WGK%2Fimage.png?alt=media\&token=5746a980-b8d1-40f7-a503-bf93ecaf0e74)

### Netty 源码分析

### Netty 高并发高性能架构设计精髓

* 主从 Reactor 线程模型
* IO 多路复用非阻塞
* 无锁串行化设计思想
* 支持高性能序列化协议
* 零拷贝技术(使用 Java 提供的直接内存和 OS 的 DMA 能力)

扩展阅读：

1. [搞懂 零拷贝技术](https://www.cnblogs.com/xiaolincoding/p/13719610.html)

* ByteBuf 内存池设计
* 灵活的 TCP 参数配置能力
* 并发优化

Todo:

* Netty Bootstrap, EventLoop, EventLoopGroup etc.

> 1. git clone <https://github.com/shniu/netty.git>&#x20;
> 2. git remote add upstream <https://github.com/netty/netty.git>&#x20;
> 3. git remote -v git fetch upstream git checkout -b 4.1.55.Final&#x20;
> 4. git pull upstream netty-4.1.55.Final
> 5. &#x20;<https://git-scm.com/book>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shniu.gitbook.io/cs/framework/netty.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
