[logback-dev] [JIRA] Created: (LBCORE-220) DBAppender.java performance improvement
Greg Thomas (JIRA)
noreply-jira at qos.ch
Wed Sep 7 18:17:16 CEST 2011
DBAppender.java performance improvement
Issue Type: Bug
Affects Versions: 0.9.29
Reporter: Greg Thomas
Assignee: Logback dev list
We're seeing a distinct lack of performance with the DBAppender.
Although it works fine in a single threaded environment, in a multi-threaded environment it slows down considerably. We've done some investigation, and narrowed it down to the pair of synchronized calls to subAppend() and selectEventId() (lines 107->110).
I've had a look at this, and can see no reason for these to be synchronized;
If using the JDBC3 getGeneratedKeys() method then as this applies to the thread specific statement there is no need to be synchronized.
All the "Dialect" based calls are also connection specific; in detail;
H2, HSQLDB and MySQL all call a database function, which is connection specific.
MsSQL and Sybase both select a connection specific variable.
Oracle and PostgreSQL both select the currval from a sequence, which again is connection specific.
Having removed the synchronisation, we're seeing vastly improved logging throughput in our application.
So to summarise; there is unnecessary synchronisation in the DBAppender that slows down multi-threaded applications; removing that synchronisation will improve performance in multi-threaded applications with no side affects.
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev