commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wiktor N (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCS-171) Multiple CacheEventQueue.QProcessor spawned for the same cache region
Date Tue, 10 Jan 2017 22:50:58 GMT

    [ https://issues.apache.org/jira/browse/JCS-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15816431#comment-15816431
] 

Wiktor N commented on JCS-171:
------------------------------

Ok, I've done some performance tests and I've been proven partly wrong.

See attached code for the tests I was doing. Properties files defines the cache attributes
for all the test cases. The tests were done on 4 core machine.

First observation - in SINGLE mode I got OutOfMemoryException and didn't got any numbers,
no matter if I used release version or built from source.

Second observation - in what I was proposing (jcs-pooled-single-thread-per-region.properties
more less - sets the behaviour I described) if number of cache regions is smaller than the
number of cores - I get the best performance, but once the number of caches reach the number
of cores, I get worse performance than in standard thread pool mode (if the number of threads
in thread pool is at least the number of cores).

Third observation - with one thread pool handling all cache regions I see most stable results,
provided that the number of threads in pool is at least as large as the number of cores. Though
it comes with penalty at the low number of cache regions.

Please, double check my configuration, maybe there is some issue in the way I designed the
tests. I decided to use: whenBlockedPolicy=RUN, as it give back-off signal to the calling
thread and not causing OOM, as it happens for SINGLE mode.

Looks like POOLED mode is the best default we can have.

Raw numbers are below:
/jcs-pooled-default-t1.properties 1
Caches 1 Iteration 0 get time for 10000000 elements is: 8176
Caches 1 Iteration 1 get time for 10000000 elements is: 7588
Caches 1 Iteration 2 get time for 10000000 elements is: 7580
Caches 1 Iteration 3 get time for 10000000 elements is: 7753
Caches 1 Iteration 4 get time for 10000000 elements is: 7605
/jcs-pooled-default-t1.properties 2
Caches 2 Iteration 0 get time for 10000000 elements is: 29547
Caches 2 Iteration 1 get time for 10000000 elements is: 28697
Caches 2 Iteration 2 get time for 10000000 elements is: 29601
Caches 2 Iteration 3 get time for 10000000 elements is: 29490
Caches 2 Iteration 4 get time for 10000000 elements is: 29767
/jcs-pooled-default-t1.properties 4
Caches 4 Iteration 0 get time for 10000000 elements is: 44588
Caches 4 Iteration 1 get time for 10000000 elements is: 44458
Caches 4 Iteration 2 get time for 10000000 elements is: 44434
Caches 4 Iteration 3 get time for 10000000 elements is: 44777
Caches 4 Iteration 4 get time for 10000000 elements is: 45079
/jcs-pooled-default-t1.properties 8
Caches 8 Iteration 0 get time for 10000000 elements is: 44354
Caches 8 Iteration 1 get time for 10000000 elements is: 43953
Caches 8 Iteration 2 get time for 10000000 elements is: 43363
Caches 8 Iteration 3 get time for 10000000 elements is: 43384
Caches 8 Iteration 4 get time for 10000000 elements is: 44123

/jcs-pooled-default-t2.properties 1
Caches 1 Iteration 0 get time for 10000000 elements is: 11365
Caches 1 Iteration 1 get time for 10000000 elements is: 10203
Caches 1 Iteration 2 get time for 10000000 elements is: 10167
Caches 1 Iteration 3 get time for 10000000 elements is: 10168
Caches 1 Iteration 4 get time for 10000000 elements is: 9971
/jcs-pooled-default-t2.properties 2
Caches 2 Iteration 0 get time for 10000000 elements is: 10619
Caches 2 Iteration 1 get time for 10000000 elements is: 9984
Caches 2 Iteration 2 get time for 10000000 elements is: 9851
Caches 2 Iteration 3 get time for 10000000 elements is: 9841
Caches 2 Iteration 4 get time for 10000000 elements is: 9868
/jcs-pooled-default-t2.properties 4
Caches 4 Iteration 0 get time for 10000000 elements is: 22038
Caches 4 Iteration 1 get time for 10000000 elements is: 20679
Caches 4 Iteration 2 get time for 10000000 elements is: 20453
Caches 4 Iteration 3 get time for 10000000 elements is: 20366
Caches 4 Iteration 4 get time for 10000000 elements is: 20365
/jcs-pooled-default-t2.properties 8
Caches 8 Iteration 0 get time for 10000000 elements is: 29365
Caches 8 Iteration 1 get time for 10000000 elements is: 28466
Caches 8 Iteration 2 get time for 10000000 elements is: 28275
Caches 8 Iteration 3 get time for 10000000 elements is: 28332
Caches 8 Iteration 4 get time for 10000000 elements is: 28326

