Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Performance issue, bug, or as intended?

I have two cases that I’d like some opinion before trying to identify if it’s a bug, if it’s worth investigating, or even if I can help improve it.

I’m using jetty 9.1.0.M0 via maven.

1. First case is on the HttpInput. From what I saw from the code, I assume there is buffering anyway inside of it, so it should be safe to call the int read(). Unfortunately the code at line 121 creates a new byte[] with size 1 for each call, which puts a lot of strain on the GC in my case. Is it worth to pre-create that byte[1], or to change some code to avoid the creation of it?


2. Second case is the trick of casting the Servlet{In,Out}putStream into Http{In,Out}put, to get access to the ByteBuffer versions of the read and write. I can’t recall at the moment how the HttpInput.read(BB) behaves, but the HttpOutput.write(BB) is not consistent with the write(byte[]). The call to write byte arrays adds the bytes into the internal buffer and flushes when the buffer is full, of an explicit flush is called. The call to the write(ByteBuffer) flushes the buffer and the http chunk right away. Is this expected?

thanks in advance.


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Back to the top