OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
344 stars 139 forks source link

fix DB perfomance issue #393

Closed EldoBam closed 2 years ago

EldoBam commented 2 years ago

Important notes

Please, don't mistake OCSInventory-server with OCSInventory-ocsreports :

General informations :

Operating system : CentOS 7

Server informations :

Perl version : v5.16.3 Mysql / Mariadb / Percona version : 10.2.44-MariaDB

Status :

READY

Description :

In a bigger environment ~40k clients, we have faced a database performance issue, caused by the query: SELECT HARDWARE_ID,DESCRIPTION,MACADDR FROM networks WHERE MACADDR='00:00:00:00:00:00' AND HARDWARE_ID<>123123

This caused a heavy network load between the Frontend and DB server, because every client has 5 virtual network cards with mac addr 00:00:00:00:00:00.

I moved the condition if the mac address exists in blacklist, before the query will be executed. In your current branch, the condition if the mac addr is blacklisted is after the query... that hurts the database :)