In the EDA system, all services query the dataset access service to ask whether a user has valid perms to perform a given function on a study. Each service does this (except merging), so even within a single web client request, the permissions endpoint may be hit multiple times with the same query (perms for a user+study combo). This can get expensive and also clogs the logs.
I think we could introduce (possibly as a utility) a thread-safe cache to store these responses. The cache would only hold onto entries for a short time (20-30 seconds?)- long enough to reduce the load this service puts on the various DBs (acctdb, appdb) to collect permissions information. A cleaner thread inside the cache could expire entries after some window. This would keep memory usage low.
In the EDA system, all services query the dataset access service to ask whether a user has valid perms to perform a given function on a study. Each service does this (except merging), so even within a single web client request, the permissions endpoint may be hit multiple times with the same query (perms for a user+study combo). This can get expensive and also clogs the logs.
I think we could introduce (possibly as a utility) a thread-safe cache to store these responses. The cache would only hold onto entries for a short time (20-30 seconds?)- long enough to reduce the load this service puts on the various DBs (acctdb, appdb) to collect permissions information. A cleaner thread inside the cache could expire entries after some window. This would keep memory usage low.