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
refactor: Only update sensor/bgp tables when values are changed #7707
Conversation
If I've not broken anything then for me: Old: Update[203/0.74s]
New: Update[84/0.24s] Time isn't a benefit here as it's a local mysql server but for high latency (or even slow) mysql servers this will help |
K so earlier today before that patch 7707 we had this for mysql: and now after 7707 that did lower the updates it looks like I'm going to enable Enable selected port polling? for this test device next and see if it goes even lower Test device is an Arista 7508 for reference |
Wrong before comparison for the time it took on the slow server: But still 220s before for updates -> 141s after for updates (about 400 less updates) with this change. Also testing now with selected port polling next. |
seeing about the same # of mysql updates with selected port polling + this patch SNMP: Get[416/5.68s] Getnext [0/0.00s] Walk [13/0.39s] |
Yes you won't see much of a difference using selected port polling with or not with the patch as we already filter out updates that aren't needed. So to be clear in your scenario @shimamizu: Local poller in Isreal Local poller in US |
includes/polling/bgp-peers.inc.php
Outdated
|
||
dbUpdate($peer['update'], 'bgpPeers', '`device_id` = ? AND `bgpPeerIdentifier` = ?', array($device['device_id'], $peer['bgpPeerIdentifier'])); | ||
foreach ($bgpPeers_fields as $db_field => $value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could actually use array_diff here.
It worked out pretty nicely for my entity state sensors.
$peer['update] = array_diff($bgpPeers_fields, $peer);
Will only return the fields from bgpPeers_fields that don't match one in $peer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good shout, updated.
The inspection completed: No new issues |
This thread has been automatically locked since there has not been any recent activity after it was closed. |
DO NOT DELETE THIS TEXT
Please note
Testers
If you would like to test this pull request then please run:
./scripts/github-apply <pr_id>
, i.e./scripts/github-apply 5926
This stops updates to the sensors table until the values have actually changed. For devices that have a lot of sensors (one debug output I've just looked at had probably 1000 updates against it. This will cut that down substantially.
@shimamizu is kindly going to test this in real life.