fdb-record-layer
fdb-record-layer copied to clipboard
Auto-throttling runner
Today we have the FDBDatabaseRunner
which can be used to iteratively perform work and to repeatedly run a transaction to success, however for certain tasks the success or failure of a given transaction depends on certain factors, such as a rate of conflicts with other transactions or the overall size of the transaction. The OnlineIndexer
is an example of such code...in reaction to a high rate of conflicts it will dynamically reduce the amount of records it is attempting to process in a transaction, and as success rates improve, it will dynamically re-increase this rate. Similarly, it (or at least should be able to) commit the current transaction when it hits a specific size target to avoid saturating the server.
It would be possible to encapsulate the sort of logic in the OnlineIndexer
into a new kind of generic runner that can help to dynamically adjust the amount of work being done in a transaction in a similar fashion so that anyone needing to do long running tasks without worrying about these details.