[ANN] nio4r 2.0.0: cross-platform asynchronous I/O primitives for Ruby

37 views
Skip to first unread message

Tony Arcieri

unread,
Dec 28, 2016, 10:23:31 PM12/28/16
to sock...@googlegroups.com, cellulo...@googlegroups.com, ruby-talk ML
nio4r is a set of low-level asynchronous I/O primitives with multiple cross-platform native code backends including a C extension based on libev, a java.nio backend for JRuby, and a pure Ruby version based on Kernel.select:


ActionCable, a web socket framework included with Rails 5, uses nio4r for monitoring multiple WebSockets for I/O readiness.

--

nio4r 2.0.0 primarily includes new features and bugfixes, with few breaking changes. The primary reason for bumping the major version is dropping support for all Ruby versions prior to 2.2.2.

The main new feature announcement is NIO::ByteBuffer: a StringIO-like type backed by native code implementations which can be used for high-performance non-blocking I/O. The implementation was contributed to nio4r as a Google Summer of Code project by Upekshe Jayasekera:

https://github.com/socketry/nio4r/wiki/Byte-Buffers

nio4r is now located under the GitHub "socketry" project. Expect more socketry-related announcements soon!

Full change log:
--
Tony Arcieri

Tiago Cardoso

unread,
Dec 29, 2016, 10:01:28 AM12/29/16
to Celluloid, sock...@googlegroups.com, ruby...@ruby-lang.org
+1, this all looks very good! 


A few questions:

* Are bytebuffers to be integrated in celluloid-io? They certainly seem to be a candidate, specially the tcp socket buffer operations, but since nio4r moved organization, and celluloid-io being in maintenance mode/not receiving contributions at all for quite some time, this might be unclear. 

* I've checked the signatures for read_from and write_to from io's,and one can't set read/write timeouts. This has been the subject of a still not accepted PR in celluloid-io (https://github.com/celluloid/celluloid-io/pull/170), and is one of the main features that socketry has implemented (timeout backends). How is this to be integrated? Is there an example somewhere regarding timeouts? 

Tony Arcieri

unread,
Dec 29, 2016, 12:07:19 PM12/29/16
to cellulo...@googlegroups.com, sock...@googlegroups.com, ruby-talk ML
On Thu, Dec 29, 2016 at 7:01 AM, Tiago Cardoso <honeyry...@gmail.com> wrote:
* Are bytebuffers to be integrated in celluloid-io?

I've been planning on doing another release of Celluloid soon. I might look at doing integration work then.
 
They certainly seem to be a candidate, specially the tcp socket buffer operations, but since nio4r moved organization, and celluloid-io being in maintenance mode/not receiving contributions at all for quite some time, this might be unclear. 

Right now I've been playing with making an async/await framework for Ruby which is much simpler than Celluloid::IO. But yes, Celluloid::IO is a candidate for such buffers.
 
* I've checked the signatures for read_from and write_to from io's,and one can't set read/write timeouts.

read_from / write_to are non-blocking, so timeouts are irrelevant.

--
Tony Arcieri
Reply all
Reply to author
Forward
0 new messages