Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP client for throughput - Netty vs Apache HttpAsyncClient

I'm interested in executing about 50 HTTP requests/second from a single machine. I don't care so much about latency but I do care about throughput.

I'm trying to decide whether to use Apache HttpAsyncClient or use Netty. Could someone shed some light about the advantages of each regarding my problem?

I've found this comparison but I was hoping for a little bit more detailed explanation on which one is better and for what use case. Also, does the comparison means that using the synchronous apache HTTP client with 200 threads be better than the other options? Isn't 200 threads a bit too much (assuming I'm using a normal computer with 4 cores, 2 threads per core and 12GB of RAM)?

Thanks in advance

like image 891
Gideon Avatar asked Feb 07 '23 17:02

Gideon


1 Answers

The main problem with these benchmarks is that in real life you have more threads and much more noise, so you can't really expect to get similar results in production unless you go for the async IO option.

You're looking into getting more throughput, and as expected Netty based clients wins big time in their benchmark. So it's probably your best bet.

We're using Netty very successfully for a wide array of applications, and it never fails us. You can use ning async-http-client, and then you don't have to implement a client all by your self.

Do note however, as I stated in the comments, I base my answer on my personal experience, and on our production metrics. Never believe a random benchmark post you see posted on the internet, nor a StackOverflow answer. Test it your self ;)

like image 186
Eran Harel Avatar answered Feb 10 '23 14:02

Eran Harel