[erlang-questions] high-volume logging via a gen_server

Anthony Shipman als@REDACTED
Tue Oct 5 11:23:41 CEST 2010


On Tue, 5 Oct 2010 06:42:17 am Mihai Balea wrote:
> On Oct 4, 2010, at 2:57 PM, 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?
>

You can have a buffer process ahead of the logger. The buffer process just has 
to accept and store log requests. A separate write process can pull them from 
the buffer (using an async protocol). If the buffer gets too full then you 
can have various policies such as discard oldest, youngest, low priority 
messages etc.

-- 
Anthony Shipman                    Mamas don't let your babies 
als@REDACTED                   grow up to be outsourced.


More information about the erlang-questions mailing list