gen_server locked for some time

Mikael Pettersson mikpelinux@REDACTED
Sat Nov 30 11:50:07 CET 2019

On Fri, Nov 29, 2019 at 11:47 PM Roberto Ostinelli <ostinelli@REDACTED> wrote:
> All,
> I have a gen_server that in periodic intervals becomes busy, eventually over 10 seconds, while writing bulk incoming data. This gen_server also receives smaller individual data updates.
> I could offload the bulk writing routine to separate processes but the smaller individual data updates would then be processed before the bulk processing is over, hence generating an incorrect scenario where smaller more recent data gets overwritten by the bulk processing.
> I'm trying to see how to solve the fact that all the gen_server calls during the bulk update would timeout.

If there is more logic in the gen_server for incoming data, have it
offload all writes to the separate process, using its message queue as
a buffer.  Otherwise make the sends to the gen_server asynchronous.

More information about the erlang-questions mailing list