Skip to content

Releases: panjf2000/gnet

Gnet v2.6.0, Ghost in the Shell

09 Nov 05:57
2b0357c
Compare
Choose a tag to compare

ghost-in-the-shell-poster

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

New Contributors

Full Changelog: v2.5.0...v2.6.0

Gnet v2.5.0, Cowboy Bebop

22 Apr 14:42
5c043e6
Compare
Choose a tag to compare

DZyXdOgW0AEWEmc

Important

Edge-triggered mode is officially supported in gnet!

Visit also Announcing gnet v2.5.0

🚀 Features

  • feat: support multiple network addresses binding (#578)
  • feat: support edge-triggered I/O (#576)

🛩 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

New Contributors

Full Changelog: v2.4.0...v2.5.0

Gnet v2.4.0, Spirited Away

04 Apr 13:32
4fee147
Compare
Choose a tag to compare

v2-942e50b89957615da0d963bc23289fe9_r

🚀 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

New Contributors

Full Changelog: v2.3.0...v2.4.0

Gnet v2.3.0, Fullmetal Alchemist

01 Jul 14:14
59a3c61
Compare
Choose a tag to compare

p2635052547

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

19 May 07:15
Compare
Choose a tag to compare
Pre-release

wp8001831-vintage-ocean-waves-anime-wallpapers

🚀 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

03 Dec 13:47
Compare
Choose a tag to compare

wp3209489-makoto-shinkai-background

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

27 Feb 10:44
Compare
Choose a tag to compare

wp14081146-akira-desktop-wallpapers

Note

This is a major release that renovates the gnet v1, new programming paradigm is therefore introduced along with breaking 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

05 Dec 10:26
Compare
Choose a tag to compare
Pre-release

wp5335882-your-lie-in-april-anime-wallpapers

Tip

Gnet client is now available for production!

Features

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

Misc

Gnet v1.5.0, Princess Mononoke

11 Jul 13:39
Compare
Choose a tag to compare

wp14622430-princess-mononoke-desktop-wallpapers

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

  • Add debugging log when error occurs in Accept() (#222)
  • Make some trivial changes to ring-buffer 1bdd3aa

Gnet v1.4.0, Lupin the Third

17 Feb 08:10
Compare
Choose a tag to compare

BjBQ9Bt-lupin-the-third-wallpaper

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

Misc