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

Bloop off-heap memory usage #2041

Open
q-benwillis opened this issue Apr 26, 2023 · 4 comments
Open

Bloop off-heap memory usage #2041

q-benwillis opened this issue Apr 26, 2023 · 4 comments

Comments

@q-benwillis
Copy link

We're using Bloop as a build server for a shared UI based application to compile generated code on the fly for multiple users. We've found that as the number of workspaces in Bloop increases we run in to memory issues.

Bloop is running in its own container with 4GB of memory. We've set the maximum heap size for the Bloop JVM to 3GB leaving what we think should be pleanty of space for any off-heap requirements. Unfortuntaly we're seeing memory usage rise above the 4GB limit which leads to the container being killed and restarted. The main thing we've noticed is that the off-heap memory is never garbage collected so seems to grow until it exceeds the limit and gets killed.

We've tried using the cleanCache request to free up memory but that just seems to delete the class files rather than freeing up any of the used memory.

We have a couple of questions around this:

  • What could Bloop be using this off-heap memory for and how can we limit it?
  • Has anyone else deployed Bloop in a containerized environment in this manner?
@tgodzik
Copy link
Contributor

tgodzik commented Apr 26, 2023

Thanks for reporting! I think the off-heap memory is used by the compiler. It needs to load classfiles etc. which is neccessary for the compilation. I've noticed that it can grow quite heavily for Bloop since it has to deal with a lot of jars. I am not sure if we can make it use it less or GC that.

I wonder if setting -XX:MaxPermSize would limit the memory usage?

@tgodzik
Copy link
Contributor

tgodzik commented Apr 26, 2023

Or maybe I was suggested that setting MaxMetaspaceSize might help in your case.

@q-benwillis
Copy link
Author

Gave MaxMetaspaceSize a go (set it to 256MB) but didn't seem to help. Interesting that you mentioned the compiler using using the off-heap memory. I guess I would have expected the resources to be have freed up once the compilation was completed but seems they are not.

Having read the docs I noticed that there were some recommendations on setting the max heap size. You mentioned that you had also seen the off-heap grow quite heavily for Bloop, do you have a rough idea of how it grew vs the allocated heap? Perhaps we just need to allow for more off heap-usage.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 28, 2023

It's hard to say with your specific usage, we usually use it locally and we could limit Bloop heap to even 1 GB without issues. 🤔 From what I understand, that off heap usage should also be freed at some point.

Probably the best scenario would be to profile the memory usage and see which parameter causes it to go out of ram. Or alternatively, limit the heap to 2 GB, maybe that will be enough.

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

No branches or pull requests

2 participants