-
Notifications
You must be signed in to change notification settings - Fork 360
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
High latencies #346
Comments
Thank you for this amazing write-up! We've heard complaints in the recent days about slow performance when little CPU (e.g. 0.1 units) are available. This is most likely the root cause of that! This should indeed be addressed with a caching mechanism. I think we should add a method to viper which returns the timestamp (nanoseconds) of the most recent config update. Based on that, we can invalidate and recompute the caches. We'd appreciate it if you would be able to help out there, seeing as you've already started working on this. Would you be open to that? If so, I can give some pointers and hints as to what needs to be changed in our viper fork. |
Sure ;) Some pointers and hint's would be highly appreciated and I will try to find some spare time for that. |
Ok, so generally speaking we want to cache requests to here: https://github.com/ory/oathkeeper/blob/master/driver/configuration/provider_viper.go#L201 We can do that by computing a hash (CRC32 is probably enough but I would feel more comfortable with a 64 or 128 or 160 bit hash) of As far as our Viper is concerned, adding a It would make a lot of sense to add a small test for that behavior in viper itself, checking if the timestamp actually updates when you update the config file. It would also make sense to add a function that exposes the As far as oathkeeper goes, a test in |
Actually, I think it might be possible to create a copy of the memory the |
Describe the bug
Started using Oathkeeper and was quiet surprised about it's somewhat high latencies. I'm using a simple forward rule including (AllowAuthorizer / NoopAuthenticator / NoopMutator)
It takes around ~80ms for a request getting processed. I did some cpu profiling to check what happens. Turns out that https://github.com/ory/oathkeeper/blame/master/driver/configuration/provider_viper.go#L200 is getting called for every request multiplied with each authenticator, authorizer and mutator. This is calling the viper stack to compute the config which then get validated against the schema.
I just did some basic 3 line's caching there to proof my point and brought it down to ~5ms immediately (with all the schema validation still in place)
CPU profile
Server configuration
Expected behavior
Would have expected some kind of caching here ;) I like the Prometheus approach where you would habe to call an api endpoint in order to reload the config.
Environment
The text was updated successfully, but these errors were encountered: