Closed JonasKellerer closed 1 month ago
As discussed: maintainers should be able to turn off the cache, or set the size of the cache.
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.
I will now adopt the documentation accordingly.
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 |
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
- [ ] The implemented feature is covered by an appropriate test.