-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Session cache being deleted too often #6726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
While investigating, I also found that each time we add a role to a user, the whole roles cache is cleared, instead of just removing that specific role... any idea why? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Old thread, but I've noticed something weird.
each time a user is added to a role (or a role is created), the cacheController clear the whole Roles cache... or at least it's what is supposed to be done.
we can see it's clearing the whole cache and not the "Role" one (the Role subCache is only defined by a key prefix, which is not used here). |
@mtrezza I'm not really confortable with Roles management in Parse, so I'm not sure of all the ways Roles can be modify, but wouldn't it be sufficient to replace this
by
Otherwise, the only way to ensure we clear the right subCache would be to leverage the cacheAdapter client to list all the keys with What do you think? |
Maybe someone who recently looked into cache optimization in parse server can better answer that, @dplewis ? |
@dplewis did you have time to look into this? I'm guessing the perf impact can be big as we clear the entire cache each time a role is modified |
@mtrezza how do you want to proceed with this one? I guess it could have quite huge performance implication as the cache is clearly deleted far too often |
We are currently focused on fixing long-time open bugs, so enhancements like this are currently not internally prioritized. For now, this will probably stay open until someone in the community picks it up, or it becomes clear that this is a pain point that is so significant that we should reclassify it as a bug. |
It makes a lot of sense |
Issue Description
When we monitor our calls to the redis cache, we can see that the user session is regularly missed even (sometimes every minutes, sometimes after 5 or 10 minutes) with a TTL of one hour.
It's hard to figure out why, but this line could be a (small) part of the explanation.
Instead of just removing all keys (of all sessionTokens) of that user, wouldn't it be possible to refresh them with the updated user?
It's clearly not the only reason, as when investigating we see cache misses for a sessionToken even with the user not being updated (no change in the
updatedAt
field), but it's the only reason we've figured for now...If you have other ideas, I would be happy to test them :)
Server version: 4.2.0 on AWS Elasticbeanstalk (or local)
Database : MongoDB on Mongo Atlas
The text was updated successfully, but these errors were encountered: