0

We are using the sched module in Python 2.6 to run a function every 60 seconds. Each call issues the sched.enter() function after executing with a delay of 60 and priority of 1. This has been working fine.

However, we have found a situation when the next execution of the sched function doesn't happen for several minutes, even up to 5-6 minutes later. This has been observed on a virtual machine.

What could be causing this? Is there any workaround to ensure the task gets executed regularly?

davidmytton
  • 38,604
  • 37
  • 87
  • 93
  • Are you sure that time is running continuously in your virtualized box ? I experienced some problems with virtual machines where time was running slowly than it should (something like 1 minute of time in virtual box was a few minutes in real time ). – Cédric Julien Jul 19 '11 at 11:53

1 Answers1

0

How long takes the processing that happens before sched.enter is called? I would suggest monitoring this, and maybe taking that processing time into account in the delay parameter of sched.enter.

The load of the VM and of the VM host may also be important factors. I've seen performance degradations in some apps caused by the VM host being under a too high load and swapping.

gurney alex
  • 13,247
  • 4
  • 43
  • 57