Skip to content

Improve citation cache memory efficiency#211

Draft
JCRPaquin wants to merge 10 commits intomainfrom
jcrpaquin/bug/oom-citation-cache
Draft

Improve citation cache memory efficiency#211
JCRPaquin wants to merge 10 commits intomainfrom
jcrpaquin/bug/oom-citation-cache

Conversation

@JCRPaquin
Copy link
Member

Background

The citation "cache" functions as an in-memory graph containing all documents as nodes and citations/references as edges. It's used to speed up second order operators that rely on graph information.

Recently, we've been running into out of memory errors: the total citation graph for ~22 million documents was roughly 5GB in size. The graph is also duplicated in memory when the cache is being warmed by another Solr searcher, which can cause the graph to take >10GB of the 24GB allocated to Solr.

A decent amount of this space goes to "boxing" primitive values: when you box a primitive value, it's wrapped inside another object (the "box"). Each wrapper takes 2-4 bytes of memory, which can be substantial over 20 million values.

Purpose

This PR reduces the size of the citation graph by using specialized primitive type collections that don't require boxing.

It also reduces the size of the graph by using maps instead of arrays to store relationships; previously we kept an array of size N, half of whose entries were null.

@JCRPaquin JCRPaquin marked this pull request as draft August 12, 2024 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant