So I wanted to see how much overhead plug actually adds to cowboy and I tried to add cowboy to the https://github.com/tbrand/which_is_the_fastest benchmark. It didn’t go quite as expected since cowboy 2.0-pre turned out to be much slower than plug there. So then I tried cowboy 1.1 which plug and phoenix use, but it still was a bit slower. Can maybe somebody with more experience with cowboys look into the code and maybe see ways to improve it?
Very cool followup! So basically cowboy2 will be a tiny bit slower than cowboy1 because it adds a unified interface for http1.1 and http2, but in doing so it gains a lot of ease of use, plus http2.
And of course cowboy2 is not tuned yet, still in dev. ^.^
EDIT: Cowboy dev has put some very interesting information on how likely to get cowboy2 faster than cowboy1, this will be useful for when plug is updated. https://github.com/ninenines/cowboy/issues/1169