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

Shared Chunk Cache for all DatasetArrays, CacheWeight for AlfuCache #7067

Merged
merged 12 commits into from
Jun 14, 2023

Conversation

fm3
Copy link
Member

@fm3 fm3 commented May 10, 2023

  • The cache for remote dataset array contents can now have a configured size in bytes. New config option datastore.cache.imageArrayChunks.maxSizeBytes. Default is 2 GB, consider increasing for production.
  • For this, one cache object is shared between the dataset arrays
  • Switches from akka cache to Caffeine directly (akka uses caffeine internally as well), allowing to add cache item weighing (weight is now set to bytes per chunk for array chunks)
  • Unified some caching usages / naming (no more distinction between AlfuCache and AlfuFoxCache)

TODO

  • use shared cache also in Precomputed + Neuroglacner classes
  • include vault path in cache key
  • how to clear cache for individual datasets?
  • null pointer exception for loading volume annotation buckets

URL of deployed dev instance (used for testing):

Steps to test:

  • Load some datasets, should still show
  • annotate some, should still show
  • use reload button and look for logging (cache chunks should be removed, but only for the reloaded layer)

Issues:


@fm3 fm3 self-assigned this May 10, 2023
@fm3 fm3 marked this pull request as ready for review June 12, 2023 14:34
@fm3 fm3 requested a review from frcroth June 12, 2023 14:45
Copy link
Member

@frcroth frcroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also change PR name?

CHANGELOG.unreleased.md Outdated Show resolved Hide resolved

bucketProviderCache.clear(bucketProviderPredicate)

def chunkContentsPredicate(key: String): Boolean =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not totally happy with this being placed here, since the definition of the key is somewhere else. Maybe move this predicate to where the key is defined and only use it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yes I see what you mean. However, the same would be the case for the other two predicate functions here. So we could either extract each of those so that there is only one place for each cache, where cache key building happens. This would lead to less distributed knowledge on how the keys work. However, I also like all of these methods being together here, since it is less distributed knowledge about the fact that these caches should be cleared dataset-wise or layer-wise. So it’s some fragmentation either way. If you’re ok with it, I’d leave it as it is for the moment.

@fm3 fm3 requested a review from frcroth June 13, 2023 08:22
@fm3 fm3 changed the title CacheWeight for AlfuCache Shared Chunk Cache for all DatasetArrays, CacheWeight for AlfuCache Jun 14, 2023
@fm3 fm3 merged commit b91b15f into master Jun 14, 2023
2 checks passed
@fm3 fm3 deleted the cache-weight branch June 14, 2023 11:07
hotzenklotz added a commit that referenced this pull request Jun 20, 2023
…esign-right-sidebar

* 'master' of github.com:scalableminds/webknossos:
  added Youtube videos to docs
  Log dataset uploads (with no conversion) to slack (#7157)
  Added "Automation Tutorial" to docs (#7160)
  fix logo image in README.md
  Second try for “Async IO for HttpsDataVault, Fox Error Handling” (#7155)
  Revert "Async IO for HttpsDataVault, Fox Error Handling (#7137)" (#7154)
  Async IO for HttpsDataVault, Fox Error Handling (#7137)
  Fix vault path for precomputed datasets (#7151)
  Add extended keyboard shortcut mode via ctrl + k for tool shortcuts (#7112)
  Shared Chunk Cache for all DatasetArrays, CacheWeight for AlfuCache (#7067)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Share chunkContents cache across multiple arrays
2 participants