/jcs-pooled-default-t4.properties 1
Caches 1 Iteration 0 get time for 10000000 elements is: 12338
Caches 1 Iteration 1 get time for 10000000 elements is: 11227
Caches 1 Iteration 2 get time for 10000000 elements is: 10786
Caches 1 Iteration 3 get time for 10000000 elements is: 10650
Caches 1 Iteration 4 get time for 10000000 elements is: 11512
/jcs-pooled-default-t4.properties 2
Caches 2 Iteration 0 get time for 10000000 elements is: 10727
Caches 2 Iteration 1 get time for 10000000 elements is: 10325
Caches 2 Iteration 2 get time for 10000000 elements is: 10079
Caches 2 Iteration 3 get time for 10000000 elements is: 10103
Caches 2 Iteration 4 get time for 10000000 elements is: 10123
/jcs-pooled-default-t4.properties 4
Caches 4 Iteration 0 get time for 10000000 elements is: 14002
Caches 4 Iteration 1 get time for 10000000 elements is: 13832
Caches 4 Iteration 2 get time for 10000000 elements is: 12877
Caches 4 Iteration 3 get time for 10000000 elements is: 12693
Caches 4 Iteration 4 get time for 10000000 elements is: 12657
/jcs-pooled-default-t4.properties 8
Caches 8 Iteration 0 get time for 10000000 elements is: 17082
Caches 8 Iteration 1 get time for 10000000 elements is: 16527
Caches 8 Iteration 2 get time for 10000000 elements is: 16349
Caches 8 Iteration 3 get time for 10000000 elements is: 16387
Caches 8 Iteration 4 get time for 10000000 elements is: 16405

/jcs-pooled-default-t8.properties 1
Caches 1 Iteration 0 get time for 10000000 elements is: 15833
Caches 1 Iteration 1 get time for 10000000 elements is: 15711
Caches 1 Iteration 2 get time for 10000000 elements is: 15358
Caches 1 Iteration 3 get time for 10000000 elements is: 15302
Caches 1 Iteration 4 get time for 10000000 elements is: 15391
/jcs-pooled-default-t8.properties 2
Caches 2 Iteration 0 get time for 10000000 elements is: 11009
Caches 2 Iteration 1 get time for 10000000 elements is: 10384
Caches 2 Iteration 2 get time for 10000000 elements is: 10304
Caches 2 Iteration 3 get time for 10000000 elements is: 10252
Caches 2 Iteration 4 get time for 10000000 elements is: 10239
/jcs-pooled-default-t8.properties 4
Caches 4 Iteration 0 get time for 10000000 elements is: 13161
Caches 4 Iteration 1 get time for 10000000 elements is: 12344
Caches 4 Iteration 2 get time for 10000000 elements is: 12210
Caches 4 Iteration 3 get time for 10000000 elements is: 12422
Caches 4 Iteration 4 get time for 10000000 elements is: 12150
/jcs-pooled-default-t8.properties 8
Caches 8 Iteration 0 get time for 10000000 elements is: 17445
Caches 8 Iteration 1 get time for 10000000 elements is: 16779
Caches 8 Iteration 2 get time for 10000000 elements is: 16627
Caches 8 Iteration 3 get time for 10000000 elements is: 16471
Caches 8 Iteration 4 get time for 10000000 elements is: 16515

/jcs-pooled-single-thread-per-region.properties 1
Caches 1 Iteration 0 get time for 10000000 elements is: 8206
Caches 1 Iteration 1 get time for 10000000 elements is: 8365
Caches 1 Iteration 2 get time for 10000000 elements is: 7843
Caches 1 Iteration 3 get time for 10000000 elements is: 7668
Caches 1 Iteration 4 get time for 10000000 elements is: 7727
/jcs-pooled-single-thread-per-region.properties 2
Caches 2 Iteration 0 get time for 10000000 elements is: 7231
Caches 2 Iteration 1 get time for 10000000 elements is: 6761
Caches 2 Iteration 2 get time for 10000000 elements is: 6652
Caches 2 Iteration 3 get time for 10000000 elements is: 6720
Caches 2 Iteration 4 get time for 10000000 elements is: 6686
/jcs-pooled-single-thread-per-region.properties 2
Caches 3 Iteration 0 get time for 10000000 elements is: 6874
Caches 3 Iteration 1 get time for 10000000 elements is: 6233
Caches 3 Iteration 2 get time for 10000000 elements is: 6022
Caches 3 Iteration 3 get time for 10000000 elements is: 6015
Caches 3 Iteration 4 get time for 10000000 elements is: 6096
/jcs-pooled-single-thread-per-region.properties 4
Caches 4 Iteration 0 get time for 10000000 elements is: 19805
Caches 4 Iteration 1 get time for 10000000 elements is: 20561
Caches 4 Iteration 2 get time for 10000000 elements is: 18067
Caches 4 Iteration 3 get time for 10000000 elements is: 15940
Caches 4 Iteration 4 get time for 10000000 elements is: 16183
/jcs-pooled-single-thread-per-region.properties 8
Caches 8 Iteration 0 get time for 10000000 elements is: 28992
Caches 8 Iteration 1 get time for 10000000 elements is: 28030
Caches 8 Iteration 2 get time for 10000000 elements is: 27631
Caches 8 Iteration 3 get time for 10000000 elements is: 26363
Caches 8 Iteration 4 get time for 10000000 elements is: 27845


> 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
>
>
> 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)

Mime
View raw message