OCSInventory-Server
OCSInventory-Server copied to clipboard
fixed heavy DB load by prevent macaddr query
Status :
READY
Description :
I fixed an issue you'll face if you have a huge amount of clients with virtual network cards and its macaddr '00:00:00:00:00:00'.
How the behaviour is before this commit: --> 40k clients with 5 virtual nic adapter --> every time when sub _duplicate_detect was called this sub queried the database 5 times "give me all networks with mac addresses 00:00:00:00:00:00" wich doesn't have my hardware_id --> this causes the database to return around 200k entries, five times... --> .. so the frontend has to loop 1M entries and calls the funtion already_in_array 1M times
How the behaviour is after my commit: --> 40k clients with 5 virtual nic adapter --> every time when sub _duplicate_detect is called this sub queries the database 0 times "give me all networks with mac addresses 00:00:00:00:00:00" wich doesn't have my hardware_id --> this causes the database to return exactly 0 entries, zero times... --> .. so the frontend has to loop zero entries and calls the funtion already_in_array zero times
So the only thing I changed, was to check the blacklist before the database is queried. In your logic the sub first queries the database and checking each result of an blicklisted macaddr if its on the blacklist.
--> Sorry the last pull request I created had a bug o((⊙﹏⊙))o.
greetings eldo
This Pull Request fixes #396
Hi @EldoBam
We are going to review PR in the following days :) Thanks for your contribution !
Regards, Gilles.
Hi Gilles,
thank you for your response.
Regards, Timo
Hi @EldoBam ,
I tested your PR and it works :-) Thanks for your contribution !
Best regards, Charlene
@charleneauger
Thank's for implementing :)
I will pull all the changes and set it up in our test-environment, where 40k clients will report :) Let's see if I can go with the latest version without modifications, otherwise I will come along with some other improvements.
best regards