Release Name: 2.8.0
Notes:
kgio 2.8.0 - TCP Fast Open, writev/trywritev
kgio provides non-blocking I/O methods for Ruby without raising
exceptions on EAGAIN and EINPROGRESS. It is intended for use with the
Unicorn and Rainbows! Rack servers, but may be used by other
applications (that run on Unix-like platforms).
* http://bogomips.org/kgio/
* kgio@librelist.org
* git://bogomips.org/kgio.git
* http://bogomips.org/kgio/NEWS.atom.xml
Changes:
TCP Fast Open in Linux 3.7 and later is now supported
in the client via Kgio::Socket#kgio_fastopen.
This release also adds the kgio_writev and
kgio_trywritev methods, thanks to funny-falcon
Changes:
GIT-VERSION-GEN | 2 +-
ext/kgio/accept.c | 36 +---
ext/kgio/connect.c | 145 +++++++++++---
ext/kgio/extconf.rb | 4 +
ext/kgio/kgio.h | 23 +++
ext/kgio/kgio_ext.c | 35 ++++
ext/kgio/read_write.c | 310 ++++++++++++++++++++++++++++-
ext/kgio/tryopen.c | 5 +-
test/lib_read_write.rb | 129 ++++++++++++
test/lib_server_accept.rb | 8 +-
test/test_poll.rb | 8 +-
test/test_socket.rb | 14 ++
test/test_tfo.rb | 70 +++++++
test/test_unix_client_read_server_write.rb | 2 +-
14 files changed, 722 insertions(+), 69 deletions(-)
commit 8be51237720fd18cb45188f29c717bbac0ca1964
Author: Eric Wong
Date: Fri Jan 18 10:25:20 2013 +0000
kgio 2.8.0 - TCP Fast Open, writev/trywritev
TCP Fast Open in Linux 3.7 and later is now supported
in the client via Kgio::Socket#kgio_fastopen.
This release also adds the kgio_writev and
kgio_trywritev methods, thanks to funny-falcon
commit 3e555a62c75406d15199fd7bdb287704e5738352
Author: Eric Wong
Date: Fri Jan 18 10:50:28 2013 +0000
rename fastopen => kgio_fastopen in Kgio::Socket
In the unlikely case the Ruby Socket class implements its
own "fastopen" method, we will avoid conflicting.
commit c751f42f5f6a5e54a399df472015ab6d2ffc3f7a
Author: Eric Wong
Date: Sun Dec 30 11:43:10 2012 +0000
accept: do not set blocking if non-blocking is set
This is prone to race conditions in multiprocess situations
where one process is relying on non-blocking operation while
another (likely newer process) relies on blocking operation.
Since the blocking process can always fall back to calling
rb_io_wait_readable(), use that instead and give up some
scalability for higher reliability.
Those interested in avoiding thundering herds will have to
stop/start their processes using blocking sockets (and tolerate
some downtime).
commit c63ad2b2e0e25f0765605e8ba2d7038b5e28d878
Author: Eric Wong
Date: Thu Dec 27 02:16:26 2012 +0000
fastopen: fix argument order in RDoc example
Oops :x
commit 5f696156e097a1e66cb0c5c2a7cf62b38fd97605
Author: Eric Wong
Date: Thu Dec 27 01:29:01 2012 +0000
read_write: remove unused variable
commit f61cef65b8a8816160c622324b4f1aad55034e4a
Author: Eric Wong
Date: Thu Dec 27 01:16:56 2012 +0000
implement TCP Fast Open support (client + server)
Server support just requires exposing one constant for
setsockopt: Kgio::TCP_FASTOPEN
Client support implements a new Kgio::Socket#fastopen method.
This new method wraps the the sendto() syscall. With TCP Fast
Open, the sendto() syscall is overloaded for stream sockets to
implement the functionality of both connect() + write()
Since it only makes sense to use _blocking_ I/O for sendto(),
TFO clients are only supported in Ruby implementations with
native threads.
commit 7a3fc55424338ad458cc719d4cb3c4e28802d5cb
Author: Eric Wong
Date: Thu Dec 13 00:02:50 2012 +0000
Kgio::Socket.new retains compatibility with Socket.new
This allows us to create an unconnected socket, just like
the normal Socket class it inherits from.
commit 48fc432a3b9dfd2b0435f0975556d4a321a5239b
Author: Eric Wong
Date: Wed Dec 12 21:40:50 2012 +0000
connect: factor out tcp_getaddr() function
This will be reused for TCP fast open support.
commit 9ddd17b0e296eb279f05d418da6ad46319bcf0b5
Author: Eric Wong
Date: Wed Dec 12 21:21:29 2012 +0000
connect: split out my_socket() function
This makes the retry logic for mismatched libc headers/kernel
versions easier to understand and follow.
commit 8b4df8ece93ddc4e2fb685905461c1ed27b22295
Author: Eric Wong
Date: Wed Nov 21 23:16:00 2012 +0000
tryopen: include errno.h header just in case
errno.h is not guaranteed to be included in existing headers,
so we need to #include it to ensure errno and friends are
usable.
Thanks to stuart on the kgio mailing list for noticing
ref: <062571308.133355.1353536890665.JavaMail.sas1@172.29.251.236>
commit f020550fc802f299fdcdec695ac80d53ef3d24d9
Author: Eric Wong
Date: Mon Jul 2 04:21:40 2012 +0000
test workaround for platforms with unreliable signals
Ruby may not respond well to signals on all platforms, especially not
after fork()-ing in the face of a running pthread (timer thread on
1.9.2). SIGKILL bypasses Ruby (and all userspace) signal handling on
Debian GNU/kFreeBSD.
commit 488a148d8b172e152e3450062b172ba516ab84b3
Author: Eric Wong
Date: Mon Jul 2 04:20:20 2012 +0000
test/lib_read_write: wait for readability before tryread
On FreeBSD, writing to a loopback TCP socket does not guarantee
immediate readability on the other end.
Tested on Debian GNU/kFreeBSD 6.0
commit c79babfd175aa7b4be9d4d1a10a64c17b93730a0
Author: Eric Wong
Date: Mon Jul 2 03:16:09 2012 +0000
test_poll: skip signal torture on Debian GNU/kfreebsd
This cascades test failures on a platform with questionable
signal/fork handling.
Tested on: Debian GNU/kFreeBSD 6.0
commit ff27e74a49bf6746ffe74cfc865430221f0bafe0
Author: Sokolov Yura 'funny-falcon
Date: Fri Jun 1 13:42:58 2012 +0400
add `#kgio_writev` and `#kgio_trywritev`
Add methods for using writev(2) syscall for sending array of string in
a single syscall. This is more efficient than concatenating strings on
Ruby side or sending them one by one.
`#kgio_trywritev` returns array of strings which are not sent to the
socket. If there were objects other than string, they could be converted
using `#to_s` method, but this is not strictly applied, cause
`#kgio_*writev` tries to write at most `sysconf(_SC_IOV_MAX)` items
at once (for Linux its value is 1024). First string of returned array
could be part of string from array, so that you should assume it is not
in consistent state.
`#kgio_writev` semantic differs a bit from `#kgio_write` in term of
buffers mutability: currently `#kgio_write` tries to follow string changes
made concurrently, but `#kgio_writev` works with array's lightweight copy.
Signed-off-by: Eric Wong
commit fa52cc5d0ef7d04b844868e08e2e7ec3c9e3396e
Author: Eric Wong
Date: Wed May 30 12:31:19 2012 -0700
tryopen: avoid ambiguous name for subst function
Define rb_thread_blocking_region as a macro for MRI 1.8
to prevent confusing output in tools such as valgrind/gdb.
commit a72e6cd0dd3038ae2a1b5ef94780143f5ab041c0
Author: Sokolov Yura 'funny-falcon
Date: Wed May 30 17:56:55 2012 +0400
use rb_str_subseq for tail string on write
Use rb_str_subseq for taking string's tail. rb_str_subseq do not allocate
additional memory in this case. And although it prevents from collecting
original string, it seems that tests wins both in performance and in memory
usage.
Use fallback to rb_str_substr on ruby1.8
Signed-off-by: Eric Wong
commit 021eaddbfb41d82c0082657f60021bad52b3a6dc
Author: Sokolov Yura 'funny-falcon
Date: Wed May 30 17:56:54 2012 +0400
Fix UnixClientReadServerWrite test class name
Signed-off-by: Eric Wong
|