mirror of https://github.com/milvus-io/milvus.git
Set jemalloc LD_PRELOAD env to linux image (#17494)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>pull/17501/head
parent
36ad989590
commit
c77bc81057
|
@ -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 {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/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,11 +16,11 @@
|
|||
# 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_PRELDOAD="$LIBJEMALLOC"
|
||||
export LD_PRELOAD="$LIBJEMALLOC"
|
||||
else
|
||||
echo "WARN: Cannot find $LIBJEMALLOC"
|
||||
fi
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/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,12 +16,11 @@
|
|||
# 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"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue