MongoDB LUT - CIDR Lookup performance issues
Summary from a customer call:
MongoDB Lookup Table Download and Cache - Like with CSV files, pull the mongodb lookup table on an interval (like every hour) and cache it for in-memory lookups. They had a CIDR table that was 1916 rows and even with a long running cache it saturated a 10GbE link because CIDR queries are filtered at Graylog and not MongoDB so it had to pull the full table each time there was a cache miss.
If possible, we should look at ways of optimizing performance when the cache is not updated and we need to retrieve from Mongo again.
We may not be able to improve performance dramatically given the nature of how these lookups are performed - will need to discuss with architecture if they have alternate solutions.
@rich-graylog I think I may actually have a good solution to make this more efficient, will take a look at it soon
I created a stress test with CSVFileDataAdapter to test the performance improvement. I made a 10,000 entry CIDR data adapter and then performed 10,000 lookups against it. With my original logic the lookups took about 105 seconds. With the new data structure implementation it took about 6 seconds.
MongoDB lookups are only slightly more complex with the following changes from CSV Files:
- ability to add/remove lookups: this one isn't a huge issue
- option of having a TTL on each entry: this requires a little more effort, but should still be okay