Skip to content

History is hogging web app memory #3541

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

Open
vladak opened this issue Apr 14, 2021 · 3 comments
Open

History is hogging web app memory #3541

vladak opened this issue Apr 14, 2021 · 3 comments
Labels
bug webapp web application

Comments

@vladak
Copy link
Member

vladak commented Apr 14, 2021

When thinking about #3243, I came to realize that the web app suffers from similar problem: in general whenever a history is requested, the History object representing the complete history of given file/directory is loaded into memory:

File file = cfg.getResourceFile(primePath);
History hist;
try {
hist = HistoryGuru.getInstance().getHistoryUI(file);

What's more, it is actually stored in the request:
request.setAttribute("history.jsp-hist", hist);

and used for paging.

Even for smaller repositories such as the OpenGrok Git repository this creates significant memory pressure. Here's a graph representing heap stats from a web app where I displayed history for couple of directories (including the top level directory) for indexed OpenGrok Git repository:
webapp-history

The Eden space grew by bunch of gigabytes !

@vladak vladak added bug webapp web application labels Apr 14, 2021
@vladak vladak changed the title History History is hogging web app memory Apr 14, 2021
@vladak
Copy link
Member Author

vladak commented Apr 20, 2021

The way how the History object is stored in FileHistoryCache makes it hard to do something about this. Firstly, it is compressed, secondly it is XML serialized Java object (#3539). So it has to be read whole into memory and then dissected.

@vladak
Copy link
Member Author

vladak commented Nov 26, 2022

Related to #3539 and #4023

@vladak
Copy link
Member Author

vladak commented Apr 11, 2023

Once a scheme to iterate over history (for both repository method and history cache) without reading all of it in memory is in place, the HistoryReader used during indexing should be converted to this scheme as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug webapp web application
Projects
None yet
Development

No branches or pull requests

1 participant