简体   繁体   中英

Java based HTTP Client which supports Pipelining

您知道任何支持 HTTP/1.1 ( http://en.wikipedia.org/wiki/HTTP_pipelining ) 的 HTTP 流水线选项的免费 Java 库吗?

I don't think you will find any common ones supporting pipe-lining. Jetty HttpClient seems to support it from document but I couldn't make it to do it.

Please note that Pipeline is different from keep-alive. Keep-alive just means reuse the connection but it may still send only one request at a time over the connection. With pipe-lining, you can send several requests at the same time over the same connection and wait for their respective responses.

HTTPClient apparently supports pipelining here:

http://www.innovation.ch/java/HTTPClient/

but I haven't tried it personally and can't verify this.

hotpotato will support pipelining really soon. Performance-wise, it's way superior to Apache's HTTP Client, especially in high concurrency environments (multiple threads using the same instance of the client).

I still need to publish the results but on a LAN test, I'm getting ~7000req/s (hotpotato) vs ~100req/s (apache's). Of course, a great deal of the merit must go to Netty, the amazing framework hotpotato is built upon ;)

If you don't need a fancy full-fledged client, take a look here for a simpler version.

I realize my answer is about a year old, but as this is one of the top links for "java http pipelining", I thought it was relevant.

Hotpotato does indeed now support pipelining, and in my limited experience it's been working great so far. Also has a nice API to boot.

http://hotpotato.biasedbit.com/

EDIT: Looks like this project is now unmaintained and the author recommends the Async HTTP client: https://github.com/ning/async-http-client/

Apache HttpComponents Core 5 supports HTTP/1.1 pipelining. The example could be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM