[jetty-users] Disabling Direct Buffers in Jetty 9

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jetty-users] Disabling Direct Buffers in Jetty 9

Nicholas Lun
This post was updated on .
Hello,

In Jetty 8 you could disable the use of Direct Buffers for NIO connectors via the setUseDirectBuffers(bool) method in the AbstractNIOConnector class. Is there a way to do this in Jetty 9?
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Disabling Direct Buffers in Jetty 9

Greg Wilkins-3

Nicholas,

currently Jetty-9 does not use direct buffers for protocol for HTTP, but I just noticed that SPDY is using direct buffers.

However this should mostly be transparent to users, why do you wish to control it?

Note that the DefaultServlet has a useFileMappedBuffer option that can be set as a init param and does have a more visible effect (of locking files).

cheers



On 14 September 2013 06:01, Nicholas Lun <[hidden email]> wrote:
Hello,

In Jetty 8 you could disable the use of Direct Buffers for NIO connectors
via the setUseDirectBuffers(bool) method in the AbstractNIOConnector class.
Is there a way to do this in Jetty 9?



--
View this message in context: http://jetty.4.x6.nabble.com/Disabling-Direct-Buffers-in-Jetty-9-tp4961201.html
Sent from the Jetty User mailing list archive at Nabble.com.
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Greg Wilkins <[hidden email]>
http://www.webtide.com
Developer advice and support from the Jetty & CometD experts.
Intalio, the modern way to build business applications.

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Disabling Direct Buffers in Jetty 9

Nicholas Lun
This post was updated on .
There were some issues we were running into when using Direct Buffers but it looks like it isn't a problem anymore. That being said it's good to know what is and what isn't using Direct Buffers in Jetty 9, thanks Greg.
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Disabling Direct Buffers in Jetty 9

Matthew Painter
In reply to this post by Greg Wilkins-3
Hi Greg,

What were the reasons for taking out the direct buffer support? Buggy JDK code?

Thanks :)

Matt


On Mon, Sep 16, 2013 at 1:47 AM, Greg Wilkins <[hidden email]> wrote:

Nicholas,

currently Jetty-9 does not use direct buffers for protocol for HTTP, but I just noticed that SPDY is using direct buffers.

However this should mostly be transparent to users, why do you wish to control it?

Note that the DefaultServlet has a useFileMappedBuffer option that can be set as a init param and does have a more visible effect (of locking files).

cheers



On 14 September 2013 06:01, Nicholas Lun <[hidden email]> wrote:
Hello,

In Jetty 8 you could disable the use of Direct Buffers for NIO connectors
via the setUseDirectBuffers(bool) method in the AbstractNIOConnector class.
Is there a way to do this in Jetty 9?



--
View this message in context: http://jetty.4.x6.nabble.com/Disabling-Direct-Buffers-in-Jetty-9-tp4961201.html
Sent from the Jetty User mailing list archive at Nabble.com.
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Greg Wilkins <[hidden email]>
http://www.webtide.com
Developer advice and support from the Jetty & CometD experts.
Intalio, the modern way to build business applications.

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Disabling Direct Buffers in Jetty 9

Greg Wilkins-3

Matthew,

Direct buffers are only efficient if they are access from user space infrequently and write either once in a big chunk or in multiple times.

For HTTP requests, we parse the content byte by byte or token by token, so if it were a direct buffer that would be expensive.  With the indirect buffer, it is copied over to user space in a chunk and then we can parse it cheaply (also using array accessors rather than get methods).

For HTTP responses, we generate the content initially header by header, so there are multiple accesses there as well, so it is too costly to make direct.

Also if you have SSL involved, direct buffers are really bad as you have to pull it back to user space to encrypt.

If we are sending static content, that will come as either a file mapped buffer or sometimes as a direct buffer, so that will be efficiently sent then.


cheers









On 18 September 2013 18:47, Matthew Painter <[hidden email]> wrote:
Hi Greg,

What were the reasons for taking out the direct buffer support? Buggy JDK code?

Thanks :)

Matt


On Mon, Sep 16, 2013 at 1:47 AM, Greg Wilkins <[hidden email]> wrote:

Nicholas,

currently Jetty-9 does not use direct buffers for protocol for HTTP, but I just noticed that SPDY is using direct buffers.

However this should mostly be transparent to users, why do you wish to control it?

Note that the DefaultServlet has a useFileMappedBuffer option that can be set as a init param and does have a more visible effect (of locking files).

cheers



On 14 September 2013 06:01, Nicholas Lun <[hidden email]> wrote:
Hello,

In Jetty 8 you could disable the use of Direct Buffers for NIO connectors
via the setUseDirectBuffers(bool) method in the AbstractNIOConnector class.
Is there a way to do this in Jetty 9?



--
View this message in context: http://jetty.4.x6.nabble.com/Disabling-Direct-Buffers-in-Jetty-9-tp4961201.html
Sent from the Jetty User mailing list archive at Nabble.com.
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Greg Wilkins <[hidden email]>
http://www.webtide.com
Developer advice and support from the Jetty & CometD experts.
Intalio, the modern way to build business applications.

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users




--
Greg Wilkins <[hidden email]>
http://www.webtide.com
Developer advice and support from the Jetty & CometD experts.
Intalio, the modern way to build business applications.

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users