It's probably because coroutines in ngx_lua are a bit weird as they have had to be re-implemented to work in the Nginx environment.
Switching lua-resty-http to a purely functional non-coroutine approach is/was something we were going to do.
The co-routine approach is nice and elegant from a code PoV but isn't JIT'able and appears to have other performance issues.
It was kinda assumed that not being able to JIT the cosocket operations would be the bottleneck in the realworld but it was never benchmarked or investigated very far.
PR to switch pintsized/lua-resty-http to a function based body reader would be very much appreciated, as would any benchmarks/flamegraphs that show the coroutine reader as an issue!
Thanks
Hamish