Bad performance of getAccountByHomeId with persistance (redis) storage
See original GitHub issueCore Library
MSAL Node (@azure/msal-node)
Wrapper Library
MSAL Node Extensions (@azure/msal-node-extensions)
Public or Confidential Client?
Confidential
Description
When trying to implement redis cache, we realised really bad performance:
getAccountByHomeId
is loading all accounts from storage (in our case redis) and then doing an Array.find
in nodejs.
This approach works, however with several hundreds logins stored in single key in redis, it pulls all from redis in database (could be several megs of data) and then performs quite expensive filter in memory. As result of this the servers might suffer with big RAM / CPU spikes.
in case of external storage it would be better to allow search in external storage by key by passing home id to beforeCacheAccess
function and use advantage of search in external storage, instead of doing this in memory.
Source
External (Customer)
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
@petermilan indeed, performance wise it would be better to scope the msal instance to each request and load only the current users cache into the memory -did you had a chance to see the RedisTestApp sample?
@petermilan This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.