franz1981 commented on a change in pull request #2494: ARTEMIS-2224 Reduce
contention on LivePageCacheImpl
URL: https://github.com/apache/activemq-artemis/pull/2494#discussion_r248691840
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/LivePageCacheImpl.java
##########
@@ -16,30 +16,31 @@
*/
package org.apache.activemq.artemis.core.paging.cursor.impl;
-import java.util.LinkedList;
-import java.util.List;
-
import org.apache.activemq.artemis.core.paging.PagedMessage;
import org.apache.activemq.artemis.core.paging.cursor.LivePageCache;
import org.apache.activemq.artemis.core.paging.impl.Page;
import org.apache.activemq.artemis.core.server.LargeServerMessage;
+import
org.apache.activemq.artemis.utils.collections.ConcurrentAppendOnlyChunkedList;
import org.jboss.logging.Logger;
/**
* This is the same as PageCache, however this is for the page that's being
currently written.
*/
-public class LivePageCacheImpl implements LivePageCache {
+public final class LivePageCacheImpl implements LivePageCache {
private static final Logger logger =
Logger.getLogger(LivePageCacheImpl.class);
- private final List<PagedMessage> messages = new LinkedList<>();
+ private static final int CHUNK_SIZE = 32;
Review comment:
@qihongxu This should do the "trick" to improve things when is expected an
heavy usage of paging with small messages and big pages: if you tweak this in a
separate branch (taken from master too) into `CHUNK_SIZE = 64*1024` it would
save many cache misses and it should speedup in a visible way the paged message
queries.
You can give it a try and if it should work we can think to expose it or
just provide an cursor-like implementation instead of a generic query that
would give more hints about which access pattern could be used eg sequential I
suppose. Many thanks for the tests/efforts and intuitions! :+1:
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services