Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve citation cache memory efficiency #211

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

JCRPaquin
Copy link
Contributor

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.

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.

None yet

1 participant