[JAVA-1155] Support Netty for I/O Created: 25/Mar/14  Updated: 31/Mar/15  Resolved: 11/Jun/14

Status: Closed
Project: Java Driver
Component/s: Async
Affects Version/s: None
Fix Version/s: 3.0.0

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Ross Lawley
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Async

 Description   

We will still leverage AIO and have no plans currently to remove AsynchronousSocketChannelStream. This is the default implementation that the driver uses for async.
Furthermore, there is not a hard dependency on Netty. It's opt-in (via a system property, though that may change), and if you don't opt-in, Netty does not need to be on the classpath.

But Netty gives us some advantages.

1. AsynchronousSocketChannel was introduced in Java 7, and we would like a solution for our Java 6 users. Netty is supported on Java 6 and up.
2. Our AsynchronousSocketChannel-based implementation does not support SSL, and adding that support is non-trivial. With Netty, it's just a few lines of code.
3. For applications that already use Netty for the rest of their I/O needs, a Netty-based driver for MongoDB may integrate better. For example, they could share an instance of an NioEventLoopGroup.



 Comments   
Comment by Jeffrey Yemin [ 31/Mar/15 ]

Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.

Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Async Stream updates

  • Applied socket settings to NettyStream and AsynchronousSocketChannelStream
  • Bumped Netty version and made NettyStream connection fully Async
  • Made AsynchronousSocketChannelStream inline with other streams
    so it now throws a MongoSocketOpenException if connection fails

Refs JAVA-1155
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/82be2f734ac11bdee2e0a920d872aed0b4a77c83

Comment by Githook User [ 11/Jun/14 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Async Stream updates

  • Applied socket settings to NettyStream and AsynchronousSocketChannelStream
  • Bumped Netty version and made NettyStream connection fully Async
  • Made AsynchronousSocketChannelStream inline with other streams
    so it now throws a MongoSocketOpenException if connection fails

Refs JAVA-1155
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/82be2f734ac11bdee2e0a920d872aed0b4a77c83

Comment by Githook User [ 02/Apr/14 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Bumped Netty to 4.0.18.Final

See: http://netty.io/news/2014/04/01/4-0-18-Final.html
JAVA-1155
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/1b74a374386f30a38143891b599b234290f20eb2

Comment by Githook User [ 26/Mar/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1155: Making Netty optional. By default the NIO2 implementation of Stream will be used if async is enabled. Set the system property org.mongodb.async.type to "netty" to enable Netty.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/dcb942d35d6a5a7365a79c15348e9361cf45c035

Comment by Githook User [ 26/Mar/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1155: Changed Stream interface so that it's the Stream's responsibility to allocate the ByteBuf returned from read or readAsync. This allows for zero-copy reads with Netty.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/610281ed5df9826ecf50c92f1fbc8662f13fa0cb

Comment by Githook User [ 26/Mar/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1155: StreamFactory and InternalStreamConnectionFactory now also determine the BufferProvider that must be used with Stream instances that are handed out. This is so that
the Stream can be optimized for use with a particular implementation of ByteBuf.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/ce1e9d31a218e3a20128bcc01febc33351d85ab4

Comment by Githook User [ 26/Mar/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1155: NettyStream now works only with NettyByteBuf and is optimized for it.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/ec42d67eb783b1e904d258cb06bd1f71161efc70

Comment by Githook User [ 26/Mar/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1155: Created new implementation of org.bson.ByteBuf that wraps an io.netty.buffer.ByteBuf, and an implementation of BufferProvider which uses it.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/3a8207172dc1b9a9d78be6d39880afc9f9418566

Comment by Githook User [ 26/Mar/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1155: A working implementation of the Stream interface based on Netty 4.0. While it works, it shows a lot of problems with the Stream abstraction. The fact that Netty has it's own ByteBuf class means we have to copy from Netty's ByteBuf to our own. And the fact that reads are separated from writes in the Stream API means that there has to be a ping-pong between readAsync and the read handler that we give to Netty.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/346008e01509efad6efc8c7b51dc4920d551c0c9

Generated at Thu Feb 08 08:53:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.