-
Notifications
You must be signed in to change notification settings - Fork 320
Description
For certain scenarios, database needs to be updated in batches (e.g., using Redis MULTI and EXEC). Currently, in SWSS, the keyspace notification callbacks are triggered once for each modified entry in the batch. This can result in multiple callback invocations for a single batch operation, leading to performance inefficiencies.
To enhance performance, the SWSS library can introduce a batch database change callback mechanism:
The batch callback would be registered using the database table name and the DB instance number.
The callback would receive a single invocation with a list of all modified table entries in the same order as they are written to database, along with their corresponding operation types (e.g., SET, DEL).
To enable this, SWSS may need to provide a dedicated batch DB commit API.
With this approach, a batch update involving N entries will trigger the callback only once, carrying all changes together—rather than N separate invocations. This optimization can lead to significantly enhanced performance in high-throughput scenarios.