You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/09/08 20:10:30 UTC
[GitHub] [doris] xinyiZzz opened a new pull request, #12496: [enhancement](memory) Optimize jemalloc compilation and configuration
xinyiZzz opened a new pull request, #12496:
URL: https://github.com/apache/doris/pull/12496
# Proposed changes
Issue Number: close #xxx
## Problem summary
1. Before jemalloc was compiled with arrow, it was compiled separately
2. Modify the default parameters of jemalloc to achieve better performance and lower memory usage.
This will significantly improve multi-threading and high concurrency memory performance.
refer to:
https://github.com/jemalloc/jemalloc/blob/dev/TUNING.md
https://jemalloc.net/jemalloc.3.html
https://github.com/jemalloc/jemalloc/issues/1621
https://github.com/jemalloc/jemalloc/wiki/Getting-Started
## Performance Verification Results
1、single thread sequential execution
> the sum of the averages of multiple executions of each query
1) Clickbench:
| | sum of time(s) | peak mem(M) |
| :------| ------: | :------: |
| tcmalloc | 210 | 11927 |
| jemalloc default conf | 203.17 | 20777 |
| jemalloc optimize conf | 191.87 | 13594 |
2) SSB:
| | sum of time(s) | peak mem(M) |
| :------| ------: | :------: |
| tcmalloc | 15.845 | 832 |
| jemalloc default conf | 15.052 | 2920 |
| jemalloc optimize conf | 13.828 | 2091 |
Looking at the flame graph, the time-consuming of submitting sql in a single thread is not in memory, so the performance improvement is less.
2、jmeter stress test, disable page cache and chunk allocator
> Take the results of the second stress test for each sql, because jemalloc has a cold start, the first stress test is more aggressively cached, and the second stress test starts to get faster.
1) Clickbench, only q13 + q14
| | sum of time(s) |
| :------| ------: | :------: |
| tcmalloc | 82611 |
| jemalloc default conf | 72688 |
| jemalloc optimize conf | 42506 |
After optimization, the performance of jemalloc is doubled.
4、SSB, jmeter stress test, disable page cache and chunk allocator
> only q13 + q14,Take the results of the second stress test for each sql, because jemalloc has a cold start, the first stress test is more aggressively cached, and the second stress test starts to get faster.
| | sum of time(s) |
| :------| ------: | :------: |
| tcmalloc | 82611 |
| jemalloc default conf | 72688 |
| jemalloc optimize conf | 42506 |
After optimization, the performance of jemalloc is doubled.
1、Clickbench, single thread sequential execution
Reproduce:
```
be.conf add
`enable_tcmalloc_hook=false`
`disable_storage_page_cache=true`
`disable_mem_pools=true`
`chunk_reserved_bytes_limit=1`
vim tools/clickbench-tools/run-clickbench-queries.sh
pre_set "set global parallel_fragment_exec_instance_num=1;"
pre_set "set global exec_mem_limit=20G;
sh tools/clickbench-tools/run-clickbench-queries.sh
```
2、SSB, single thread sequential execution
Reproduce:
```
be.conf add
`enable_tcmalloc_hook=false`
`disable_storage_page_cache=true`
`disable_mem_pools=true`
`chunk_reserved_bytes_limit=1`
vim tools/ssb-tools/bin/run-ssb-queries.sh
pre_set "set global parallel_fragment_exec_instance_num=1;"
sh tools/ssb-tools/bin/run-ssb-queries.sh
```
3、Clickbench, jmeter stress test, disable page cache and chunk allocator
Reproduce:
```
be.conf add
`enable_tcmalloc_hook=false`
`disable_storage_page_cache=true`
`disable_mem_pools=true`
`chunk_reserved_bytes_limit=1`
jmeter conf
<stringProp name="ThreadGroup.num_threads">30</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<stringProp name="ThreadGroup.duration">100</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
```
## Checklist(Required)
1. Does it affect the original behavior:
- [ ] Yes
- [ ] No
- [ ] I don't know
2. Has unit tests been added:
- [ ] Yes
- [ ] No
- [ ] No Need
3. Has document been added or modified:
- [ ] Yes
- [ ] No
- [ ] No Need
4. Does it need to update dependencies:
- [ ] Yes
- [ ] No
5. Are there any changes that cannot be rolled back:
- [ ] Yes (If Yes, please explain WHY)
- [ ] No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yiguolei commented on pull request #12496: [enhancement](memory) Jemalloc performance optimization and compatibility with MemTracker
Posted by GitBox <gi...@apache.org>.
yiguolei commented on PR #12496:
URL: https://github.com/apache/doris/pull/12496#issuecomment-1255773941
both clickhouse and pingcap has swtiched to jemalloc.
https://github.com/ClickHouse/ClickHouse/pull/2773
https://github.com/pingcap/tiflash/pull/424
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xinyiZzz commented on a diff in pull request #12496: [enhancement](memory) Jemalloc performance optimization and compatibility with MemTracker
Posted by GitBox <gi...@apache.org>.
xinyiZzz commented on code in PR #12496:
URL: https://github.com/apache/doris/pull/12496#discussion_r981925548
##########
bin/start_be.sh:
##########
@@ -207,6 +207,8 @@ export UBSAN_OPTIONS=print_stacktrace=1
## set hdfs conf
export LIBHDFS3_CONF="${DORIS_HOME}/conf/hdfs-site.xml"
+export MALLOC_CONF="percpu_arena:percpu,background_thread:true,metadata_thp:auto,muzzy_decay_ms:30000,dirty_decay_ms:30000,oversize_threshold:0,lg_tcache_max:16"
+
Review Comment:
`muzzy_decay_ms` and `dirty_decay_ms` are currently 30s
`lg_tcache_max` is not the size of the thread cache, it is the maximum size of a single class (memory block) cached by the thread cache, the default is 32K, and the size of the thread cache is controlled by jemalloc itself
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xinyiZzz commented on pull request #12496: [enhancement](memory) Jemalloc performance optimization and compatibility with MemTracker
Posted by GitBox <gi...@apache.org>.
xinyiZzz commented on PR #12496:
URL: https://github.com/apache/doris/pull/12496#issuecomment-1258322142
> both clickhouse and pingcap has swtiched to jemalloc. [ClickHouse/ClickHouse#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) [pingcap/tiflash#424](https://github.com/pingcap/tiflash/pull/424)
I will refer to more later
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yiguolei commented on a diff in pull request #12496: [enhancement](memory) Jemalloc performance optimization and compatibility with MemTracker
Posted by GitBox <gi...@apache.org>.
yiguolei commented on code in PR #12496:
URL: https://github.com/apache/doris/pull/12496#discussion_r980713899
##########
bin/start_be.sh:
##########
@@ -207,6 +207,8 @@ export UBSAN_OPTIONS=print_stacktrace=1
## set hdfs conf
export LIBHDFS3_CONF="${DORIS_HOME}/conf/hdfs-site.xml"
+export MALLOC_CONF="percpu_arena:percpu,background_thread:true,metadata_thp:auto,muzzy_decay_ms:30000,dirty_decay_ms:30000,oversize_threshold:0,lg_tcache_max:16"
+
Review Comment:
could we set the thread cache size to 1MB, for doris there maybe 1000 threads and the total cache will be 1GB, I think it is ok.
And the decay time is too long, I think 30s is ok?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yiguolei merged pull request #12496: [enhancement](memory) Jemalloc performance optimization and compatibility with MemTracker
Posted by GitBox <gi...@apache.org>.
yiguolei merged PR #12496:
URL: https://github.com/apache/doris/pull/12496
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org