Replies: 2 comments 4 replies
-
Hi @proost, Thank you for the proposal. The two waiting counters and their implementation look good to me. However, I am afraid that these two metrics can't help us improve latencies. Latencies depend on how fast we flush the output buffer and how fast we deliver responses back. In other words, I think we should probably monitor _backgroundWrite() and _backgroundRead(), not the ring. |
Beta Was this translation helpful? Give feedback.
4 replies
-
Close due to lack of usage ring buffer stats |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Adding ring buffer monitoring stats method. ring buffer monitoring helps to find debugging increasing latency and resource sweet spot.
Problem Definition
Background
rueidis
is queuing redis commands to use connections effectively and efficiently with high throughput. But sometime commands queue can be bottleneck of latency. Although rueidis supportsRingScaleEachConn
andPipelineMultiplex
options to tune commands queue, it is not easy to find sweet spot. Because it is hard to monitor commands queue.Goal
High Level Plan
Queue
We should add returning queue stats function.
commandQueueStats
has state of queue. UsingcommandQueueStats
, we can monitorqueue
Wire
We should add returning queue stats function.
wire
returns own queue stats to callqueue.Stats
conn
conn
can have multiplewire
s. So we have to supports how manywire
has and sum ofwaitingForWriteCommandsCount
and sum ofwaitingForResultCommandsCount
. Using 3 fields, we can deduce average ofwaitingForWriteCommandsCount
and average ofwaitingForResultCommandsCount
.Client
We define new interface
ClientStatsProvider
.ClientStatsProvider
returnsStats
of client.We can’t add
Stats()
method toClient
directly. Because adding new method can be breaking change to some implementations ofClient
interface .Detailed Plan
ring
ring
struct has two fieldswaitingForWriteCount
,waitingForResultCount
waitingForWriteCount
increase by one when before returningPutOne
,PutMulti
.waitingForWriteCount
decrease by one whenn.mark
equals 1 inNextWriteCmd
, before returningWaitForWrite
.waitingForResultCount
increase by one whenn.mark
equals 1 inNextWriteCmd
, before returningWaitForWrite
.waitingForResultCount
decrease by one whenn.mark
equals 2 inNextResultCh
.above operations must be atomic.
Also, we should support
Stats
method.pipe
mux
singleClient
sentinelClient
clusterClient
How to use stats?
I expect that
Stats()
is called periodically in loop which is made by user.Beta Was this translation helpful? Give feedback.
All reactions