Liquibase performance


I’m using liquibase (build from trunk 2 months ago) to do data backup in a web application (jboss-web server with spring and richfaces).

When the backup is proceeded I call LockService.getInstance(database).waitForLock();
and after the backup is finished I call

            } finally {
            try {
                } catch (LockException e) {
                if (liquibase != null) {

On every request I check if there is backup operation currently running with
                LockService lockService = LockService.getInstance(createDatabase(connection));             DatabaseChangeLogLock[] listLocks = lockService.listLocks();             if (null != listLocks && listLocks.length > 0) {                 return true;             }
if the result is true no database commits will be executed and the user will be redirected to another page.

I have some performance issues and I tracked down (yourkit) that this check takes 51% from the CPU time of the request. After detailed investigation I see that createDatabase() takes 16% and listLocks() takes 36% from the total request CPU time. After going down in the call list

createDatabase() -> … -> liquibase.servicelocator.ResolverUtil.listClassResources(JarInputStream, String) -> java.util.jar.JarInputStream.getNextJarEntry() takes 16%

and listLocks() -> com.mysql.jdbc.Statement.executeQuery(String) takes 19%
      listLocks() -> java.util.jar.JarInputStream.getNextJarEntry() takes another 17%

So from these 51% - 19% (967 ms) are used to open the connection and check if there are locks and 16% + 17% ~ 32% are used for liquibase.servicelocator.ResolverUtil.listClassResources(JarInputStream, String) -> java.util.jar.JarInputStream.getNextJarEntry()

Is there any chance to minimize these 32%?

I’ll take a look.  The wait for lock queries should be fast.  The listClassResources may take some time to hunt for extensions in the jar files.  I did make some changes in performance relatively lately.  Could you try a newer build and see if you still have issue?