You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Eugene79 <sp...@yahoo.com> on 2008/12/19 07:10:28 UTC

JDBC persistence adapter improvements

Hi all,

I made the following improvements to the JDBC persistence adapter:

1. Implemented PostgresqlJDBCAdapter.doDeleteOldMessages() method that is at
least three orders of magnitude faster than the default implementation. The
same optimization may apply to other databases so you may want to consider
moving it to DefaultJDBCAdapter.

2. Changed DefaultJDBCAdapter.doRecoverNextMessages() to always process at
least 1000 messages at a time. This results in a huge performance
improvement. However, this implementation is a hack (see comment). Somebody
may want to look into why maxReturned gets set to 1 on the third call to
doRecoverNextMessages(). I was able to consistently reproduce this
behaviour.

3. Fixed JDBCPersistenceAdapter so that it does not double-call cleanup()
[once in the main thread, once in the worker thread], and also so that it
does not hang ActiveMQ initialization when there are lots of pending
messages.

Diffs attached.

Eugene

http://www.nabble.com/file/p21086330/DefaultJDBCAdapter.java.diff
DefaultJDBCAdapter.java.diff 
http://www.nabble.com/file/p21086330/JDBCPersistenceAdapter.java.diff
JDBCPersistenceAdapter.java.diff 
http://www.nabble.com/file/p21086330/PostgresqlJDBCAdapter.java.diff
PostgresqlJDBCAdapter.java.diff 
-- 
View this message in context: http://www.nabble.com/JDBC-persistence-adapter-improvements-tp21086330p21086330.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: JDBC persistence adapter improvements

Posted by Eugene79 <sp...@yahoo.com>.
small correction to the previous diff.

http://www.nabble.com/file/p21425975/PostgresqlJDBCAdapter.java.diff
PostgresqlJDBCAdapter.java.diff 
-- 
View this message in context: http://www.nabble.com/JDBC-persistence-adapter-improvements-tp21086330p21425975.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: JDBC persistence adapter improvements

Posted by Eugene79 <sp...@yahoo.com>.
[back from vacation].

Here is the jira issue:
https://issues.apache.org/activemq/browse/AMQ-2063

Eugene



Dejan Bosanac wrote:
> 
> Hi Eugene,
> 
> thanks for this contribution. Any chance you file this enhancement in Jira
> (along with the patch) so it doesn't get lost in the forum?
> 
> Cheers
> --
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
-- 
View this message in context: http://www.nabble.com/JDBC-persistence-adapter-improvements-tp21086330p21425691.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: JDBC persistence adapter improvements

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Eugene,

thanks for this contribution. Any chance you file this enhancement in Jira
(along with the patch) so it doesn't get lost in the forum?

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Fri, Dec 19, 2008 at 7:10 AM, Eugene79 <sp...@yahoo.com> wrote:

>
> Hi all,
>
> I made the following improvements to the JDBC persistence adapter:
>
> 1. Implemented PostgresqlJDBCAdapter.doDeleteOldMessages() method that is
> at
> least three orders of magnitude faster than the default implementation. The
> same optimization may apply to other databases so you may want to consider
> moving it to DefaultJDBCAdapter.
>
> 2. Changed DefaultJDBCAdapter.doRecoverNextMessages() to always process at
> least 1000 messages at a time. This results in a huge performance
> improvement. However, this implementation is a hack (see comment). Somebody
> may want to look into why maxReturned gets set to 1 on the third call to
> doRecoverNextMessages(). I was able to consistently reproduce this
> behaviour.
>
> 3. Fixed JDBCPersistenceAdapter so that it does not double-call cleanup()
> [once in the main thread, once in the worker thread], and also so that it
> does not hang ActiveMQ initialization when there are lots of pending
> messages.
>
> Diffs attached.
>
> Eugene
>
> http://www.nabble.com/file/p21086330/DefaultJDBCAdapter.java.diff
> DefaultJDBCAdapter.java.diff
> http://www.nabble.com/file/p21086330/JDBCPersistenceAdapter.java.diff
> JDBCPersistenceAdapter.java.diff
> http://www.nabble.com/file/p21086330/PostgresqlJDBCAdapter.java.diff
> PostgresqlJDBCAdapter.java.diff
> --
> View this message in context:
> http://www.nabble.com/JDBC-persistence-adapter-improvements-tp21086330p21086330.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>