Closed vdelendik closed 5 months ago
notifywait vs while + sleep performance:
while :; do
[ -f /opt/.stopped-ffmpeg-1234 ]
sleep 0.1
done
\/\/\/
alpine:3.19.1 / while + sleep 0.1 / 100 threads
CONTAINER ID NAME **CPU %** MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
2b6e9b37d557 testc **160.06%** 47.55MiB / 31.07GiB 0.15% 876B / 0B 0B / 4.1kB 202
---
inotifywait -e create,moved_to,attrib --include '/opt/.stopped-ffmpeg-1234' -qq /tmp
\/\/\/
alpine:3.19.1 / inotifywait / 100 threads
CONTAINER ID NAME **CPU %** MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
60a92a2767ca testc **0.00%** 50.07MiB / 31.07GiB 0.16% 1.09kB / 0B 0B / 8.19kB 202
---
while :; do
[ -f /opt/.stopped-ffmpeg-1234 ]
done
\/\/\/
alpine:3.19.1 / while / 100 threads
CONTAINER ID NAME **CPU %** MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
1b19a34350b1 testc **843.22%** 32.93MiB / 31.07GiB 0.10% 946B / 0B 0B / 4.1kB 102
confirmed inotifywait
is much more efficient
closing as actual implementation tracked by #377
https://unix.stackexchange.com/questions/185283/how-do-i-wait-for-a-file-in-the-shell-script until we migrate to the independent recorder container we could inject files creation on session startup inside appium log. Using
inotifywait
we could detect session startup effectively without sleeps and log file grep which use CPU...the same about video recording finish, just wait until recording stop file appear and generate it by appium on finally when session destroyed, deleted, timed out etc.