I'm using a cron task to schedule many jobs every 2 min.
Since there are no higher resolution for less than a minute in cron, I make the python code call a randomised sleep command (between 0-60) so it will spread the execution time across a minute.
This works out fine for me.
I'm just wondering that if I have a process which sleep for 50 seconds, does it keep hold of the memory during these 50 seconds? Can it cause performance problems?
Undoubtedly, whatever memory is consumed by Python and the startup of your script will stay in memory for the duration of the sleep, but since you have written the code you can organise things to minimise the memory usage until the sleep is over.
As to cpu performance, I'm sure that you will incur no overhead for the duration of the sleep.
Does sleep command slow the performance?