You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom implementation of IReminderTable which reads reminders from SQL database (ticks get persisted by other means which is not relevant here). By default there's 30 hash range buckets in each silo, so when Reminder Service refreshes it invokes 30 ReadRows in parallel resulting in 30 parallel SQL queries. While each query is lightweight it'd be even faster if I could make it all in one db roundtrip.
Currently the only idea I have is to make ReadRows(int, int) load all reminders for all silos and cache them for short time (like a minute - anything lower than refresh interval), or get them from the cache and then filter only reminders for the specified hash range. While it reduces number of db roundtrips the tradeoff is it'll fetch and filter more data than required (there's multiple silos).
So, how can I access all the hash ranges inside my Reminder Table implementation, to fetch only relevant reminders but for all buckets at once? Is it possible with current IReminderTable interface at all?
If not possible, then how about changing signature of Task<ReminderTableData> ReadRows(uint begin, uint end) to something like this (could be more readable but it communicates the idea)
ReadRows is called for all hash ranges at once anyway via private LocalReminderService.ReadTableAndStartTimers methods, which are then awaited together via Task.WhenAll. This is easy to replace with a call to StartReadRowsForRanges which would return array of hot task each then passed to ReadTableAndStartTimers, and it'd be up to IReminderTable implemenation to decide what to do: run each bucket as a separate query, or merge it all into one query and then fill TaskCompletionSources. Do I miss anything here?
The text was updated successfully, but these errors were encountered:
I have a custom implementation of
IReminderTable
which reads reminders from SQL database (ticks get persisted by other means which is not relevant here). By default there's 30 hash range buckets in each silo, so when Reminder Service refreshes it invokes 30ReadRows
in parallel resulting in 30 parallel SQL queries. While each query is lightweight it'd be even faster if I could make it all in one db roundtrip.Currently the only idea I have is to make
ReadRows(int, int)
load all reminders for all silos and cache them for short time (like a minute - anything lower than refresh interval), or get them from the cache and then filter only reminders for the specified hash range. While it reduces number of db roundtrips the tradeoff is it'll fetch and filter more data than required (there's multiple silos).So, how can I access all the hash ranges inside my Reminder Table implementation, to fetch only relevant reminders but for all buckets at once? Is it possible with current
IReminderTable
interface at all?If not possible, then how about changing signature of
Task<ReminderTableData> ReadRows(uint begin, uint end)
to something like this (could be more readable but it communicates the idea)ReadRows
is called for all hash ranges at once anyway via privateLocalReminderService.ReadTableAndStartTimers
methods, which are then awaited together viaTask.WhenAll
. This is easy to replace with a call toStartReadRowsForRanges
which would return array of hot task each then passed toReadTableAndStartTimers
, and it'd be up toIReminderTable
implemenation to decide what to do: run each bucket as a separate query, or merge it all into one query and then fillTaskCompletionSource
s. Do I miss anything here?The text was updated successfully, but these errors were encountered: