Optimize poller performance tip!

Hello,

I have done a pull request to optimize polling performances. I am using it in production for two months without regression and with performance gain.

Basically, it optimizes the number of call in database when polling.

Anyone to test it ?

To test:

cd /opt/librenms/
scripts/github-apply 10792

To revert:

scripts/github-apply 10792 -R

i get this when trying to apply the patch:

-bash-4.2$ scripts/github-apply 10792
Checking patch includes/polling/ports.inc.php…
error: while searching for:
dbInsert(array(‘port_id’ => $port_id), ‘ports_statistics’);
$ports[$port_id] = dbFetchRow(‘SELECT * FROM ports WHERE port_id = ?’, array($port_id));
echo ‘Adding: ‘.$ifName.’(’.$ifIndex.‘)(’.$port_id.‘)’;
// print_r($ports);
} // Port re-discovered after previous deletion?
elseif ($ports[$port_id][‘deleted’] == 1) {
dbUpdate(array(‘deleted’ => ‘0’), ‘ports’, ‘port_id = ?’, array($port_id));

error: patch failed: includes/polling/ports.inc.php:501
error: includes/polling/ports.inc.php: patch does not apply

anything else in particular i need to do beforehand? would like to see how this deals with 21572 ports on my librenms system.

@jongalli, the patch has been applied to master branch. No need to it manually.

Please update to last daily version if not already done