未验证 提交 c77bc810 编写于 作者: B bigsheeper 提交者: GitHub

Set jemalloc LD_PRELOAD env to linux image (#17494)

Signed-off-by: Nbigsheeper <yihao.dai@zilliz.com>
上级 36ad9895
......@@ -32,6 +32,7 @@ COPY ./lib/ /milvus/lib/
ENV PATH=/milvus/bin:$PATH
ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib
ENV LD_PRELOAD=/milvus/lib/libjemalloc.so
# Add Tini
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
......
......@@ -32,6 +32,7 @@ COPY ./lib/ /milvus/lib/
ENV PATH=/milvus/bin:$PATH
ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib
ENV LD_PRELOAD=/milvus/lib/libjemalloc.so
# Add Tini
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
......
......@@ -90,6 +90,14 @@ func (mr *MilvusRoles) EnvValue(env string) bool {
return env == "1" || env == "true"
}
func (mr *MilvusRoles) printLDPreLoad() {
const LDPreLoad = "LD_PRELOAD"
val, ok := os.LookupEnv(LDPreLoad)
if ok {
log.Info("Enable Jemalloc", zap.String("Jemalloc Path", val))
}
}
func (mr *MilvusRoles) runRootCoord(ctx context.Context, localMsg bool) *components.RootCoord {
var rc *components.RootCoord
var wg sync.WaitGroup
......@@ -349,6 +357,7 @@ func (mr *MilvusRoles) runIndexNode(ctx context.Context, localMsg bool, alias st
func (mr *MilvusRoles) Run(local bool, alias string) {
log.Info("starting running Milvus components")
ctx, cancel := context.WithCancel(context.Background())
mr.printLDPreLoad()
// only standalone enable localMsg
if local {
......
#!/usr/bin/env bash
# Licensed to the LF AI & Data foundation under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
......@@ -14,14 +16,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
LIBJEMALLOC=$PWD/internal/core/output/lib/libjemalloc.so
if test -f "$LIBJEMALLOC"; then
#echo "Found $LIBJEMALLOC"
export LD_PRELDOAD="$LIBJEMALLOC"
else
echo "WARN: Cannot find $LIBJEMALLOC"
fi
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
LIBJEMALLOC=$PWD/internal/core/output/lib/libjemalloc.so
if test -f "$LIBJEMALLOC"; then
#echo "Found $LIBJEMALLOC"
export LD_PRELOAD="$LIBJEMALLOC"
else
echo "WARN: Cannot find $LIBJEMALLOC"
fi
fi
echo "Starting rootcoord..."
......
#!/usr/bin/env bash
# Licensed to the LF AI & Data foundation under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
......@@ -14,16 +16,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
LIBJEMALLOC=$PWD/internal/core/output/lib/libjemalloc.so
if test -f "$LIBJEMALLOC"; then
#echo "Found $LIBJEMALLOC"
export LD_PRELOAD="$LIBJEMALLOC"
echo export LD_PRELOAD="$LIBJEMALLOC"
else
echo "WARN: Cannot find $LIBJEMALLOC"
echo "WARN: Cannot find $LIBJEMALLOC"
fi
fi
fi
echo "Starting standalone..."
nohup ./bin/milvus run standalone > /tmp/standalone.log 2>&1 &
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册