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

Aleksey Plekhanov commented on IGNITE-11857:
--------------------------------------------

[~ascherbakov], 

If we get rid of {{Item}} class, there will be a new {{Long}} object created 
each time we merge sequence with previous. With {{Item}} class we can just add 
delta to the old object. Sorted array of primitive tuples will get a drop on 
remove/add items to the middle of the array. Bitmaps in some cases will consume 
too much memory, the amount of memory depends on the difference between LWM and 
HWM (instead of a count of gaps). Also, I'm not sure about the performance 
boost in case of bitmaps usage. The current implementation is less risky, we 
can't get drop on some unpredictable place.

New solution use less heap. There is no {{tailSet}} and {{headSet}} methods 
usage. These methods allocate new objects for new {{Set}}s.

I've test heap allocation using this code:
{code:java}
JmhPartitionUpdateCounterBenchmark benchmark = new 
JmhPartitionUpdateCounterBenchmark();

benchmark.setup();

ThreadMXBean bean = (ThreadMXBean)ManagementFactory.getThreadMXBean();

long allocated0 = bean.getThreadAllocatedBytes(Thread.currentThread().getId());

for (int i = 0; i < 100_000; i++)
    benchmark.updateWithGap();

long allocated1 = bean.getThreadAllocatedBytes(Thread.currentThread().getId());

System.out.println("Memory allocated: " + (allocated1 - allocated0));
{code}
Results:

Old implementation: 25 181 680 bytes

New implementation: 11 828 272 bytes

 

> Investigate performance drop after IGNITE-10078
> -----------------------------------------------
>
>                 Key: IGNITE-11857
>                 URL: https://issues.apache.org/jira/browse/IGNITE-11857
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Alexei Scherbakov
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>         Attachments: ignite-config.xml, 
> run.properties.tx-optimistic-put-b-backup
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> After IGNITE-10078 yardstick tests show performance drop up to 8% in some 
> scenarios:
> * tx-optim-repRead-put-get
> * tx-optimistic-put
> * tx-putAll
> Partially this is due new update counter implementation, but not only. 
> Investigation is required.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to