forked from panjf2000/gnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
2,710 additions
and
36,061 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
last_modified_on: "2020-07-09" | ||
title: "What is Gnet?" | ||
description: "High-level description of the Gnet framework and its features." | ||
--- | ||
|
||
## Introduction | ||
|
||
`gnet` is an event-driven networking framework that is fast and lightweight. It makes direct [epoll](https://en.wikipedia.org/wiki/Epoll) and [kqueue](https://en.wikipedia.org/wiki/Kqueue) syscalls rather than using the standard Go [net](https://golang.org/pkg/net/) package and works in a similar manner as [netty](https://github.com/netty/netty) and [libuv](https://github.com/libuv/libuv), which makes `gnet` achieve a much higher performance than Go [net](https://golang.org/pkg/net/). | ||
|
||
`gnet` is not designed to displace the standard Go [net](https://golang.org/pkg/net/) package, but to create a networking server framework for Go that performs on par with [Redis](http://redis.io) and [Haproxy](http://www.haproxy.org) for networking packets handling. | ||
|
||
`gnet` sells itself as a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go which works on transport layer with TCP/UDP protocols and Unix Domain Socket , so it allows developers to implement their own protocols(HTTP, RPC, WebSocket, Redis, etc.) of application layer upon `gnet` for building diversified network applications, for instance, you get an HTTP Server or Web Framework if you implement HTTP protocol upon `gnet` while you have a Redis Server done with the implementation of Redis protocol upon `gnet` and so on. | ||
|
||
**`gnet` derives from the project: `evio` while having a much higher performance and more features.** | ||
|
||
## Features | ||
|
||
- [x] [High-performance](#-performance) event-loop under networking model of multiple threads/goroutines | ||
- [x] Built-in goroutine pool powered by the library [ants](https://github.com/panjf2000/ants) | ||
- [x] Built-in memory pool with bytes powered by the library [bytebufferpool](https://github.com/valyala/bytebufferpool) | ||
- [x] Lock-free during the entire life cycle | ||
- [x] Concise APIs | ||
- [x] Efficient memory usage: Ring-Buffer | ||
- [x] Supporting multiple protocols/IPC mechanism: `TCP`, `UDP` and `Unix Domain Socket` | ||
- [x] Supporting multiple load-balancing algorithms: `Round-Robin`, `Source Addr Hash` and `Least-Connections` | ||
- [x] Supporting two event-driven mechanisms: `epoll` on **Linux** and `kqueue` on **FreeBSD/DragonFly/Darwin** | ||
- [x] Supporting asynchronous write operation | ||
- [x] Flexible ticker event | ||
- [x] SO_REUSEPORT socket option | ||
- [x] Built-in multiple codecs to encode/decode network frames into/from TCP stream: LineBasedFrameCodec, DelimiterBasedFrameCodec, FixedLengthFrameCodec and LengthFieldBasedFrameCodec, referencing [netty codec](https://netty.io/4.1/api/io/netty/handler/codec/package-summary.html), also supporting customized codecs | ||
- [x] Supporting Windows platform with ~~event-driven mechanism of IOCP~~ Go stdlib: net | ||
- [ ] Implementation of `gnet` Client | ||
|
||
## Documentations | ||
|
||
For more details, please go to <a href="https://pkg.go.dev/github.com/panjf2000/gnet?tab=doc" target="_blank">Documentations for gnet</a>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
website/highlights/2019-11-07-supported-multiple-codecs.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
last_modified_on: "2019-11-07" | ||
$schema: "/.meta/.schemas/highlights.json" | ||
title: "Support multiple codecs" | ||
description: "Support multiple codecs to encode/decode TCP stream" | ||
author_github: "https://github.com/panjf2000" | ||
pr_numbers: [2369df7] | ||
release: "features" | ||
hide_on_release_notes: false | ||
tags: ["type: new feature", "domain: load-balancing"] | ||
--- | ||
|
||
## About this change | ||
|
||
In this change, gnet integrates multiple codecs to encode/decode network frames into/from TCP stream: LineBasedFrameCodec, DelimiterBasedFrameCodec, FixedLengthFrameCodec and LengthFieldBasedFrameCodec, referencing [netty codec](https://netty.io/4.1/api/io/netty/handler/codec/package-summary.html), | ||
in addition to these built-in codecs, gnet also supports customized codecs by functional option `Codec`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
last_modified_on: "2019-11-12" | ||
$schema: "/.meta/.schemas/highlights.json" | ||
title: "Supports Windows platform" | ||
description: "Support Windows platform by Go standard net package" | ||
author_github: "https://github.com/panjf2000" | ||
pr_numbers: [9be6b06] | ||
release: "features" | ||
hide_on_release_notes: false | ||
tags: ["type: new feature", "domain: OS", "platform: windows"] | ||
--- | ||
|
||
## About this change | ||
|
||
Before this change, gnet can only works on Linux and BSD-like platforms, now it also supports Windows platform, | ||
which makes gnet a real cross-platform networking framework. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
last_modified_on: "2020-03-13" | ||
$schema: "/.meta/.schemas/highlights.json" | ||
title: "Released gnet v1.0.0" | ||
description: "Released the official stable version of v1.0.0" | ||
author_github: "https://github.com/panjf2000" | ||
pr_numbers: [7155bed] | ||
release: "1.0.0" | ||
hide_on_release_notes: false | ||
tags: ["type: release", "domain: v1.0.0"] | ||
--- | ||
|
||
# Features | ||
|
||
- [x] [High-performance](https://github.com/panjf2000/gnet/blob/v1.0.0/README.md#-performance) event-loop under networking model of multiple threads/goroutines | ||
- [x] Built-in load balancing algorithm: Round-Robin | ||
- [x] Built-in goroutine pool powered by the library [ants](https://github.com/panjf2000/ants) | ||
- [x] Built-in memory pool with bytes powered by the library [bytebufferpool](https://github.com/valyala/bytebufferpool) | ||
- [x] Concise APIs | ||
- [x] Efficient memory usage: Ring-Buffer | ||
- [x] Supporting multiple protocols/IPC mechanism: TCP, UDP and Unix Domain Socket | ||
- [x] Supporting two event-driven mechanisms: epoll on Linux and kqueue on FreeBSD | ||
- [x] Supporting asynchronous write operation | ||
- [x] Flexible ticker event | ||
- [x] SO_REUSEPORT socket option | ||
- [x] Built-in multiple codecs to encode/decode network frames into/from TCP stream: LineBasedFrameCodec, DelimiterBasedFrameCodec, FixedLengthFrameCodec and LengthFieldBasedFrameCodec, referencing [netty codec](https://netty.io/4.1/api/io/netty/handler/codec/package-summary.html), also supporting customized codecs | ||
- [x] Supporting Windows platform with ~~event-driven mechanism of IOCP~~ Go stdlib: net | ||
- [ ] Additional load-balancing algorithms: Random, Least-Connections, Consistent-hashing and so on | ||
- [ ] TLS support | ||
- [ ] Implementation of `gnet` Client | ||
|
17 changes: 17 additions & 0 deletions
17
...e/highlights/2020-03-31-supported-least-connections-load-balancing-algorithm.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
last_modified_on: "2020-03-31" | ||
$schema: "/.meta/.schemas/highlights.json" | ||
title: "Support new load-balancing algorithm" | ||
description: "Support new load-balancing algorithm of least-connections" | ||
author_github: "https://github.com/panjf2000" | ||
pr_numbers: [fc73013] | ||
release: "features" | ||
hide_on_release_notes: false | ||
tags: ["type: new feature", "domain: load-balancing"] | ||
--- | ||
|
||
## About this change | ||
|
||
In the past, gnet has only one load-balancing algorithm: Round-Robin, now it supports a new one: Least-Connections | ||
and provide the new functional option `LB`, enabling users to switch load-balancing algorithm at their own sweet will. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
last_modified_on: "2020-04-03" | ||
$schema: "/.meta/.schemas/highlights.json" | ||
title: "Released gnet v1.1.0" | ||
description: "Released the official stable version of v1.1.0" | ||
author_github: "https://github.com/panjf2000" | ||
pr_numbers: [095ef52] | ||
release: "1.1.0" | ||
hide_on_release_notes: false | ||
tags: ["type: release", "domain: v1.1.0"] | ||
--- | ||
|
||
## Features | ||
|
||
- Support new load-balancing algorithm of least-connections [#63](https://github.com/panjf2000/gnet/pull/63) | ||
- Support new load-balancing algorithm of source-addr-hash [#64](https://github.com/panjf2000/gnet/pull/64) | ||
- Add a new API to get the number of currently active connections [5ae4849](https://github.com/panjf2000/gnet/commit/5ae4849ac2941394b21254950ec7101081add782) | ||
|
||
## Bugfixes | ||
|
||
- Fix an issue of not recycling byte-buffers [3b6edfd](https://github.com/panjf2000/gnet/commit/3b6edfdd933abab07a823bc0760c3d24b61b0879) | ||
- Fix a bug of reading data from the full ring-buffer [a9caa26](https://github.com/panjf2000/gnet/commit/a9caa26689f9ecb46a98feb3bb5513639c8beb98) | ||
|
||
## Enhancements | ||
|
||
- Improve several methods of ring-buffer [828e845](https://github.com/panjf2000/gnet/commit/828e845558c49918a647a1144eab8d9ca35887de) | ||
- Refine the range indexes when re-slicing [008c0c9](https://github.com/panjf2000/gnet/commit/008c0c9e4c702431db6b3d4372be94ea99ac5a5e) | ||
- Lazily allocate memory for ring-buffers [095ef52](https://github.com/panjf2000/gnet/commit/095ef52c9275b5382b7e557da7bb40c5a3b156ca) | ||
|
||
## Docs | ||
|
||
- Switch go doc to pkg.go.dev [b973741](https://github.com/panjf2000/gnet/commit/b973741b7415e2e42b16e8dcf4adf6553c41ed40) | ||
- Add TechEmpower benchmarks [65d859b](https://github.com/panjf2000/gnet/commit/65d859b02a7766808151db5a809f8776ba708cfd) [9bd48a3](https://github.com/panjf2000/gnet/commit/9bd48a348281542d3cac008b5525a693981ec525) [04b473e](https://github.com/panjf2000/gnet/commit/04b473e20f51afe4b798d54b336fc72a7c5cd7b0) [3743d0f](https://github.com/panjf2000/gnet/commit/3743d0f26ff38fec6872be0d13eac7e7d370d4b9) | ||
- Improve some statements [cc4ccd4](https://github.com/panjf2000/gnet/commit/cc4ccd470b0a4fabf902896df714b7fd07346216) | ||
|
||
## Misc | ||
|
||
- Rename the eventloop_group.go to load_balancing.go [24203f4](https://github.com/panjf2000/gnet/commit/24203f4d936374666ef73c1ff7d96656c4de5fcb) | ||
- Add unit test for ring-buffer ecf3473072d1c02ca69b469d24c5581eae041d2f [94246dc](https://github.com/panjf2000/gnet/commit/94246dc0fa7c0fcd02e0498e2a355f661b1403c8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
last_modified_on: "2020-05-11" | ||
$schema: "/.meta/.schemas/highlights.json" | ||
title: "Released gnet v1.2.0" | ||
description: "Released the official stable version of v1.2.0" | ||
author_github: "https://github.com/panjf2000" | ||
pr_numbers: [84fb001] | ||
release: "1.2.0" | ||
hide_on_release_notes: false | ||
tags: ["type: release", "domain: v1.2.0"] | ||
--- | ||
|
||
## Features | ||
|
||
- Support graceful shutdown with OS signals (Fixes #82) | ||
|
||
## Enhancements | ||
|
||
- Improve the creation processes of netpoller (Fixes #72) [ccc6c25](https://github.com/panjf2000/gnet/commit/ccc6c25923404195e7fba960d6cdfb57d3a7cea4) | ||
- Reuse slice struct when resetting buffer [916c255](https://github.com/panjf2000/gnet/commit/916c255de373b3ff73eaa10cb1f0bacc2c1b6e3f) | ||
- Make a big allocation on ring-buffer at the first time [61963bd](https://github.com/panjf2000/gnet/commit/61963bd439beba73ef29c74b9870442c867e192a) | ||
|
||
## Docs | ||
|
||
- Update `Features` section in READMEs [a0d53f5](https://github.com/panjf2000/gnet/commit/a0d53f5061405901e17df4fa9760633edd9f1d98) | ||
- Add a new article about gnet [d500bf4](https://github.com/panjf2000/gnet/commit/d500bf449f7808df210ff859014387a833c2f9f2) | ||
- Supplement the missing acknowledgment item [b031357](https://github.com/panjf2000/gnet/commit/b031357ed623f630048a9222229e76c05cb7e6ef) | ||
|
||
## Misc | ||
|
||
- Enable ReadN(int) to handle corner cases [2e89e25](https://github.com/panjf2000/gnet/commit/2e89e255fd636371c0671542387e807bcd18a496) | ||
- Leverage reviewdog as automated code review tool [5db42f9](https://github.com/panjf2000/gnet/commit/5db42f9413a7f17b6e6d8383f0e9c7c6dbf3a9d7) | ||
- Use customized logger to log errors instead of std log package [3a69701](https://github.com/panjf2000/gnet/commit/3a697014af6c6a61828147d2def1f7a543e149b6) | ||
- Remove useless field of server [47817a0](https://github.com/panjf2000/gnet/commit/47817a0b7098443d141e8857cbfc4d30f13b3965) | ||
- Unexport some errors [5287bd8](https://github.com/panjf2000/gnet/commit/5287bd8bde31bbcdfc482810479cd6c773afdeeb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
last_modified_on: "2020-07-02" | ||
$schema: "/.meta/.schemas/highlights.json" | ||
title: "New approach to create server sockets" | ||
description: "Leverage system calls instead of `net` package to create sockets" | ||
author_github: "https://github.com/panjf2000" | ||
pr_numbers: [ccc8c64] | ||
release: "features" | ||
hide_on_release_notes: false | ||
tags: ["type: optimization", "domain: socket", "platform: arm64"] | ||
--- | ||
|
||
## About this change | ||
|
||
Benefit from system calls provided by Go standard library, server listener sockets inside gnet have gotten rid of the Go `net` package eventually, | ||
there are no more methods from `net` package involved in the process of creating the listener of server socket, all by raw system calls. |
Oops, something went wrong.