[
https://issues.apache.org/jira/browse/JCS-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15828329#comment-15828329
]
Thomas Vandahl commented on JCS-171:
------------------------------------
This puzzles me. I changed the test code so that each iteration runs in its own
thread to get more concurrency into the game.
The current trunk (r1778933) gives me the following results:
jcs-pooled.properties 8
thread_pool.disk_cache_event_queue.boundarySize=2000
thread_pool.disk_cache_event_queue.useBoundary=true
thread_pool.disk_cache_event_queue.maximumPoolSize=8
thread_pool.disk_cache_event_queue.minimumPoolSize=8
thread_pool.disk_cache_event_queue.keepAliveTime=3500
thread_pool.disk_cache_event_queue.startUpSize=8
thread_pool.disk_cache_event_queue.whenBlockedPolicy=RUN
Caches 8 Iteration 2 get time for 10000000 elements is: 74469
Caches 8 Iteration 1 get time for 10000000 elements is: 74841
Caches 8 Iteration 3 get time for 10000000 elements is: 75393
Caches 8 Iteration 0 get time for 10000000 elements is: 76315
Caches 8 Iteration 4 get time for 10000000 elements is: 76535
jcs-single.properties 8
Caches 8 Iteration 1 get time for 10000000 elements is: 27045
Caches 8 Iteration 3 get time for 10000000 elements is: 27854
Caches 8 Iteration 2 get time for 10000000 elements is: 30291
Caches 8 Iteration 4 get time for 10000000 elements is: 31480
Caches 8 Iteration 0 get time for 10000000 elements is: 33592
So the single queue (which is now basically a ThreadPoolExecutor with a single
thread) is almost three times as fast as the pooled one.
The only difference I see is that the pooled executor uses a bounded queue. If
I remove the boundary, however, I get OOMs.
Any idea why this happens?
> Multiple CacheEventQueue.QProcessor spawned for the same cache region
> ---------------------------------------------------------------------
>
> Key: JCS-171
> URL: https://issues.apache.org/jira/browse/JCS-171
> Project: Commons JCS
> Issue Type: Bug
> Components: Composite Cache
> Affects Versions: jcs-2.0
> Reporter: Wiktor N
> Assignee: Thomas Vandahl
> Fix For: jcs-2.1
>
> Attachments: CacheEventQueue.patch, jcs-perf-test.zip
>
>
> I noticed that running on new version of JCS I get multiple
> CacheEventQueue.QProcessor thread. They spawn from time to time.
> I've checked recent changes and changes few things in r1774925 look
> suspicious:
> 1. In previous code we spawned a new thread in synchronized section. This got
> us a guarantee, that there will be no two threads trying to spawn a new
> thread in the same time. Maybe some locking is needed around thread creation?
> 2. QProcessor uses isAlive() method. But this is defined by Thread.isAlive()
> while it should probably check for CacheEventQueue.this.isAlive()
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)