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.
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 inwhile 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):
Quick tests shows that above change shorten time needed to process ENVs from minutes to seconds.