Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measuring and optimizing try's overhead #156

Open
ezrizhu opened this issue May 20, 2024 · 3 comments
Open

Measuring and optimizing try's overhead #156

ezrizhu opened this issue May 20, 2024 · 3 comments
Assignees

Comments

@ezrizhu
Copy link
Collaborator

ezrizhu commented May 20, 2024

Below loop takes 0.086338005s

try/try

Lines 109 to 117 in 55a7619

while IFS="" read -r mountpoint
do
## Only make the directory if the original is a directory too
if [ -d "$mountpoint" ] && ! [ -L "$mountpoint" ]
then
# shellcheck disable=SC2174 # warning acknowledged, "When used with -p, -m only applies to the deepest directory."
mkdir -m "$(stat -c %a "$mountpoint")" -p "${SANDBOX_DIR}/upperdir/${mountpoint}" "${SANDBOX_DIR}/workdir/${mountpoint}" "${SANDBOX_DIR}/temproot/${mountpoint}"
fi
done <"$DIRS_AND_MOUNTS"

each unionhelper mount takes around 0.011723267s
each normal overlay mount takes around 0.005518701s

0.004118806 Entrypoint
0.001737423 Finish Parseopt
0.001615350 Start of try()
0.003911111 Determining sandboxdir
0.009549844 Docker handling
0.004255040 Making upperdir, workdir, temproot
0.004132450 Enumerating direcotories to mount
0.006334729 EnumDir: find
0.006502962 EnumDir: findmnt
0.003777117 EnumDir: sort
0.005552995 EnumDir: MultiLowerDir
0.084236389 Prepare sandboxes before unshare
0.005717082 set temproot permission
0.016709205 Writing tempfiles
0.001816768 Disable job control
0.005136067 Outer unshare
0.001934788 Union helper detection
0.105242101 Mounting overlays
0.030229675 Mounting devices
0.012676495 Inner unshare
0.009892223 sync
0.029609429 unmounting devices
0.011026003 Exitting inner unshare
0.019649394 Symlinks cleanup
0.008201226 Summary
0.001717618 End of try
0.001631593 date test 1
@mgree
Copy link
Contributor

mgree commented May 20, 2024

Interesting! Is there a way for you to automate this process and check the overheads on a few different machines?

Can you count the overhead of the two calls to date, too? (You can do this by just running it with an empty block.)

@ezrizhu
Copy link
Collaborator Author

ezrizhu commented May 20, 2024

sure, i'll do them on our CI machine under different distros and also some of my other machines

@ezrizhu ezrizhu self-assigned this May 26, 2024
@ezrizhu
Copy link
Collaborator Author

ezrizhu commented May 28, 2024

Can you count the overhead of the two calls to date, too? (You can do this by just running it with an empty block.)
updated, see date test 1

Dev VM: https://bns.sh/i3.txt
Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz (40): http://bns.sh/iC.txt
Intel(R) Xeon(R) CPU E3-1230 v5 @ 3.40GHz (8): http://bns.sh/iY.txt
AMD Ryzen 7 3700X 8-Core Processor (16): https://bns.sh/iR.txt

I'll work with @gliargovas to get them ran on the pi cluster at brown aswell, then setting up some CI jobs to automatically run them after we determine the machine set that we're using.

@mgree mgree changed the title Optimization Measuring and optimizing try's overhead Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants