Skip to content
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

User Mapping execution should be skipped if unnecessary #20

Open
lilioid opened this issue Feb 12, 2024 · 0 comments
Open

User Mapping execution should be skipped if unnecessary #20

lilioid opened this issue Feb 12, 2024 · 0 comments

Comments

@lilioid
Copy link
Member

lilioid commented Feb 12, 2024

We currently assume the user mapping process is a relatively cheap process that can be executed often and does not have a noticeable performance impact.
This assumption is invalid and should be fixed by not re-exuting the user mapping process for user data as long as that user data is valid.

Concrete Example

This is especially relevant because user mapping is executed via our REST integration on every request. If for example a mapping implementation involves creating groups and synchronizing membership information this might result in some database queries which then result in noticeable delay on every API request.

Solution Idea

If I'm not mistaken all user data types provide some sort of expiration mechanism.
This means that we could use the django caching framework inside UserMapper.handle_federated_userinfo() to determine whether it should call down to the actual mapping method or return a user instance from cache (well, the ID would be cached and the user would be fetched from DB but you know what I mean).

As a similar alternative, we could introduce a caching wrapper to UserMapper.handle_federated_userinfo() which would work the same way as described above but if action needs to be taken, calls into handle_federated_userinfo(). This approach would make it easier to keep using handle_federated_userinfo() as an extension point because not a lot of functionality would need to be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant