Set LD_PRELOAD to load jemalloc in Dockerfile-workers. (#14182)
This commit is contained in:
parent
c3e4edb4d6
commit
c7446906bd
|
@ -0,0 +1 @@
|
||||||
|
Set LD_PRELOAD to use jemalloc memory allocator in Dockerfile-workers.
|
|
@ -39,6 +39,7 @@
|
||||||
# continue to work if so.
|
# continue to work if so.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -632,14 +633,23 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:
|
||||||
with open(mark_filepath, "w") as f:
|
with open(mark_filepath, "w") as f:
|
||||||
f.write("")
|
f.write("")
|
||||||
|
|
||||||
|
# Lifted right out of start.py
|
||||||
|
jemallocpath = "/usr/lib/%s-linux-gnu/libjemalloc.so.2" % (platform.machine(),)
|
||||||
|
|
||||||
|
if os.path.isfile(jemallocpath):
|
||||||
|
environ["LD_PRELOAD"] = jemallocpath
|
||||||
|
else:
|
||||||
|
log("Could not find %s, will not use" % (jemallocpath,))
|
||||||
|
|
||||||
# Start supervisord, which will start Synapse, all of the configured worker
|
# Start supervisord, which will start Synapse, all of the configured worker
|
||||||
# processes, redis, nginx etc. according to the config we created above.
|
# processes, redis, nginx etc. according to the config we created above.
|
||||||
log("Starting supervisord")
|
log("Starting supervisord")
|
||||||
os.execl(
|
os.execle(
|
||||||
"/usr/local/bin/supervisord",
|
"/usr/local/bin/supervisord",
|
||||||
"supervisord",
|
"supervisord",
|
||||||
"-c",
|
"-c",
|
||||||
"/etc/supervisor/supervisord.conf",
|
"/etc/supervisor/supervisord.conf",
|
||||||
|
environ,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue