[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

Wei Cao <>
Fri Jul 13 04:10:49 CEST 2012


I think periodly calls to erts_deliver_time() is necessary.Because at
first I tried to comment out the call to erts_deliver_time() from
erts_check_io(), it would cause erlang VM hang out.

erts_deliver_time() does more than  erts_time_remaining(), it updates
a clock counter named do_time which is used inside timer wheel.


2012/7/13 Wojtek Narczy¨½ski <>:
> 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...
>
> --Regards,
> Wojtek Narczynski



-- 

Best,

Wei Cao



More information about the erlang-questions mailing list