OHDSI / WebAPI

OHDSI WebAPI contains all OHDSI services that can be called from OHDSI applications
Apache License 2.0
130 stars 169 forks source link

Implement Caching for Permissions and asset lists #2383

Open chrisknoll opened 3 months ago

chrisknoll commented 3 months ago

Expected behavior

We should be able to leverage a cache to improve application performance.

Actual behavior

When fetching permissions or asset lists (Cohort Defs, Concept sets, etc), a DB fetch is required which can impact performance.

Steps to reproduce behavior

  1. Access any endpoint that leads to a JPA request.
  2. Observe the database is accessed.

Implementation Notes

We intially had JCache implemented with a ehCache backend but this was removed because the initial implementation was applied to fetching record counts for vocabulary searching, and the search-semantics that we developed using JPA allowed to load ranges of value into the cache and search for a list of numbers from the cache.

However, this caching approach isn't as robust as using a caching framework where you can specify things like expiry, storage tiers, clustering cachings, cache write-through and statistics.

This issue sets the goal to re-introduce JCache, and provide an initial implementation to improve performance by caching results.