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

Interval weirdness #61

Closed
axrayn opened this issue May 15, 2019 · 5 comments · Fixed by #100
Closed

Interval weirdness #61

axrayn opened this issue May 15, 2019 · 5 comments · Fixed by #100
Assignees
Labels
enhancement New feature or request

Comments

@axrayn
Copy link
Contributor

axrayn commented May 15, 2019

This will probably be a lot better once we go from single-threaded to multi-threaded but I noticed today that the 'interval' counter only starts when all device polls have completed (either responded or timed out) rather than starting again every 'interval' e.g. START - WORK - FINISH - SLEEP FOR INTERVAL (then repeat)

This means that if you have 100 devices in your hosts list that for the sake of argument all take 1 second to respond and you have a interval of '300', your polling cycles will be every 400 seconds not every 300 seconds. Once you start incurring more penalties through timeouts, your polling cycle can blow out substantially.

I noticed it today with a list of 30 routers, of which 16 weren't responding (firewall rules blocking) so my polling cycles were running an extra ~50 seconds slower and therefore meant graphs set with a 5m interval were progressively not working.

It may just end up being something to note in the docs that this is the expected behaviour and that users will need to use multiple inputs to spread out the number of devices to compensate for this.

@colinsurprenant
Copy link
Contributor

yeah - thanks for the headsup @axrayn, definitely something to improve.

A quick simple change could be as you noted to use:

sleep = (interval - (stop_time - start_time))

and if sleep < 0 then issue a waning log about it.

WDYT?

@colinsurprenant colinsurprenant added the enhancement New feature or request label Jul 30, 2019
@colinsurprenant colinsurprenant self-assigned this Jul 30, 2019
@axrayn
Copy link
Contributor Author

axrayn commented Aug 14, 2019

Sounds good, with an absolute floor of 0 so Stud doesn't complain about a negative?

@colinsurprenant
Copy link
Contributor

Yup, and as noted above, issue a warning log about it so that the user will know if the polling job regularly exceeds the sleep time.

@luminous706
Copy link

luminous706 commented Mar 20, 2021

Any updates on this? I'm having the issue where there are gaps in my graphs because I set the interval for 60 seconds, but in reality it's interval + time to poll, and it's kinda random. I'm only polling for one host, it's a Cisco Nexus switch with hundreds of interfaces, so polling for 60 seconds interval is actually around 70...

@gauravubnare
Copy link

Hi @colinsurprenant , I am facing the same issue. please help me resolve this....

yaauie added a commit to yaauie/logstash-input-snmp that referenced this issue Sep 14, 2021
Attempt to adhere to the interval, regardless of how long execution takes.
After executing, sleep off only the _remainder_ of the interval (if any), and
log a helpful warning when execution takes longer than the interval.

Resolves: logstash-plugins#61
yaauie added a commit that referenced this issue Sep 15, 2021
* interval: only sleep off remainder

Attempt to adhere to the interval, regardless of how long execution takes.
After executing, sleep off only the _remainder_ of the interval (if any), and
log a helpful warning when execution takes longer than the interval.

Resolves: #61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants