mpenet / jet

[not maintained, use at own risk] Jetty9 ring server adapter with WebSocket support via core.async and Jetty9 based HTTP & WebSocket clients (jvm based, no cljs)
http://mpenet.github.io/jet/
167 stars 19 forks source link

increasing body chunk sizes #7

Closed pyr closed 9 years ago

pyr commented 9 years ago

Hi !

When streaming data from a request's body by treating it as an InputStream (which HttpInputOverHTTP implements), the typical chunk size I am getting from reads is 8k.

I haven't found a way to modify that and would be happy with letting jetty hand over bigger chunks, ideally in a configurable manner.

Did I miss the way to do it or is it not exposed by jetty ?

Cheers!

mpenet commented 9 years ago

Hi! On top of my head I dont know if that possible to just set a property for this. However it's possible to use a custom ContentProvider such as http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/client/util/DeferredContentProvider.html and have full control over this I believe, this is what I had in mind for #4 but never got to implement it.

There's a protocol to do this, feel free to try it if I don't come up with a solutions in good time (busy day here).

the proto/fn: https://github.com/mpenet/jet/blob/master/src/clj/qbits/jet/client/http.clj#L79

pyr commented 9 years ago

Hmm, this seems to be in the context of a client, I should clarify that when I say "streaming data from a request's body" I mean that in the context of a server receiving a request with a large payload.

I'll dig deeper, thanks for the pointers anyhow!

pyr commented 9 years ago

Basically, the equivalent of output-buffer-size (.setOutputBufferSize in http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/HttpConfiguration.html) for input, which isn't exposed in HttpConfiguration

mpenet commented 9 years ago

I was wondering! Ok, well no idea then, I can look into this tomorrow probably. Let me know if you find a solution.

mpenet commented 9 years ago

I think I have managed to find a way to have control over this via http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/AbstractConnectionFactory.html#setInputBufferSize(int) called from http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/HttpConnectionFactory.html . Let me know if that changes anything for you. It's available as of 0.5.10

pyr commented 9 years ago

Hey!

This works as expected (well, not quite, but it does increase the amount of chunks processed). If I want anything more granular, I'll have to got to netty anyway.

Thanks a lot!