[
https://issues.apache.org/jira/browse/QPID-8305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16831038#comment-16831038
]
ASF GitHub Bot commented on QPID-8305:
--------------------------------------
alex-rufous commented on pull request #30: QPID-8305: [Broker-J][JDBC Message
Store] Performance regression when increasing the number of queues linked to a
topic
URL: https://github.com/apache/qpid-broker-j/pull/30#discussion_r280094393
##########
File path:
broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/AbstractJDBCMessageStore.java
##########
@@ -1151,25 +1153,27 @@ public MessageEnqueueRecord
enqueueMessage(TransactionLogResource queue, Enqueue
final StoredMessage storedMessage = message.getStoredMessage();
if(storedMessage instanceof StoredJDBCMessage)
{
- _preCommitActions.add(new Runnable()
- {
- @Override
- public void run()
+ _preCommitActions.add(() -> {
+ try
{
- try
- {
- ((StoredJDBCMessage)
storedMessage).store(_connWrapper.getConnection());
- _storeSizeIncrease +=
storedMessage.getContentSize();
- }
- catch (SQLException e)
- {
- throw new StoreException("Exception on enqueuing
message into message store" + _messageId,
- e);
- }
+ ((StoredJDBCMessage)
storedMessage).store(_connWrapper.getConnection());
+ _storeSizeIncrease += storedMessage.getContentSize();
}
+ catch (SQLException e)
+ {
+ throw new StoreException("Exception on enqueuing
message into message store" + _messageId, e);
+ }
+ });
+ }
+ if(_messagesToEnqueue.isEmpty())
+ {
+ _preCommitActions.add(() -> {
+
AbstractJDBCMessageStore.this.enqueueMessages(_connWrapper, _messagesToEnqueue);
+ _messagesToEnqueue.clear();
Review comment:
I think that `_messagesToEnqueue` can be cleaned in
JBDCTransaction#doPreCommitActions or JBDCTransaction#commit* similar to
`abortTran`. IMHO, that would make code more consistent and cleaner. If special
class for aggregation/accumulation of enqueued messages is introduced, you can
introduce a method to clean up the map and invoke that method from commit/abort
methods.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [Broker-J][JDBC Message Store] Performance regression when increasing the
> number of queues linked to a topic
> ------------------------------------------------------------------------------------------------------------
>
> Key: QPID-8305
> URL: https://issues.apache.org/jira/browse/QPID-8305
> Project: Qpid
> Issue Type: Improvement
> Components: Broker-J
> Affects Versions: qpid-java-broker-7.1.0
> Reporter: Olivier VERMEULEN
> Priority: Major
>
> When sending a message to a topic, if this message is routed to N queues then
> we will do N+2 database inserts: 1 for the metadata, 1 for the content and 1
> for each message/queue mapping (QPID_QUEUE_ENTRIES). The last N inserts could
> be batched in a single operation.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]