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

Eduard Shangareev commented on IGNITE-3513:
-------------------------------------------

I have implemented all 3 solutions and have written benchmark which calls put 
on a cache. Also, cache was set up by different ExpiryPolicy:
# Every call will return longer duration (will not cause to tll manager call)
# Every call will return shorter duration (will cause to ttl manager call 
almost on every put)
# The same for ~25% of put 
# The same for ~50% of put 
# The same for ~75% of put 

Result for *1* ExpriryPolicy:
|Thread|Sleep|Wait|Park|
|1|95.774 ± 9.485|100.619 ± 3.311|95.328 ± 2.900|
|2|159.367 ± 2.406|156.041 ± 21.609 |146.707 ± 30.226 |
|8|320.103 ± 13.563|363.244 ± 21.972 |304.689 ± 33.815 |
|32|325.425 ± 21.158|338.598 ± 47.244 |293.312 ± 163.217|

Result for *2* ExpriryPolicy:
|Thread|Sleep|Wait|Park|
|1|96.531 ± 6.131 |74.079 ± 11.475|79.409 ± 7.601 |
|2|160.328 ± 4.564 |141.114 ± 17.923|136.221 ± 19.689 |
|8|303.050 ± 87.307 |312.677 ± 12.250 |296.855 ± 33.939 |
|32|331.613 ± 12.203|326.083 ± 43.221 |311.397 ± 54.398 |

Confident intervals are too wide. I will run this benchmark at night.


> Cleanup worker is placed in the Thread's waiting queue using Thread.sleep 
> method
> --------------------------------------------------------------------------------
>
>                 Key: IGNITE-3513
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3513
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Denis Magda
>            Assignee: Eduard Shangareev
>             Fix For: 1.7
>
>
> There is a bug in current implementation of 
> {{GridCacheTtlManager#CleanupWorker}}.
> Refer to the implementation's code snippet and the details below.
> {code}
> EntryWrapper first = pendingEntries.firstx();
>  if (first != null) {
>    long waitTime = first.expireTime - U.currentTimeMillis();
>    if (waitTime > 0)
>       U.sleep(waitTime);
>  }
> {code}
> 1. Put first item with TTL = 1 hour. CleanupWorker will go to sleep for 1 
> hour.
> 2. Put second item with TTL = 1 minute. Since 
> CleanupWorker's thread sleeps now, second item will not be expired at the 
> time.
> NOTE: This scenario is easily to reproducible if first and second items are 
> put into cache asynchronously. If try to put them in same thread one-by-one 
> expiration may work fine.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to