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
One of the things I see with the current implementation is, every time the consuming thread reaches zero-buffered items the consuming thread has to:
await for the CONTINUEResponse if it's not already here (maybe it consumed things pretty fast)
If the Response is present, move the response data into a cursor's internal buffer
Fire off a CONTINUE if needed.
Essentially, we have to do some extra work every time we underrun the internal cursor buffer.
Not saying it's bad, but if we had a lil micro task that fired from the consuming thread when the internal buffer reached a "low water mark" threshold, the micro task would go out and work with the Connection to pull in cursor items as fast as possible to refill the internal cursor buffer up to a "high water mark" threshold.
Worst case, cons: The consuming thread is just way too fast at consuming cursor items and the server is being a slow poke. Having a system like this would lead to unnecessary overhead with things like ConcurentQueue.
Best case, pros: The consuming thread has very little "cursor maintenance" to do, and is hardly blocked or awaited on.
Maybe we could have the best of both words, two cursor implementations, and let the user pick.
So, when the user calls RunCursor<T> run helper, they can pass a parameter that specifies they want a cool Cursor with a micro task pump:
Query.RunCursor<T>(conn, {the cursor I want is a cursor
with a micro task pump for dis query, and here
is the high water mark and low water mark});
//hell yeah.
💥 cool. maybe it doesn't matter to ppl, but still bad-ass cool.
Been thinking about
Cursor<T>
a lot recently.One of the things I see with the current implementation is, every time the consuming thread reaches zero-buffered items the consuming thread has to:
await
for theCONTINUE
Response
if it's not already here (maybe it consumed things pretty fast)Response
is present, move the response data into a cursor's internal bufferCONTINUE
if needed.Essentially, we have to do some extra work every time we underrun the internal cursor buffer.
Not saying it's bad, but if we had a lil micro task that fired from the consuming thread when the internal buffer reached a "low water mark" threshold, the micro task would go out and work with the
Connection
to pull in cursor items as fast as possible to refill the internal cursor buffer up to a "high water mark" threshold.Worst case, cons: The consuming thread is just way too fast at consuming cursor items and the server is being a slow poke. Having a system like this would lead to unnecessary overhead with things like
ConcurentQueue
.Best case, pros: The consuming thread has very little "cursor maintenance" to do, and is hardly blocked or awaited on.
Maybe we could have the best of both words, two cursor implementations, and let the user pick.
So, when the user calls
RunCursor<T>
run helper, they can pass a parameter that specifies they want a coolCursor
with a micro task pump:💥 cool. maybe it doesn't matter to ppl, but still bad-ass cool.
🌷 🌹 _"Sciuri, sciuri... sciuri di tuttu l'annu ..."_
The text was updated successfully, but these errors were encountered: