GenSpectrum / LAPIS

An API, a query engine, and a database schema for genomic sequences; currently with a focus on SARS-CoV-2
https://lapis-three.vercel.app
GNU Affero General Public License v3.0
19 stars 5 forks source link

812 outofmemoryerror causes lapis to stop working without crashing #849

Closed JonasKellerer closed 1 month ago

JonasKellerer commented 1 month ago

resolves #812

This adds the possibility to specify the size of the cache. Thus, maintainers have the possibility to set the size appropriate for the machine they are using. If the cache limit is reached, it will remove the oldest entry.

As you see, it calculates the weight of the request by determining the size in bytes. I'm currently not sure if this has any performance implications (casting to string and then to byteArray).

I tested it locally with a smaller cache size. However, automatic tests are not possible, since we do not provide the info if the request was cached or not to the user. Do we want to?

What are good defaults for the cache size, or do we just leave them out?

Another option would be to use redis. But this would need some setup. How do we cant to proceed?

PR Checklist

JonasKellerer commented 1 month ago

As discussed: maintainers should be able to turn off the cache, or set the size of the cache.

JonasKellerer commented 1 month ago

This PR now changed in its implementation: we now use soft references to store the cache values. The garbage collector should now be possible to clear the cache, if memory is needed. The cache size increases to the the heap size. So the maintainer should provide a limit. When running LAPIS in docker the JVM option -XX:+UseContainerSupport should suffice to limit the heap size to the available RAM of the docker container.

JonasKellerer commented 1 month ago

I will now adopt the documentation accordingly.

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lapis ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2024 4:38pm
github-actions[bot] commented 1 month ago

This is a preview of the changelog of the next release:

0.2.6 (2024-07-16)

Features