[SERVER-74009] Add an LRU cache to limit the frequency of logging client metadata Created: 14/Feb/23  Updated: 29/Oct/23  Resolved: 27/Feb/23

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

Type: New Feature Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Patrick Freed
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2023-03-06
Participants:

 Description   

ClientCache implements an LRU cache and acts as the gatekeeper for logging client metadata for incoming gRPC streams. This ticket focuses on using the existing LRUCache to implement a thread-safe ClientCache, where:

  • The constructor forwards the maximum cache size to the constructor of LRUCache. By default, we will set this to 65,536, reserving about 1 MB of memory for the cache.
  • The add method inserts clientId into the underlying cache:
  • If the clientId already exists, the cache is updated and the add method returns false.
  • Otherwise, it returns true.

class ClientCache {
	explicit ClientCache(size_t maxSize);
	bool add(const UUID& clientId) = 0;
};



 Comments   
Comment by Githook User [ 27/Feb/23 ]

Author:

{'name': 'Patrick Freed', 'email': 'patrick.freed@mongodb.com', 'username': 'patrickfreed'}

Message: SERVER-74009 Add an LRU cache for limiting the frequency of logging client metadata (#10846)

This also adds move and copy constructors and assignment operators to the existing LRUCache type.
Branch: master
https://github.com/mongodb/mongo/commit/d8b5ef7502808c953bb8adc5f2c5e778e502a333

Generated at Thu Feb 08 06:26:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.