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
Perf test: bind server to one NUMA node #15144
Conversation
disabling percpu arenas didn't help, it still segfaults |
Oh wait, it did help -- only the old server segfaults, not the new one. Now to find some way to disable it in runtime... |
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
@@ -7,6 +7,10 @@ trap 'kill $(jobs -pr) ||:' EXIT | |||
stage=${stage:-} | |||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |||
|
|||
# https://github.com/jemalloc/jemalloc/wiki/Getting-Started | |||
export MALLOC_CONF="percpu_arena:disabled" | |||
ln -s "percpu_arena:disabled" /etc/malloc.conf |
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.
ln -s "percpu_arena:disabled" /etc/malloc.conf | |
ln -s "confirm_conf:true,percpu_arena:disabled" /etc/malloc.conf |
I would also suggest adding confirm_conf:true
, it will print all options with values:
$ MALLOC_CONF=confirm_conf:true,percpu_arena:disabled ./clickhouse server -V
<jemalloc>: malloc_conf #1 (string specified via --with-malloc-conf): "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:10000"
<jemalloc>: -- Set conf value: percpu_arena:percpu
<jemalloc>: -- Set conf value: oversize_threshold:0
<jemalloc>: -- Set conf value: muzzy_decay_ms:10000
<jemalloc>: malloc_conf #2 (string pointed to by the global variable malloc_conf): ""
<jemalloc>: malloc_conf #3 ("name" of the file referenced by the symbolic link named /etc/malloc.conf): "confirm_conf:true"
<jemalloc>: -- Set conf value: confirm_conf:true
<jemalloc>: malloc_conf #4 (value of the environment variable MALLOC_CONF): "confirm_conf:true,percpu_arena:disabled"
<jemalloc>: -- Set conf value: confirm_conf:true
<jemalloc>: -- Set conf value: percpu_arena:disabled
ClickHouse server version 20.10.1.4618.
Finally it works, and we have much less unstable queries than in master (only 12 compared to ~100): After jemalloc bug is fixed, we can enable this in master. Or maybe we can just disable percpu arenas for perf test, I'll check how it influences the performance. |
Maybe we can also try binding the two instances to different CPU nodes. It might have unfair CPU frequency but less cache contentions. It might also be good to leave out CPU 0 due to system interruption handling |
I'm afraid of introducing some systemic difference by binding to different nodes, but I'll try it as well. We only have two nodes there (this is from the test log):
|
disabling percpu arenas doesn't really influence the performance |
In general it should not, the purpose of using percpu arena (#11084) is to avoid live leaks with big thread pool, since in this case there will be too much arenas and if some thread will not be scheduled for some time it will not free data (there is also background threads way but percpu arena was prefered #11086) |
@@ -77,23 +77,25 @@ function restart | |||
while killall clickhouse-server; do echo . ; sleep 1 ; done | |||
echo all killed | |||
|
|||
# Disable percpu arenas because they segfault when the process is bound to | |||
# a particular NUMA node: https://github.com/jemalloc/jemalloc/pull/1939 |
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.
But it should not already, since #15035 is merged (it updates jemalloc submodule to include backported version of the patch from the referenced pull request in upstream jemalloc)
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.
Great, I'll remove it.
@akuzm just out of curiosity, what does it improves in perf tests? (taking into account that fact that you disable percpu arena, so you may have a little bit higher memory reserved, and sometimes a little bit less overhead on freeing, but this just a possibility) |
It gives more stable results for test queries that reference a lot of memory. W/o NUMA binding, we had about 150 unstable queries, and now only 35 are left. |
another try with disabled percpu arenas #12631 (comment)
Changelog category (leave one):