-
Notifications
You must be signed in to change notification settings - Fork 35
storage, router: allow calling info when disabled #622
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?
storage, router: allow calling info when disabled #622
Conversation
Serpentian
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.
Congratulations on your first PR! Good work, I'm impressed, you've managed to come this far without help. We have to work a little bit more on the patch, check out my comments below
731ff3f to
080db8f
Compare
Serpentian
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.
Very, very good! The patch is already very clean, let's polish it a little bit more
080db8f to
393db21
Compare
393db21 to
989cc85
Compare
Serpentian
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.
Well done! This was fast, good work
Gerold103
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.
Thanks for the patch 💪! I particularly like the way you managed to split it into commits, quite easy to read.
|
|
||
| local function router_api_call_safe(func, router, ...) | ||
| return func(router, ...) | ||
| local function router_api_call_safe(func, router, arg1, arg2, arg3, arg4, arg5) | ||
| return func(router, arg1, arg2, arg3, arg4, arg5) | ||
| 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.
Some years ago it was thought that this is more JIT-friendly. But did you bench if this new code is actually faster? Can never be sure until do a real test.
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.
It's more JIT friendly, but since we have a lot of other blockers for JITing (like fiber.clock(), pairs and net.box.call e.g.), the router doesn't become JITed because of removing varargs. The whole stack of functions in router.call must be JITable for that to happen.
The perf may degradate a little bit due to removing of varargs, as it's stated in the #266 (comment), but when I measured that, it was 2% degradation for the whole varargs patch.
Here we have just some part of varargs removed, I don't think it'll cause that 2%. Moreover, it's good here for consistency of functions of storage and router. And I'm not even sure, it wasn't some measurement error, 2% is way too small difference. And we still have to move forwards JITing of the router, step by step. This is one of these steps.
P.S. I'll try benching the patchset later tomorrow
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 will wait for your benches. If no degradation, then we can proceed. Otherwise will need to find a way to rework it both on storage and router.
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.
SetupHardware: Tarantool: 2 shards, 2 replicas in one shard, 2 routers, 4 load generators, which're Mean by 20 iterations: The perf test is from the https://github.com/tarantool/vshard-ee/pull/51. Before patchset: 172084.8500 (100%) Nah, Vlad is right, perf degradate a lot, 3% is way too much. Let's go another way here, instead of making router use explicit args, let's make storage use varargs: The patchdiff --git a/vshard/storage/init.lua b/vshard/storage/init.lua
index 9764225..9b8ecd1 100644
--- a/vshard/storage/init.lua
+++ b/vshard/storage/init.lua
@@ -4020,15 +4020,15 @@ end
-- Arguments are listed explicitly instead of '...' because the latter does not
-- jit.
--
-local function storage_api_call_safe(func, arg1, arg2, arg3, arg4)
- return func(arg1, arg2, arg3, arg4)
+local function storage_api_call_safe(func, ...)
+ return func(...)
end
--
-- Unsafe proxy is loaded with protections. But it is used rarely and only in
-- the beginning of instance's lifetime.
--
-local function storage_api_call_unsafe(func, arg1, arg2, arg3, arg4)
+local function storage_api_call_unsafe(func, ...)
-- box.info is quite expensive. Avoid calling it again when the instance
-- is finally loaded.
if not M.is_loaded then
@@ -4054,12 +4054,12 @@ local function storage_api_call_unsafe(func, arg1, arg2, arg3, arg4)
return error(lerror.vshard(lerror.code.STORAGE_IS_DISABLED, msg))
end
M.api_call_cache = storage_api_call_safe
- return func(arg1, arg2, arg3, arg4)
+ return func(...)
end
local function storage_make_api(func)
- return function(arg1, arg2, arg3, arg4)
- return M.api_call_cache(func, arg1, arg2, arg3, arg4)
+ return function(...)
+ return M.api_call_cache(func, ...)
end
endAfter the patch above in the above mentioned setup: 171938.0000 (99.9%). Pretty much the same, but this is because we test it in the case of router overload (storages are not at 100%). Let's check it in another setup: SetupHardware: same. Tarantool: same. 2 shards, 2 replicas in one shard, 9 routers, Before the patch above: 204278.4000 (100%) That's good, let's go this way instead, the router's and storages will be consistent, |
Currently, internal storage API functions use explicit arguments. This differs from the router API implementation, where varargs are used. This patch replaces explicit arguments with varargs in the storage_api_call_safe, storage_api_call_unsafe and storage_make_api functions. Motivation: - Consistency between router and storage internal APIs - Improved performance: using varargs is more efficient than passing explicit arguments Needed for tarantool#266 NO_DOC=refactoring NO_TEST=refactoring
A storage may be marked as disabled, which previously made it difficult to obtain status information from the component. This patch allows calling vshard.storage.info even when the component is disabled. The function now also returns a new boolean field is_enabled indicating whether the component is currently enabled. Closes tarantool#565 @TarantoolBot document Title: vshard: storage.info behavior change vshard.storage.info() This function can now be called even when the storage is disabled. It now also returns a new boolean field is_enabled indicating whether the component is currently enabled.
A router may be marked as disabled, which previously made it difficult to obtain status information from the component. This patch allows calling vshard.router.info even when the component is disabled. The function now also returns a new boolean field is_enabled indicating whether the component is currently enabled. Follow-up tarantool#565 @TarantoolBot document Title: vshard: router.info behavior change vshard.router.info() This function can now be called even when the router is disabled. It now also returns a new boolean field is_enabled indicating whether the component is currently enabled.
989cc85 to
d373701
Compare
A storage or router may be marked as disabled, which previously made it difficult to obtain status information from these components.
This patch allows calling
vshard.storage.infoandvshard.router.infoeven when the component is disabled. Both functions now also return a new boolean fieldis_enabledindicating whether the component is currently enabled.Closes #565
@TarantoolBot document
Title: vshard: info functions behavior change
vshard.storage.info()
vshard.router.info()
These functions can now be called even when the storage or router is disabled.
Both functions now also return a new boolean field
is_enabledindicating whether the component is currently enabled.