Hi All
We have got a problem with growing off-heap on each sync data.
*Precondition *
We have ignite in memory cache. with key Integer and value Contact
Each hour we sync full data in cache via api cache.put(key, value); (cache
full load)
Also we have increment update via the api cache.put(key, value); (streaming)
Data:
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
private class Contact {
private int id;
private Map<String, <b>BinaryObject*> customFields;
}
@Data
private class CustomInfo {
private Date updateTime;
private boolean deleted;
}
/if we do not use BinaryObject in Contact all works as expected./
*Problem*
Off-heap memory allocate time to time for the same key new memory pages.
As a result, memory is constantly growing, but the data size is not
increasing.
If we stop ignite and load data again off-heap has normal size.
Example to reproduce problem
@Test
public void testStreamAndUpdateContact() {
HashMap<String, BinaryObject> baseCustomFields = new HashMap<>();
baseCustomFields.put("customX",
ignite.binary().builder(CustomInfo.class.getName()).build());
baseCustomFields.put("customY",
ignite.binary().builder(CustomInfo.class.getName()).build());
baseCustomFields.put("customY1",
ignite.binary().builder(CustomInfo.class.getName()).build());
baseCustomFields.put("customY2",
ignite.binary().builder(CustomInfo.class.getName()).build());
baseCustomFields.put("customY3",
ignite.binary().builder(CustomInfo.class.getName()).build());
{
CacheConfiguration<Integer, Contact> cfg = new
CacheConfiguration<>("contactsEx");
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
IgniteCache<Integer, Contact> cache =
ignite.getOrCreateCache(cfg);
}
for (int z = 0; z < 50_000; z++) {
//Fill base contacts
{
IgniteCache<Integer, Contact> cache =
ignite.getOrCreateCache("contactsEx");
IntStream.range(0, 10_000).forEach(counter -> {
Lock lock = cache.lock(counter);
lock.lock();
try {
cache.put(counter,
Contact.builder()
.id(counter)
.customFields(baseCustomFields)
.build());
} finally {
lock.unlock();
}
});
}
//////events
ExecutorService executorService =
Executors.newSingleThreadExecutor();
executorService.execute(() -> {
{
IgniteCache<Integer, Contact> cache =
ignite.getOrCreateCache("contactsEx");
IntStream.range(0, 10_000).forEach(counter -> {
Lock lock = cache.lock(counter);
lock.lock();
try {
Contact c = cache.get(counter);
Map<String, BinaryObject> customFields =
c.getCustomFields();
customFields.put("customY", ignite.binary()
.builder(CustomInfo.class.getName()).setField("updateTime", new Date())
.build());
cache.put(counter, c);
} finally {
lock.unlock();
}
});
}
executorService.shutdown();
});
}
}
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/