Hi Dan,
We forget to mention that we actually configure off-heap for the
regions, so cache entry values are stored outside the heap memory. Only
Oplog objects that are not compacted and that have .crf file are
referencing the live entries from the cache. These Oplog objects are not
stored in onlyDrfOplogs hashmap. In onlyDrfOplogs map are only Oplog
objects that are representing orphaned .drf files (the one without
accompanying .crf and .krf file). These objects have been compacted and
doesn't contain a reference to any live entry from the cache. All of
these 18G is actually occupied by empty pendingKrfTags hashmaps.
In this case there are 7680 Oplog objects stored in onlyDrfOplogs. Every
Oplog object has it's own regionMap hashmap. Every regionMap can contain
hundreds of empty pendingKrfTags hashMaps. When you bring all that
together you get more then 18G of unnecessary heap memory.
Thank you all for quick review of PR and fast response to our questions!
BRs/Jakov
On 02. 12. 2021. 00:25, Dan Smith wrote:
Interesting. It does look like that pendingKrfTags structure is
wasting memory.
I think that retained heap of 20 gigabytes might include your entire
cache, because those objects have references back to the Cache object.
However with 6K oplogs each having an empty map with 4K elements that
does add up.
-Dan
------------------------------------------------------------------------
*From:* Jakov Varenina <jakov.varen...@est.tech>
*Sent:* Tuesday, November 30, 2021 5:53 AM
*To:* dev@geode.apache.org <dev@geode.apache.org>
*Subject:* Re: Question related to orphaned .drf files in disk-store
Hi Dan and all,
Just to provide you the additional picture that better represents the
severity of the problem with pendingKrfsTag. So when after you check
the second picture in below mail, then please come back and check this
one also. Here you can see that the pendingKerfTags is empty and has
capacity of 9,192 allocated in memory.
Sorry for any inconvenience.
BRs/Jakov
On 30. 11. 2021. 09:32, Jakov Varenina wrote:
Hi Dan,
Thank you for your answer!
We have identify memory leak in Oplog objects that are representing
orphaned .drf files in heap memory. In below screenshoot you can see
that 7680 onlyDrfOplogs consume more than 18 GB of heap which doesn't
seem correct.
In below picture you can see that the
drfOnlyPlog.Oplog.regionMap.pendingKrfTgs structure is responsible
for more then 95% of drfOnlyOplogs heap memory.
The pendingKrfTags structure is actually empty (although it consumes
memory because it was used previously and the size of the HashMap was
not reduced) and not used by the onlyDrfOplogs objects. Additionally,
the regionMap.liveEntries linked list has just one element (fake disk
entry OlogDiskEntry indicating that it is empty) and it is also not
used. You can find more details why pedingKrfTags sturcture remianed
in memory for Oplog object representing orphaned .drf file and
possible solution in the following ticket and the PR:
https://issues.apache.org/jira/browse/GEODE-9854
<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fissues.apache.org%2Fjira%2Fbrowse%2FGEODE-9854&data=04%7C01%7Cdasmith%40vmware.com%7Cb7d1039e109443468fb508d9b408cd8f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637738772194842172%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=6Vulpvvh4LsjagU7julIxqYp5%2F%2FkIBzcOikG8jrOKWc%3D&reserved=0>
https://github.com/apache/geode/pull/7145
<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode%2Fpull%2F7145&data=04%7C01%7Cdasmith%40vmware.com%7Cb7d1039e109443468fb508d9b408cd8f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637738772194852171%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=nA%2FNGaOEg1sR8yYpRUHkhfupciFhhMfwiPyhGv%2BSHnw%3D&reserved=0>
BRs/Jakov
On 24. 11. 2021. 23:12, Dan Smith wrote:
The .drf file contains destroy records for entries in any older
oplog. So even if the corresponding .crf file has been deleted, the
.drf file with the same number still needs to be retained until the
older .crf files are all deleted.
7680 does seem like a lot of oplogs. That data structure is just
references to the files themselves, I don't think we are keeping the
contents of the .drf files in memory, except during recovery time.
-Dan
------------------------------------------------------------------------
*From:* Jakov Varenina <jakov.varen...@est.tech>
<mailto:jakov.varen...@est.tech>
*Sent:* Wednesday, November 24, 2021 11:13 AM
*To:* dev@geode.apache.org <mailto:dev@geode.apache.org>
<dev@geode.apache.org> <mailto:dev@geode.apache.org>
*Subject:* Question related to orphaned .drf files in disk-store
Hi devs,
We have noticed that disk-store folder can contain orphaned .drf
files (only .drf file without accompanying .crf and .krf file with
the same id). Also, we have noticed that these "orphaned" .drf are
stored in heap (drfOnlyOplogs hash map with size 7680 in below picture):
Could you please tell us why do geode after compaction sometimes
only keep .drf and deletes the .crf and .krf files? Why do geode
need those orphaned .drf files?
BRs/Jakov