luasocket
luasocket copied to clipboard
Are there req/s limits on http.request?
In tests using http.request I had problems exceeding 1k req/s. Below that, the response time is around 1ms, when it gets to 1k, my response time goes to 500ms to 1s for each request. Has anyone had this kind of problem? I didn't find anything about it here.
there can be a lot of different reasons for this to happen... resource shortage (memory, sockets/fds), network, server side latency, etc.
Thanks a lot for the quick response.
All the points mentioned were often analyzed in detail. Both via monitoring tool like Netdata and commands like strace, mpstat and etc. There is no resource exhaustion, ringbuffer overflow or filedescriptors overflow. Sysctl is fine tuned.
I use luasocket inside a lua script called on my PowerDNS server. I validated in many ways and everything pointed to the http.request
function I use luasocket to. When I have a stream above 1k of reqs/s, I have horrible degradation in response time with http.request.
Could you help me in a way to be able to debug this better inside luasocket?
Unfortunately this is beyond my knowledge of LuaSocket, maybe someone else knows...
It may be an effect of the Nagle's algorithm that seems not to be disabled in http.lua
.
Something like h.try(c:setoption('tcp-nodelay', true)
in http.lua
(function _M.open
) may help in this very specific case but may not be desirable for normal HTTP usage.