-
Notifications
You must be signed in to change notification settings - Fork 357
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
eskipfile: optimize Watch.LoadUpdates #3448
base: master
Are you sure you want to change the base?
Conversation
ac1126a
to
69b94cc
Compare
69b94cc
to
c308d19
Compare
👍 |
quit chan struct{} | ||
once sync.Once | ||
fileName string | ||
lastContent []byte |
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.
Maybe we should better store the sha256 value and compare that one to detect a change, because it is really fast and doesn't require to duplicate the memory of routes as byte slice.
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.
Its fast but not computing it is even faster :)
Do we care about memory consumed by eskip given that we parse and keep routes for lookup anyways?
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.
I think we can move forward with this, given that the concern with large eskipfiles is more about network not memory, and we can update later if we need.
Signed-off-by: Alexander Yastrebov <[email protected]>
Do not parse routes if file content did not change since last successful read. Note that after #2304 RemoteWatch does not update file if response Etag did not change but underlying Watch would still parse routes. ``` goos: linux goarch: amd64 pkg: github.com/zalando/skipper/eskipfile cpu: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz │ HEAD~1 │ HEAD │ │ sec/op │ sec/op vs base │ WatchLoadUpdate-8 17889.7µ ± 24% 220.0µ ± 24% -98.77% (p=0.000 n=10) │ HEAD~1 │ HEAD │ │ B/op │ B/op vs base │ WatchLoadUpdate-8 7837.4Ki ± 0% 528.5Ki ± 0% -93.26% (p=0.000 n=10) │ HEAD~1 │ HEAD │ │ allocs/op │ allocs/op vs base │ WatchLoadUpdate-8 110110.000 ± 0% 6.000 ± 0% -99.99% (p=0.000 n=10) ``` Signed-off-by: Alexander Yastrebov <[email protected]>
c308d19
to
f78437d
Compare
👍 |
Do not parse routes if file content did not change since last successful read.
Note that after #2304 RemoteWatch does not update file if response Etag did not change but underlying Watch would still parse routes.