Hi in my system there will be one master node and n number slave nodes, Where the master node will distribute the incoming request to one of its slave node. In order to make use of cache memory content, I want to keep track of last 50 request (hash of the incoming request) that the slave node already served (In assumption that the last 50 request will be already there in cache memory, So that the node will serve the request fast). As far as i studied the deletion is difficult in the bloom filter. But it can also be done by counting filter. Is it really possible to keep the bloom filter like a moving window (like after 50 request it should delete from the front end to accommodate the new request). Is it really possible to do like so or Is there any other filter like bloom filter (which should be fast enough to check the presence of element).
If you have just 50 things that you're keeping track of, I don't think that a Bloom filter is an appropriate data structure. Bloom filters are good when you have a massive amount if data that can't be held in memory and want to do a prefiltering to eliminate unnecessary lookups in some remote data structure, such as a remote database. If you have just 50 elements, you're almost certainly better off using something like a hash table to store those values, since you can get exact answers in expected O(1) time with minimal space overhead.
If you want to track the last 50 elements you've seen, consider looking into a linked hash table, which supports the insert, lookup, delete, and delete-eldest all in O(1) time. Java's LinkedHashMap
should be great here.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With