opensearch-project / docker-images

Apache License 2.0
8 stars 20 forks source link

[BUG] inefficient OS ENVs processing delays opensearch node start time up to 10-15minutes #15

Closed lde-avaleo closed 1 year ago

lde-avaleo commented 1 year ago

What is the bug?

It seems that in large kubernetes cluster environment where there is a lot of ENVs passed to the pod it takes ages to process all of them. This result in very long time needed by opensearch node to start. e.g. In our environment there are almost 5000 ENVs passed to the pod. This result in 15minutes long opensearch node start time.

How can one reproduce the bug?

Create more or less 5000 OS ENVs and try to start opensearch node.

What is the expected behavior?

Improved performance of ENVs processing

What is your host/environment?

Kubernetes Cluster

Do you have any screenshots?

Do you have any additional context?

I think that main problem lays in opensearch-docker-entrypoint.sh script in while IFS='=' read -r envvar_key envvar_value which is very slow and ineeficient.

Maybe you could consider to change IFS for whole while loop like this below (of course then you would accept some caveat that this change would introduce):

old_ifs="$IFS"
IFS='='
while read -r envvar_key envvar_value
[...]
IFS="$old_ifs"

Quick tests shows that above change shorten time needed to process ENVs from minutes to seconds.

peterzhuamazon commented 1 year ago

Hi @lde-avaleo we are not using this repo for building docker images. All the building scripts are currently reside here: https://github.com/opensearch-project/opensearch-build/tree/main/docker

Thanks.