Releases: panjf2000/gnet
Gnet v2.6.0, Ghost in the Shell
Important
As of this release, the minimum required Go version to run gnet
is 1.20!
🚀 Features
- feat: support SO_BINDTODEVICE on Linux (#650)
- feat: support configurable I/O chunk to drain at a time in edge-triggered mode (#646)
🛩 Enhancements
- chore: use errors.Is and errors.Join for customized errors (#640)
- opt: close file descriptor after OnClose() for UDP along with code improvement (#624)
- opt: close file descriptor after OnClose() (#622)
- opt: bring down the
maxBytesTransferET
and defer write in ET mode (#606) - opt: clamp the event-loops in ET mode to avaoid starving (#599)
- opt: reduce duplicate code for I/O reactors (#590)
🐛 Bugfixes
- bug: fix Conn.Next not safe (#648) (#649)
- opt: close file descriptor after OnClose() for UDP along with code improvement (#624)
- opt: close file descriptor after OnClose() (#622)
- bug: fix the wrong default behavior of TCPNoDelay on client side (#619)
- bug: fix Conn.Next and Conn.Peek panic On Unix (#616)
- opt: fix compilation errors on *BSD (#593)
📚 Documentation
- opt: bump up minimum required Go version to 1.20 (#638)
- bug: fix the wrong default behavior of TCPNoDelay on client side (#619)
🗃 Misc
- test: add test for SO_BINDTODEVICE with TCP (#652)
- chore: use errors.Is and errors.Join for customized errors (#640)
- test: increase the test code coverage a little bit (#618)
- chore: upgrade modules and update .gitignore (#613)
Thanks to all these contributors: @panjf2000, @serious-snow and @zhongweikang for making this release possible.
What's Changed
- opt: reduce duplicate code for I/O reactors by @panjf2000 in #590
- opt: fix compilation errors on *BSD by @panjf2000 in #593
- patch: v2.5.1 by @panjf2000 in #594
- opt: clamp the event-loops in ET mode to avaoid starving by @panjf2000 in #599
- patch: v2.5.2 by @panjf2000 in #600
- opt: bring down the
maxBytesTransferET
and defer write in ET mode by @panjf2000 in #606 - patch: v2.5.3 by @panjf2000 in #607
- chore: upgrade modules and update .gitignore by @panjf2000 in #613
- bug: fix Conn.Next and Conn.Peek panic On Unix by @serious-snow in #616
- patch: v2.5.4 by @panjf2000 in #617
- test: increase the test code coverage a little bit by @panjf2000 in #618
- bug: fix the wrong default behavior of TCPNoDelay on client side by @panjf2000 in #619
- patch: v2.5.5 by @panjf2000 in #620
- opt: close file descriptor after OnClose() by @panjf2000 in #622
- patch: v2.5.6 by @panjf2000 in #623
- opt: close file descriptor after OnClose() for UDP along with code improvement by @panjf2000 in #624
- patch: v2.5.7 by @panjf2000 in #625
- opt: bump up minimum required Go version to 1.20 by @panjf2000 in #638
- patch: v2.5.8 by @panjf2000 in #639
- chore: use errors.Is and errors.Join for customized errors by @panjf2000 in #640
- patch: v2.5.9 by @panjf2000 in #641
- feat: support configurable I/O chunk to drain at a time in edge-triggered mode by @panjf2000 in #646
- bug: fix Conn.Next not safe (#648) by @zhongweikang in #649
- feat: support SO_BINDTODEVICE on Linux by @panjf2000 in #650
- test: add test for SO_BINDTODEVICE with TCP by @panjf2000 in #652
- minor: v2.6.0 by @panjf2000 in #651
New Contributors
- @serious-snow made their first contribution in #616
Full Changelog: v2.5.0...v2.6.0
Gnet v2.5.0, Cowboy Bebop
Important
Edge-triggered mode is officially supported in gnet
!
Visit also Announcing gnet v2.5.0
🚀 Features
🛩 Enhancements
- opt: reduce duplicate code of I/O processing (#587)
- opt: refine the code of I/O handlers (#586)
- opt: enable ET mode on listener event-loop by default (#585)
- opt: disable SO_REUSEPORT on Unix domain sockets (#584)
- opt: don't disable SO_REUSEPORT on DragonFlyBSD (#583)
- opt: only enable SO_REUSEPORT on Linux and FreeBSD (#580)
🐛 Bugfixes
- bug: fix the EEXIST of epoll_ctl in eventloop.open (#572)
- bug: return 0 instead of -1 when error occurred on a write (#569)
Thanks to all these contributors: @daynobug and @panjf2000 for making this release possible.
What's Changed
- bug: return 0 instead of -1 when error occurred on a write by @daynobug in #569
- bug: fix the EEXIST of epoll_ctl in eventloop.open by @panjf2000 in #572
- patch: v2.4.2 by @panjf2000 in #574
- feat: support edge-triggered I/O by @panjf2000 in #576
- feat: support multiple network addresses binding by @panjf2000 in #578
- opt: only enable SO_REUSEPORT on Linux and FreeBSD by @panjf2000 in #580
- opt: don't disable SO_REUSEPORT on DragonFlyBSD by @panjf2000 in #583
- opt: disable SO_REUSEPORT on Unix domain sockets by @panjf2000 in #584
- opt: enable ET mode on listener event-loop by default by @panjf2000 in #585
- opt: refine the code of I/O handlers by @panjf2000 in #586
- opt: reduce duplicate code of I/O processing by @panjf2000 in #587
- minor: v2.5.0 by @panjf2000 in #588
New Contributors
Full Changelog: v2.4.0...v2.5.0
Gnet v2.4.0, Spirited Away
🚀 Features
- opt: mitigate the latency issue by prioritizing asynchronous writes (#563)
- feat: enable OnOpen for connected UDP socket (#554)
- feat: add DialContext and EnrollContext for Client (#543)
🛩 Enhancements
- opt: mitigate the latency issue by prioritizing asynchronous writes (#563)
- feat: enable OnOpen for connected UDP socket (#554)
- opt: use accept4 where available (#535)
- bug: read the remaining data after the peer wrote and closed on BSD (#531)
- opt: make TCP Keep-Alives settings practicable (#522)
- opt: eliminate error logs when the service exits normally (#500)
🐛 Bugfixes
- bug: fix the memory leaks of localAddr and remoteAddr in conn (#547) a3a2b7a
- bug: read the remaining data after the peer wrote and closed on BSD (#531)
- bug: fix the inconsistent behaviors on Windows (#510)
- bug: make logging package concurrent-safe (#487)
📚 Documentation
- doc: update to the latest Round 22 of TechEmpower Benchmark 6d01da7
- bug: fix the inconsistent behaviors on Windows (#510)
- chore: add a TODO about removing the callback in Conn.AsyncWrite with UDP (#494)
🗃 Misc
- ci: add a bot that translates non-English issues 6e3e0c3 f7cfb5b
- chore: switch from Gitter to Discord 5d1cf9e
- mod: bump up a few modules 1bf7af4
- dep: bump up a few dependencies and enable more auto-labelers in CI (#504)
- chore: consolidate the import declarations of the internal error package (#501)
- chore: do some chores on tests and comments (#499)
- chore: add a TODO about removing the callback in Conn.AsyncWrite with UDP (#494)
- chore: bump up modules (#493)
Full Changelog: v2.3.0...v2.4.0
Thanks to all these contributors: @leslie-fei and @panjf2000 for making this release possible.
What's Changed
- bug: make logging package concurrent-safe by @panjf2000 in #487
- Release v2.3.1 by @panjf2000 in #488
- chore: bump up modules by @panjf2000 in #493
- chore: add a TODO about removing the callback in Conn.AsyncWrite with UDP by @panjf2000 in #494
- chore: do some chores on tests and comments by @panjf2000 in #499
- opt: eliminate error logs when the service exits normally by @panjf2000 in #500
- chore: consolidate the import declaration of the internal error package by @panjf2000 in #501
- release: v2.3.2 by @panjf2000 in #502
- dep: bump up a few dependencies and enable more auto-labelers in CI by @panjf2000 in #504
- patch: v2.3.3 by @panjf2000 in #505
- bug: fix the inconsistent behaviors on Windows by @panjf2000 in #510
- opt: make TCP Keep-Alives settings practicable by @panjf2000 in #522
- patch: v2.3.4 by @panjf2000 in #523
- bug: read the remaining data after the peer wrote and closed on BSD by @panjf2000 in #531
- opt: use accept4 where available by @panjf2000 in #535
- patch: v2.3.5 by @panjf2000 in #536
- bug: fix the memory leaks of localAddr and localAddr in conn by @panjf2000 in #547
- patch: v2.3.6 by @panjf2000 in #550
- feat: add DialContext and EnrollContext for Client by @leslie-fei in #543
- feat: enable OnOpen for connected UDP socket by @panjf2000 in #554
- opt: mitigate the latency issue by prioritizing asynchronous writes by @panjf2000 in #563
- minor: v2.4.0 by @panjf2000 in #566
New Contributors
- @leslie-fei made their first contribution in #543
Full Changelog: v2.3.0...v2.4.0
Gnet v2.3.0, Fullmetal Alchemist
Tip
GC latency caused by a mass of connections is about to be significantly reduced in this release.
🚀 Features
- feat: implement gnet on Windows (#461)
🛩 Enhancements
- build: add NetBSD and OpenBSD supports 9790927
- opt: make use of the inheritance of file status flags on BSD-like OS d98706e
- opt: rearrange the matrix and map of connections e308399
- internal/math: fix a corner case for IsPowerOfTwo (#476)
- opt: improve comments on Conn and test cases (#471)
- opt: mitigate big map issue of connections when garbage collecting (#460)
- opt: use the std math/bits routine to count the bit length (#437)
- opt: refine the SockaddrToTCPOrUnixAddr and SockaddrToUDPAddr abcc031
- opt: prepend [gnet] prefix to every log entry 650f731
- opt: set up the PanicHandler and Logger for pkg/pool/goroutine 222a395
🐛 Bugfixes
- bug: fix the data race among asynchronous methods daffb4e
- bug: fix the data race in test on Windows (#472)
- bug: replace the global logger with custom logger for client on Windows dd46b08
- bug: invoke the callback whether the connection is open or not (#466)
- bug: clean up the inner buffer after read event (#445)
- bug: fix the nil panic in conn.Flush() and increase the code coverage 0f41b37
- bug: fix the memory leak of linked-list-buffer 4b6dfdc
- bug: fix the compile error on FreeBSD with 32-bit 72b6e72
- bug & feat: replace the global default logger with custom logger 3c66bce
📚 Documentation
- chore: update the info of techempower.com b341103
- doc: update the minimum required version of Go a9c2638
- doc: update READMEs about supported platforms 88ed242
🧳 Misc
- chore: delete the unused code in pkg/buffer/ring bdbb661
- chore: code cleanup 9ff529b
- opt: rename eventloop.closeConn to eventloop.close 7c9a61a
- chore: add test for Engine.CountConnections b493107
- chore: print a debugging log about logging level when client starts bdda3bf
- chore: update copyright info ebc191e
- chore: bump ants to v2.7.3 edb9318
- chore: fix the lint issues edffef8
- chore: add more test cases for custom protocol testing deea03f
❇️ Notices
The two major updates in this release are #460 and #461.
We introduced a new data structure matrix
in #460 to displace the default map
for managing connections internally, with the help of this new data structure, we can eliminate the pointers in map
and store connections in the form of a matrix (an array of slices), which will significantly reduce GC (Garbage Collection) latency:
goos: darwin
goarch: arm64
pkg: github.com/panjf2000/gnet/v2
│ old │ new │
│ sec/op │ sec/op vs base │
GC4El100k/Run-4-eventloop-100000-10 30.74m ± 3% 19.68m ± 10% -35.98% (p=0.000 n=10)
GC4El200k/Run-4-eventloop-200000-10 63.64m ± 3% 38.16m ± 11% -40.04% (p=0.000 n=10)
GC4El500k/Run-4-eventloop-500000-10 177.28m ± 8% 95.21m ± 4% -46.29% (p=0.000 n=10)
geomean 70.26m 41.51m -40.92%
│ old │ new │
│ B/op │ B/op vs base │
GC4El100k/Run-4-eventloop-100000-10 27.50 ± 35% 25.50 ± 33% ~ (p=0.423 n=10)
GC4El200k/Run-4-eventloop-200000-10 27.50 ± 53% 20.50 ± 66% ~ (p=0.642 n=10)
GC4El500k/Run-4-eventloop-500000-10 16.00 ± ? 18.00 ± ? ~ (p=0.357 n=10)
geomean 22.96 21.11 -8.04%
│ old │ new │
│ allocs/op │ allocs/op vs base │
GC4El100k/Run-4-eventloop-100000-10 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
GC4El200k/Run-4-eventloop-200000-10 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
GC4El500k/Run-4-eventloop-500000-10 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
geomean ² +0.00% ²
¹ all samples are equal
² summaries must be >0 to compute geomean
The more connections there are, the more pronounced the effect.
While we have performed sufficient testing on matrix
, we are still using map
as the default connection storage in this RC version for the sake of caution, but you can enable the new data structure by specifying build tags: -tags=gc_opt. This can be considered as a precautionary measure so that in case matrix
has any unexpected bugs, you can quickly fall back to the default map
. We will consider promoting matrix
to be the default storage for connections in a subsequent official release.
Another significant leap is #461, you can now run gnet
on Windows, it should be noted that the Windows version of gnet
is intended for development purposes and is not recommended for use in production.
Full Changelog: v2.2.0...v2.3.0
Thanks to all these contributors: @0-haha, @GXKe, @gocurr, @jinxing3114 and @panjf2000 for making this release possible.
Gnet v2.3.0 RC1, Ocean Waves
🚀 Features
- feat: implement gnet on Windows (#461)
🛩 Enhancements
- opt: set up the PanicHandler and Logger for pkg/pool/goroutine 222a395
- opt: prepend [gnet] prefix to every log entry 650f731
- opt: mitigate big map issue of connections when garbage collecting (#460)
- opt: use the std math/bits routine to count the bit length (#437)
- opt: refine the SockaddrToTCPOrUnixAddr and SockaddrToUDPAddr abcc031
🐛 Bugfixes
- bug & feat: replace the global default logger with custom logger 3c66bce
- bug: invoke the callback whether the connection is open or not (#466)
- bug: clean up the inner buffer after read event (#445)
- bug: fix the nil panic in conn.Flush() and increase the code coverage 0f41b37
- bug: fix the memory leak of linked-list-buffer 4b6dfdc
- bug: fix the compile error on freeBSD with 32-bit 72b6e72
📚 Documentation
- doc: update the minimum required version of Go a9c2638
- doc: update READMEs about supported platforms 88ed242
🧳 Misc
- chore: add test for Engine.CountConnections b493107
- chore: print a debugging log about logging level when client starts bdda3bf
- chore: update copyright info ebc191e
- chore: bump ants to v2.7.3 edb9318
- chore: fix the lint issues edffef8
- chore: add more test cases for custom protocol testing deea03f
❇️ Notices
The two major updates in this release candidate are #460 and #461.
We introduced a new data structure matrix
in #460 to displace the default map
for managing connections internally, with the help of this new data structure, we can eliminate the pointers in map
and store connections in the form of a matrix (an array of slices), which will significantly reduce GC (Garbage Collection) latency:
goos: darwin
goarch: arm64
pkg: github.com/panjf2000/gnet/v2
│ old │ new │
│ sec/op │ sec/op vs base │
GC4El100k/Run-4-eventloop-100000-10 30.74m ± 3% 19.68m ± 10% -35.98% (p=0.000 n=10)
GC4El200k/Run-4-eventloop-200000-10 63.64m ± 3% 38.16m ± 11% -40.04% (p=0.000 n=10)
GC4El500k/Run-4-eventloop-500000-10 177.28m ± 8% 95.21m ± 4% -46.29% (p=0.000 n=10)
geomean 70.26m 41.51m -40.92%
│ old │ new │
│ B/op │ B/op vs base │
GC4El100k/Run-4-eventloop-100000-10 27.50 ± 35% 25.50 ± 33% ~ (p=0.423 n=10)
GC4El200k/Run-4-eventloop-200000-10 27.50 ± 53% 20.50 ± 66% ~ (p=0.642 n=10)
GC4El500k/Run-4-eventloop-500000-10 16.00 ± ? 18.00 ± ? ~ (p=0.357 n=10)
geomean 22.96 21.11 -8.04%
│ old │ new │
│ allocs/op │ allocs/op vs base │
GC4El100k/Run-4-eventloop-100000-10 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
GC4El200k/Run-4-eventloop-200000-10 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
GC4El500k/Run-4-eventloop-500000-10 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
geomean ² +0.00% ²
¹ all samples are equal
² summaries must be >0 to compute geomean
The more connections there are, the more pronounced the effect.
While we have performed sufficient testing on matrix
, we are still using map
as the default connection storage in this RC version for the sake of caution, but you can enable the new data structure by specifying build tags: -tags=gc_opt. This can be considered as a precautionary measure so that in case matrix
has any unexpected bugs, you can quickly fall back to the default map
. We will consider promoting matrix
to be the default storage for connections in a subsequent official release.
Another significant leap is #461, you can now run gnet
on Windows, it should be noted that the Windows version of gnet
is intended for development purposes and is not recommended for use in production.
Full Changelog: v2.2.0...v2.3.0-rc.1
Thanks to all these contributors: @panjf2000, @0-haha, @GXKe, and @jinxing3114 for making this release possible.
Gnet v2.2.0, 5 Centimeters per Second
Caution
This release includes breaking changes.
🧨 Breaking changes
- opt: redefine AsyncCallback, pass in the error message 691e077
🚀 Features
- opt: implement Close() for gnet.Conn to make it compatible with net.Conn (#348)
- feat: implement a new API to convert and add net.Conn into gnet.Client c296922
- allow creation of multiple engines on the same protocol and port (#419)
- feat: add multicast UDP listener support (#412)
🛩 Enhancements
- opt: reduce the memory allocation when a connection is idle 27667f3
🐛 Bugfixes
- bug: set the correct number of bytes written by conn.WriteTo() (#344)
- bug: fix the issue of discarding bytes in buffer mistakenly in Conn.Read() 0282025
- bug: bind socket only when it's in passive mode (#373)
- bug: fix the compile error on linux/mips f2e2fa3
- bug: return io.EOF in Read(), comply with io.Reader and io.Writer 3c3c519
- bug: fix the issue failing to listen on 0.0.0.0 on linux/arm64 c9eeca1
- opt: avoid the long hanging when the peer crashes c138ac5
- opt: put the bytes of net.Addr.Zone back to pool when connection is closed 50406b3
🗃 Misc
- opt: refine the logic of eventfd in poller 38aa2e0
- opt: fieldalignment, optimization from 144 to 104 byte f70489f
- opt: improve the internal packages of math and bytes f172799
Full Changelog: v2.0.0...v2.2.0
Thanks to all these contributors: @0-haha, @JemmyH, @ccssrryy, @jdamick, @leki75, @panjf2000, @zhongweikang and zhongweikang for making this release possible.
Gnet v2.0.0, Akira
Note
This is a major release that renovates the gnet
v1, new programming paradigm is therefore introduced along with breaking changes to the backward compatibility!
Today, I'm thrilled to announce the release of gnet v2.0.0, in which we've made plenty of significant improvements and optimizations: added and removed some APIs, redesigned and reimplemented the buffer, optimized the memory pool, etc.
Please visit the blog post of announcing gnet v2.0.0 for more details.
Gnet v1.6.0, Your Lie in April
Tip
Gnet client is now available for production!
Features
- Add a new event handler: AfterWrite() #242
- Implement the gnet client 2295e8c a5ac95a 4db46da 802fa35 7159b95
- Implement writev and readv on BSD-like OS's 60ba6d3
- Implement a mixed buffer of ring-buffer and list-buffer edbdf4b
- Invoke OnClosed() when a UDP socket is closed 7be4b2a
- Implement the gnet.Conn.AsyncWritev() 9a2032f #245
Enhancements
- Prevent the event-list from expanding or shrinking endlessly b220dfd
- Reduce the potential system calls for waking pollers up 9ce41f3
- Eliminate the code for preventing false-sharing 0bfade3
- Support so_reuseaddr (#280)
- Make several improvements for logger 58d2031
- Optimize the buffer management and network I/O 6aba6d7
- Improve the project layout 2e172bd
- Improve the logic of reading data from socket into ring-buffer a7f07b3
- Get as much data read from socket per loop as possible 148ee16
- Improve the network read with ring-buffer and readv 0dcf599
- Avoid memory allocations when calling readv 15611b4
- Refactor the logic of handling UDP sockets d72d3de
- Make the mixed-buffer more flexible 4ac906c
- Improve the management logic of the mixed-buffer b8d571d
Bugfixes
- Resolve the data race of stdConn on Windows (#235)
- Fix the data corruption in some default codecs a56d2f3
- Fix the issue of panic: runtime error: slice bounds out of range 30311e9
Docs
- Update the benchmark data 21f55a6 24e4ce0 1b4ae56 81d9842
- Add the echo benchmarks on macOS f429e7a
- Change the license from MIT to Apache 2.0 a900c8f
Misc
Gnet v1.5.0, Princess Mononoke
Features
- Move the logging module out of the internal package and refactor to make it serviceable for users d566061 b6b1cfb 8837a92
Enhancements
- Support writev and readv in eventloop f299a8e
- Reduce GC pause frequency for Conn.AsyncWrite (#218) 477bb4f
- Improve logging module 8837a92 b6b1cfb
- Refactor the inside AsyncTaskQueue to make it more generic 2d1a463
- Reduce GC pause frequency for accepting connections 2d1a463
Docs
Misc
Gnet v1.4.0, Lupin the Third
Features
- Support TCP_NODELAY socket option 525df8e
- Implement the lock-free queue for dispatching tasks faster (#181)
Enhancements
- Shrink the ring-buffer for saving memory 14fd04a
- Improve event poll fc042cc
- Improve the buffered channels 83b96ed
- Shrink the poll event list when it need to 1587638
- Improve the I/O in event-loop c554f4e
- Prioritize writable events 0f08c8f
- Make it more robust when running async jobs 6509b85
- Improve the poller waking logic 4d8accb
Bugfixes
- Re-enqueue the subsequent jobs when a error occurs 1af3f6c
- Close and release a socket when error occurs 9d86c92
- Check outbound buffer in case the socket has been released 035f614
- Avoid starving sockets e315252
Docs
- Enrich the doc about using UDP packets 0047c15
- Add more user cases of gnet 076b16c
- Update benchmark results 028bab2
- Update the description about ring-buffer 38b086a