[erlang-questions] high-volume logging via a gen_server
Mon Oct 4 14:31:53 CEST 2010
On 4 October 2010 12:57, Dan Kelley <> wrote:
> So, what are good strategies to cope with a large incoming volume of
> messages that all need to wind up in the same logfile? Is there a more
> efficient way to write to disk than the simple io:format() call than I'm
> using above? What's a good way to parallelize the logging over multiple
> processes but keep all of the information in one file?
What we do is to have one public ETS table per log file. All log entries are
written directly to the ETS table by the calling process. Every few seconds,
a dedicated logging process scans the ETS table, accumulates them, and dumps
them to disk in one write operation. This works very well.
More information about the erlang-questions