IQSS / IQSS/dataverse

Feature Request: Enhance Dataverse Caching for Dataset Version Summary

Open
#11,625 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

GREI Re-arch Original size: 80 Size: 10 SPA SPA.Q2 Type: Feature
Dominant language
Java
Stars
1.1k
Forks
564
Avg merge
2d 2h
Merged PRs (30d)
29

Description

In order to speed up the getting of Dataset Version Differences/Summary a cache will be used.

Also see https://github.com/IQSS/dataverse/issues/11503 for information regarding this ask.

Currently we have a CacheManager that handles the rate limiting data. This manager can be extended to cache json responses and store them in the Postgres database.

Some steps that need to be accomplished are:

  1. create a table in the database to hold the json responses.
    CREATE IF NOT EXISTS UNLOGGED TABLE cache (
    id SERIAL PRIMARY KEY,
    key TEXT UNIQUE NOT NULL,
    value JSONB,
    created_at_utc TIMESTAMP DEFAULT CURRENT_TIMESTAMP);

CREATE IF NOT EXISTS INDEX idx_cache_key ON cache (key);

  1. Modify the CacheFactoryBean to include the json response cache (in memory as well as persisted in Postgres)
  2. Define the key used to lookup the cache. User permission will determine what data is included in the response but the individual user id is not to be part of the key. The key needs to be limited so any user making this request will see the response that that would otherwise match the response based on their permissions.
  3. Create feature flag or setting to enable/disable cache. Allow for future caching by having one setting that defines various caches (similar to the rate limiting setting). Could include cache size, TTL, enable/disable.
  4. Invalidate the cache. Any update to the Dataset would need to invalid the cache.
  5. Evict from the cache. To keep the size of the cache "small" any data in the cache (db) that hasn't been accessed in a configurable amount of time should be deleted. In memory cache would be wiped out when the app restarts but also could be configured to be "trimmed" at a time interval or cache size limit.
  6. Cache retrieval. Goes without saying, if cached in memory return it, if not, check db and if found return that. If not in memory or in db perform the actual code to generate the json and if caching enabled save json to memory and db.

The current need is for Dataset Version Differences/Summary which can take a significant amount of time to generate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing CacheManager and CacheFactoryBean, then trace the Dataset Version Differences/Summary generation flow and review issue 11503. Done means the requested JSON responses can be cached in memory and PostgreSQL with configurable keys, enablement, eviction, retrieval, and invalidation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
backend, databases, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.