Remove cause of duplicate ports listing #396

Merged
merged 1 commit into from Jan 9, 2015

Projects

None yet

2 participants

@f0o
Member
f0o commented Jan 7, 2015

#30

Removed bogus and buggy Memcached reference from html/pages/ports.inc.php to avoid duplicates.

This code was without function. It didnt relief the SQL from any additional queries and only adds duplications in case memcached is used.

@laf
Member
laf commented Jan 8, 2015

I don't use memcache myself but is this not more a case that the code is just wrong rather it needs removing?

@f0o
Member
f0o commented Jan 8, 2015

I thought long about this and the only real way to make use of the memcache here is to replace the * SQL-Query above with and port_id query and then make N (where N=total amount of ports) succeeding queries to the SQL if the memcache does not hold any data.

This will cause a terrible SQL performance because on big installs it will lead to thousands of 1-row queries that penetrate the SQL and thus drain excessive resources on the SQL-host.

An alternative would be to prefer Memcache over SQL but this may cause incomplete port-listings in case the Memcache goes Out-Of-Memory and purges out old entries.
Having a count(*) operation on the SQL and check it against the Memcache's objects is a possible solution to avoid this issue, however it may cause an additional issue when pulling the missing ports from the SQL as the Query designated for it will include N (where N=total amount of ports known to memcache) WHERE statements. This may exceed maximum Query-length on the SQL.

@laf
Member
laf commented Jan 8, 2015

Thanks @f0o.

@laf laf merged commit 43d41ca into librenms:master Jan 9, 2015

1 check passed

Scrutinizer 7 new issues
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment