We are having similar issues- but not with Kubernetes. Our setup: Jenkins Master (2.89.2) + slaves locally (on vCenter) + 1 slave on remove vCenter (within corporate network but on another continent). SSH plugin version 2.4. A dead simple job (some "mkdir" and "touch" with 'sh') takes < 1 second on local slaves but ~ 5 seconds on remote one. Using the pipeline native functions (like dir and writeFile) on that remote slave take < 1 second.
node("remote") {
timestamps {
cleanWs()
sh("mkdir -p a; touch a/1.txt a/2.txt a/3.txt")
echo "------------------------"
sh("mkdir -p b; touch b/1.txt b/2.txt b/3.txt")
echo "------------------------"
sh("mkdir -p c; touch c/1.txt c/2.txt c/3.txt")
cleanWs()
echo "--------------------------"
sh("""
mkdir -p a; touch a/1.txt a/2.txt a/3.txt
mkdir -p b; touch b/1.txt b/2.txt b/3.txt
mkdir -p c; touch c/1.txt c/2.txt c/3.txt
""")
echo "--------------------------"
sh("")
sh("")
sh("")
echo "-------------------------"
echo "[start] use groovy native writeFile"
dir("d") {
writeFile(file: "d/1.txt", text: '')
writeFile(file: "d/2.txt", text: '')
writeFile(file: "d/3.txt", text: '')
}
echo "[end] use groovy native writeFile"
echo "-------------------------"
echo "[start] use groovy native writeFile"
dir("e") {
writeFile(file: "e/1.txt", text: '')
writeFile(file: "e/2.txt", text: '')
writeFile(file: "e/3.txt", text: '')
}
echo "[end] use groovy native writeFile"
}
}
The execution on the remote slave:
[Pipeline] properties
[Pipeline] node
Running on remote in /home/jenkins/workspace/tmp-job
[Pipeline] {
[Pipeline] timestamps
[Pipeline] {
[Pipeline] cleanWs
08:43:31 [WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
[Pipeline] sh
08:43:32 [tmp-job] Running shell script
08:43:32 + mkdir -p a
08:43:32 + touch a/1.txt a/2.txt a/3.txt
[Pipeline] echo
08:43:33 ------------------------
[Pipeline] sh
08:43:33 [tmp-job] Running shell script
08:43:34 + mkdir -p b
08:43:34 + touch b/1.txt b/2.txt b/3.txt
[Pipeline] echo
08:43:34 ------------------------
[Pipeline] sh
08:43:35 [tmp-job] Running shell script
08:43:36 + mkdir -p c
08:43:36 + touch c/1.txt c/2.txt c/3.txt
[Pipeline] cleanWs
08:43:36 [WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
[Pipeline] echo
08:43:36 --------------------------
[Pipeline] sh
08:43:37 [tmp-job] Running shell script
08:43:38 + mkdir -p a
08:43:38 + touch a/1.txt a/2.txt a/3.txt
08:43:38 + mkdir -p b
08:43:38 + touch b/1.txt b/2.txt b/3.txt
08:43:38 + mkdir -p c
08:43:38 + touch c/1.txt c/2.txt c/3.txt
[Pipeline] echo
08:43:38 --------------------------
[Pipeline] sh
08:43:38 Warning: was asked to run an empty script
08:43:39 [tmp-job] Running shell script
[Pipeline] sh
08:43:40 Warning: was asked to run an empty script
08:43:41 [tmp-job] Running shell script
[Pipeline] sh
08:43:42 Warning: was asked to run an empty script
08:43:43 [tmp-job] Running shell script
[Pipeline] echo
08:43:43 -------------------------
[Pipeline] echo
08:43:43 [start] use groovy native writeFile
[Pipeline] dir
08:43:43 Running in /home/jenkins/workspace/tmp-job/d
[Pipeline] {
[Pipeline] writeFile
[Pipeline] writeFile
[Pipeline] writeFile
[Pipeline] }
[Pipeline] [Pipeline] echo
08:43:44 [end] use groovy native writeFile
[Pipeline] echo
08:43:44 -------------------------
[Pipeline] echo
08:43:44 [start] use groovy native writeFile
[Pipeline] dir
08:43:44 Running in /home/jenkins/workspace/tmp-job/e
[Pipeline] {
[Pipeline] writeFile
[Pipeline] writeFile
[Pipeline] writeFile
[Pipeline] }
[Pipeline] [Pipeline] echo
08:43:44 [end] use groovy native writeFile
[Pipeline] }
[Pipeline] [Pipeline] }
[Pipeline] [Pipeline] End of Pipeline
Finished: SUCCESS
On larger jobs we even have overhead of 100% sometimes. I will be happy to provide more info if needed. Thanks. |