Releases: panjf2000/gnet
Gnet v2.5.0
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
🚀 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
🚀 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 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
Thanks to all these contributors: @0-haha, @GXKe, @gocurr, @jinxing3114 and @panjf2000 for making this release possible.
Gnet v2.3.0 RC1
🚀 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
Changelogs
- allow creation of multiple engines on the same protocol and port (#419)
- opt: byte alignment, optimization from 144 to 136 byte (#369)
- fix, unix socket bind should be only used in passive mode (#373)
- Fix gnet.Conn not compatible with net.Conn on method Close (#348)
- fix the bug of the return value of conn.WriteTo (#344)
🧨 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
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
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
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
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
Gnet v1.3.0
Features
- Determine logging mode by environment variable 2a7977f
- Support locking each I/O event-loop goroutine to an OS thread 6fd6413
Enhancements
- Improve the implementation of Least-Connections load-balancing b6a5f56
- Speed up the Least-Connections load-balancing b5fbbda
- Leverage system calls instead of
net
package to create listeners ccc8c64 - Refine the logging module f46da44
- Reorg errors in gnet 1c2f4b0
- Move logging module into internal package 00af504
- Take off the codec from eventloop bc85c34
- Refactor for buffer in Conn 455c5ae
- Refactor the load-balancing algorithm of source addr hash abbf582
- Make channel buffered if necessary 43f93ca
Bugfixes
- Fix a bug that led to negative counter of sync.WaitGroup on Windows 16ed4ab
- Add "windows" build tag under SO_REUSEPORT mode 7862f3e
- Supplement all the formal protocol formats of TCP and UDP 258253c
- Resolve the issue of closing one fd twice b5a5c71
- Fix concurrent loopCloseConn causes panic (#111)
- Eliminate duplicate calls to loopCloseConn a72f5fd
Docs
- Add a customized codec example (#90)
- Add placeholder for user cases and new relevant article 5197f18
- Renew results of techempower benchmark 61eee8f
- Add the list of donors 42e04dd
- Add xs:code 33a3e57
- Build an official website for gnet 49363cd
- Move the majority of content to website and simplify READMEs 903ff84