Altinn / app-lib-dotnet

Libraries used in Altinn Apps
BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

Caching across pods for Altinn Apps #170

Open acn-sbuad opened 3 years ago

acn-sbuad commented 3 years ago

Description

Currently, we do not have support for caching data across pods for an app. If autoscaling is introduces or replica count is inreaced we can have multiple instances of an app running in the cluster. how can we support caching across multiple instances of an app?

In scope

What's in scope of this analysis?

Lorem ipsum

Out of scope

What's out of scope for this analysis?

Lorem ipsum

Constraints

Constraints or requirements (technical or functional) that affects this analysis.

Lorem ipsum

Analysis

Lorem ipsum

Conclusion

Short summary of the proposed solution.

Tasks

altinnadmin commented 3 years ago

I hope we can avoid that, given that the SPA is loaded once (and can cache data in the browser), and that we introduce capability for cache in Platform ref. Altinn/altinn-studio#5621.

Caching makes things more complex and should only be introduced if we must.

elsand commented 3 years ago

@altinnadmin We are already using IMemoryCache, which is not distributed across pods. This can introduce subtle bugs due to cache incoherence. Also, the effect of this type of caching is questionable since afaik the LB doesn't pin sessions to any particular pod. Using IMemoryCache seems to me to be fundamentally incompatible with the architecture we're using, and should probably be removed alltogether if not replaced with some distributed cache like Redis.

altinnadmin commented 3 years ago

@elsand Yup, but only in Platform and we're looking into using redis there, ref. Altinn/altinn-studio#5621.

The only place that IMemoryCache seems to be used directly in apps is for text resources (to avoid disk access), which is static across pods and does not change unless an app (pod) is redeployed.

SandGrainOne commented 1 year ago

Removing the platform label again. Platform have a separate issue for caching in platform.