[erlang-questions] Improve performance of IO bounded server written in Erlang via having pollset for each scheduler and bind port to scheduler together with process

Wojtek Narczyński <>
Thu Jul 12 19:45:09 CEST 2012

On 07/12/2012 11:58 AM, Wei Cao wrote:
> the mutex timeofday is locked each time erts_check_io is invoked to
> "sync the machine's idea of time", erts_check_io is executed hundreds
> of thounds of times per second, so it's locked too much times, hence
> reduce performance.
I am trying to figure out how is "the machine's idea of time" relevant 
to checking for io. I am begining to suspect that the lone call to 
erts_deliver_time() in erl_check_io.c:1179 might be unnecessary. If 
do_wait is true, the call to erts_time_remaining(&wait_time) will update 
the global time. If do_wait is false, which should be the case most of 
the time on a busy server, as per erts_check_io(!runnable) calls, the 
timeout to select/poll/epoll whichever is going to be zero anyway. There 
must be a catch, because this simply looks too good to be true...

Wojtek Narczynski

More information about the erlang-questions mailing list