首页 > 解决方案 > Hazelcast Client Memory Leak

问题描述

We have Spring Boot 2.0.4 application. We use distributed Hazelcast 3.11 cache. In our application we configured HazelcastClient which connects to a Hazelcast server in Docker container.

In cache we store different "persons" in one map and the same "persons" but as a list in another (~900 persons in one list by one key; these persons in both maps are not the same for 100%, they both describe the person in real life but the last one in the list have less properties.). All the maps are of BINARY type.

When we made stress tests to get person by random id from the cache (1st map), everything went excellent. 5000 concurrent requests didn't influence our application HEAP at all, 10000 - slightly. In JSON format one person details has the size of 10kB.

When we made stress tests to get the list of persons from the cache (2nd map) we faced problems with the HEAP of our application where the client is configured. We made just 500 concurrent requests and the HEAP grew to 4Gb size! In JSON format the list has the size of 800kB. It is stored in the 2nd map and was requested by the same key 500 times.

Does anybody know what is going on?

DTO

Controller

Method of a Facade which is retrieved from the Controller, and where caching takes place via @Cacheable annotation

HazelcastInstance configuration

hazelcast.xml configuration for the server side

500 concurrent requests (3 times in a row)

Heap, Classes

UPDATED:

I made 500 concurrent requests sequentially 23 times. Below we can see the final minutes of the test.

Telemetries Overview

标签: memoryclienthazelcast

解决方案


@Nicolay,如果我错了,请纠正我:

  • 第二张地图包含人员列表,约 900 人,作为条目。您提到每个人约为 10KB,因此第二张地图中的每个条目约为 9MB,即使您说它是 Json 格式的 800KB。您能否通过 Hazelcast 检查第二张地图中条目的大小。喜欢:client.getMap(map_name).getEntryView(key).getCost()。这将为您提供以字节为单位的入口内存成本。

  • 500 个并发请求,如果每个条目约为 9MB,则需要 4.5GB 额外堆,这与您观察到的相符。

通过查看数字,一切似乎都很好,除了 Json 大小为 800KB。

你能检查那些数字吗?


推荐阅读