[logback-user] MDC performance concerns
Matthew Finn
matt at bitcount.com
Wed Apr 23 19:07:07 CEST 2008
Hello,
I am interested in converting my application to logback, but I have
some performance concerns about its MDC implementation.
My application uses MDC extensively for async IO, so it may call
MDC.put and MDC.remove extremely frequently, because each thread may
be handling 1000s of interleaved connections using state machines.
I see in the source for LogbackMDCAdapter that for every call to
MDC.put and MDC.remove, the HashMap is cloned. Could this clone
potentially be handled during the creation of LoggingEvents instead of
the call to MDC? The creation of logging events is expected to entail
memory allocation, so it seems that it would be a better fit there,
even if some applications might have a very low number of calls to MDC
versus logging calls. It seems that the same energy expended in
minimizing log statement impact when logging is turned off should also
apply to MDC calls.
Thanks
Matt
More information about the Logback-user
mailing list