Browse Source

Introduced jemalloc (#5590)

### What problem does this PR solve?

Introduced jemalloc.
Python uses pymalloc (which is an reimplementation of gblibc malloc) to
manage RES. It has pools for small objects to avoid returning memory to
OS aggressively. My experience is: Replacing pymalloc with
[jemalloc](https://github.com/jemalloc/jemalloc) can reduce RES and
speedup task_executor.py.

### Type of change

- [x] Performance Improvement
tags/v0.17.1
Zhichang Yu 8 months ago
parent
commit
afe9269534
No account linked to committer's email address
3 changed files with 5 additions and 2 deletions
  1. 1
    0
      Dockerfile
  2. 2
    1
      docker/entrypoint-parser.sh
  3. 2
    1
      docker/entrypoint.sh

+ 1
- 0
Dockerfile View File

apt install -y default-jdk && \ apt install -y default-jdk && \
apt install -y libatk-bridge2.0-0 && \ apt install -y libatk-bridge2.0-0 && \
apt install -y libpython3-dev libgtk-4-1 libnss3 xdg-utils libgbm-dev && \ apt install -y libpython3-dev libgtk-4-1 libnss3 xdg-utils libgbm-dev && \
apt install -y libjemalloc-dev && \
apt install -y python3-pip pipx nginx unzip curl wget git vim less apt install -y python3-pip pipx nginx unzip curl wget git vim less


RUN if [ "$NEED_MIRROR" == "1" ]; then \ RUN if [ "$NEED_MIRROR" == "1" ]; then \

+ 2
- 1
docker/entrypoint-parser.sh View File

CONSUMER_NO_END=$2 CONSUMER_NO_END=$2


function task_exe(){ function task_exe(){
JEMALLOC_PATH=$(pkg-config --variable=libdir jemalloc)/libjemalloc.so
while [ 1 -eq 1 ]; do while [ 1 -eq 1 ]; do
$PY rag/svr/task_executor.py $1;
LD_PRELOAD=$JEMALLOC_PATH $PY rag/svr/task_executor.py $1;
done done
} }



+ 2
- 1
docker/entrypoint.sh View File

fi fi


function task_exe(){ function task_exe(){
JEMALLOC_PATH=$(pkg-config --variable=libdir jemalloc)/libjemalloc.so
while [ 1 -eq 1 ];do while [ 1 -eq 1 ];do
$PY rag/svr/task_executor.py $1;
LD_PRELOAD=$JEMALLOC_PATH $PY rag/svr/task_executor.py $1;
done done
} }



Loading…
Cancel
Save