warmcat / libwebsockets

canonical libwebsockets.org networking library

Home Page:https://libwebsockets.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

latency between lws_callback_on_writable and event LWS_CALLBACK_CLIENT_WRITEABLE?

bethebest0622 opened this issue · comments

call lws_write after lws_callback_on_writable is the safe method.

recently, i am curious about the latency of this two steps.

so i have a test about latency.

here is some data.

11:42:14.780 common_util.hpp:232 [INFO] [getlat] Start print vector(15):139, 8, 32584, 4, 16, 56, 36, 26, 35, 26, 32, 26, 33, 25, 34, End print vector 
11:43:57.743 common_util.hpp:232 [INFO] [getlat] Start print vector(16):36, 37, 41, 33, 39, 37, 27, 37, 32, 38, 24, 38, 36, 37, 5268, 27, End print vector

the unit is us.

so, in most samples, it's fast, but in some samples, the latency will reach ms.

could you help on this, in what kind of sitution, the latency will be large? is there any methods can avoid this?

Either that's the situation on the socket, eg, with delay getting any ACK so you can't send anything because the tcp window is full; or you're unable to service it for 32ms due to something blocking the thread.

That's something you have to debug yourself.