-
Notifications
You must be signed in to change notification settings - Fork 172
THREESCALE-12133 optimize configuration reload #1564
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
base: master
Are you sure you want to change the base?
THREESCALE-12133 optimize configuration reload #1564
Conversation
Previously, every time the policy chain was rebuilt, the gateway would look for the manifests file on the disk. This caused a delay for incoming requests. Since the manifests are static and do not change at runtime, it is more efficient to cache them at the module level. This caching will speed up the lookup process.
Creating a json schema validator is somewhat expensive, so we cache this step with a local LRU cache
| if manifest then | ||
| return load_path, manifest.configuration | ||
| else | ||
| insert(failures, load_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading lua for the first time so excuse me if I miss something.
Whenever the manifest is not found, here we insert a failure somewhere. But if it is missing, should we continue with the rest of the method? Shouldn't we just return to avoid further processing?
Perhaps this would not be performance critical because we don't expect errors to happen often. But it occurred to me to ask you if that makes sense.
| ):check(self) | ||
| if manifests then | ||
| PolicyOrderChecker.new(manifests):check(self) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit, it looks like the method is only called in gateway/src/apicast/configuration.lua without parameters. So perhaps makes sense to simplify by removing the argument from it as well the if clause.
akostadinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are some excellent improvements! Just a couple of minor suggestions that you can ignore if they don't make sense to you.
Now learning a little bit more about apicast architecture, I think that your suggestion of looking at increment updates makes a lot of sense so we can discuss the options to implement.
What
Fix THREESCALE-12133
NOTE:
Before:
File read
Latency
Flamegraph
After:
File read
Latency
Flamegraph
Verification steps
Details
docker-compose.ymlfile as follow. Update<token>and<3scale_admin_portal>to match values from previous step.Replace:
APICast_gateway_IP,user_keywith value from previous stepsVisit the admin portal and replace the
hostnamewith the hostname of one product of your choiceStart k6 test