[Haskell-cafe] RFC: Extendable and Easy-To-Use Logger (HLogger)

Gregory Collins greg at gregorycollins.net
Tue Apr 12 19:10:09 CEST 2011


On Tue, Apr 12, 2011 at 6:40 PM, Jon Kristensen
<technology at jonkristensen.com> wrote:
> Hello Haskellers!
>
> As I have now implemented everything that I could think of, I would like to
> ask the Haskell community to give some feedback on HLogger so that I can
> continuing improving it. Some questions:
>
> Do you have any general/architectural thoughts on things I might be doing
> wrong?

1) Use "Text" as the string type, not "String"

2) Re: SimpleLogger: writing to and flushing the log file upon
receiving each message is absolutely the wrong thing to do in
high-performance code. Each write() is a context switch into the
kernel, and doing it this way will kill your throughput (in messages
per second). What we do in our webserver (which relies on
high-throughput access logging) is to buffer messages to the log
channel in memory, and perform the actual writes in a separate worker
thread no more often than once every N seconds.


> Is the ease-of-use goal contradicting making this library useful in more
> complex applications?

"Easy to use" and "high performance" don't have to be contradictory,
but you shouldn't neglect the latter.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the Haskell-Cafe mailing list