Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Disabling Direct Buffers in Jetty 9


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 <matthew.painter@xxxxxxxxxx> 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 <gregw@xxxxxxxxxxx> 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 <nlun@xxxxxx> 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
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Greg Wilkins <gregw@xxxxxxxxxxx>
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
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users




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

Back to the top