Fundamentally, Bandit just does a lot less work than Cowboy does. Particularly with HTTP/1 requests, Bandit uses a single process per connection in contrast with Cowboy's 2 per connection. This allows Bandit's handler code to be very 'linear' and free of coordination complexity; for the most part, an HTTP/1 connection will go from initial connection to Plug call and back again without having to leave the process at all.
More broadly, there's just less functionality in Bandit (by design; it's a very focused library that doesn't need to do a bunch of the stuff that Cowboy does). All that stuff ends up adding up when you're doing it 100k a second.
This correlates with Bandit's relative numbers being better in HTTP/1 (up to 5x faster than Cowboy) than they are in HTTP/2 (a paltry 2.3x faster than Cowboy).
In terms of the 32 concurrent connections peak, my hunch here is that it's due to the server the test is running on being a 32 core VM (see https://github.com/mtrudel/network_benchmark for details of the benchmarking process). Truthfully I'm no expert with benchmarking & this may not hold a lot of truth; at the end of the day the test is pretty apples to apples so I think it has comparative merit, but the absolute numbers are a bit murkier to me.
fouc|4 years ago
Also why does bandit have a peak around the 32 concurrent connections? Would idiomatic OTP design patterns normally exhibit that kind of behavior?
mcmatterson|4 years ago
More broadly, there's just less functionality in Bandit (by design; it's a very focused library that doesn't need to do a bunch of the stuff that Cowboy does). All that stuff ends up adding up when you're doing it 100k a second.
This correlates with Bandit's relative numbers being better in HTTP/1 (up to 5x faster than Cowboy) than they are in HTTP/2 (a paltry 2.3x faster than Cowboy).
In terms of the 32 concurrent connections peak, my hunch here is that it's due to the server the test is running on being a 32 core VM (see https://github.com/mtrudel/network_benchmark for details of the benchmarking process). Truthfully I'm no expert with benchmarking & this may not hold a lot of truth; at the end of the day the test is pretty apples to apples so I think it has comparative merit, but the absolute numbers are a bit murkier to me.
weatherlight|4 years ago