how to improve the latency of invoking async callbacks?

Skip to first unread message

yalin zhang

Mar 4, 2021, 1:23:01 PM3/4/21
to libuv
I am doing Electron development. I got a performance problems.

In my project, I used libuv to do async request and callbacks.
The event loop is uv_default_loop(). Two kinds of handles are created, one for common callbacks and the other is for http request.

What I observe is that the http request is invoked after a large latency - (around 100ms) while the common callbacks are invoked almost immediately.(1ms).

Could anyone tell me what is the possible cause? How can I check where is the bottleneck?
Is there any solution to shorten the latency?


Here is the log:
[open-electron:dev] mobilecv2:
[open-electron:dev] Send Http Request at 1614838881:800
[open-electron:dev] Do http request - ListSize: 1 at 1614838881.816 [first http request is invoked shortly]
[open-electron:dev] Send Http Request at 1614838882:206 [2nd http request]
[open-electron:dev] Send Http Request at 1614838882:206
[open-electron:dev] Send Http Request at 1614838882:252
[open-electron:dev] Send Http Request at 1614838882:258
[open-electron:dev] Queue and Fire Async Callback at 1614838882:296
[open-electron:dev] Do http request - ListSize: 4 at 1614838882.310 [start to invoke 2nd http request, which is 104ms later]
[open-electron:dev] Do callback event - ListSize: 1 at 1614838882.318
[open-electron:dev] Queue and Fire Async Callback at 1614838882:328
[open-electron:dev] Do callback event - ListSize: 1 at 1614838882.329 [common callbacks are invoked less than 1ms later]
Reply all
Reply to author
0 new messages