Skip to content

Add user latency tracking#3

Merged
stevenlanders merged 4 commits intomainfrom
steven/add-user-latency-tracking
Aug 4, 2025
Merged

Add user latency tracking#3
stevenlanders merged 4 commits intomainfrom
steven/add-user-latency-tracking

Conversation

@stevenlanders
Copy link
Copy Markdown
Collaborator

Notes:

  • New flag --track-user-latency will track user latency metrics.
  • It samples the latest block every --stats-interval and calculates the latency in that block.
  • The latency is the block timestamp minus the value in the tx (value is set to time in epoch).
  • The resolution here is seconds because block timestamps are in seconds. In general if our timing is subsecond we're okay.
  • A lower --buffer-size can keep this lower.
  • If this value is high, it could be that things are sitting in the mempool longer than they should.
2025/08/04 09:37:18 ============================================================
2025/08/04 09:37:28 throughput tps=152.30, txs=1523,  latency(avg=7ms p50=4ms p99=32ms max=87ms)
2025/08/04 09:37:29 user latency height=6908 txs=21 min=0s p50=0s max=0s
2025/08/04 09:37:38 throughput tps=104.40, txs=2567,  latency(avg=10ms p50=6ms p99=33ms max=111ms)
2025/08/04 09:37:38 user latency height=6940 txs=57 min=0s p50=0s max=0s
2025/08/04 09:37:48 throughput tps=166.30, txs=4230,  latency(avg=6ms p50=5ms p99=30ms max=111ms)
2025/08/04 09:37:48 user latency height=6977 txs=15 min=1s p50=1s max=1s

Comment thread sender/dispatcher.go Outdated
limiter := d.limiter
d.mu.RUnlock()
for i := range count {
for i := 0; i < count; i++ {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Comment thread stats/user_latency_tracker.go Outdated

for {
select {
case <-ctx.Done():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utils.Recv(ctx, ticker.C)

Comment thread stats/user_latency_tracker.go Outdated

// Create ticker for the configured interval
ticker := time.NewTicker(ult.interval)
defer ticker.Stop()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to stop the ticker - it is GCed correctly since go 1.23 I think

Comment thread stats/user_latency_tracker.go Outdated

// UserLatencyTracker tracks user latency by analyzing block transactions
type UserLatencyTracker struct {
endpoint string
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems unused

@stevenlanders stevenlanders merged commit 7c06b60 into main Aug 4, 2025
1 check passed
@stevenlanders stevenlanders deleted the steven/add-user-latency-tracking branch August 4, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants