-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wait statistics to pools #7
Conversation
redis/pool.go
Outdated
active int // the number of open connections in the pool | ||
ch chan struct{} // limits open connections when p.Wait is true | ||
idle idleList // idle connections | ||
waitCount int64 // Total number of connections waited for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency sake: Total -> total
redis/pool.go
Outdated
ch chan struct{} // limits open connections when p.Wait is true | ||
idle idleList // idle connections | ||
waitCount int64 // Total number of connections waited for. | ||
waitDuration time.Duration // Total time waited for new connections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency sake: Total -> total
redis/pool_test.go
Outdated
d.check_all(message, p, dialed, open, inuse, 0, 0) | ||
} | ||
|
||
func (d *poolDialer) check_all(message string, p *redis.Pool, dialed, open, inuse int, waitCountMax int64, waitDurationMax time.Duration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_all -> checkAll
|
||
// wait indicates if we believe it will block so its not 100% accurate | ||
// however for stats it should be good enough. | ||
wait := len(p.ch) == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inherently racey but if you want to just get wait stats when you think the channel will block, not sure there is any other way.
Is there any reason you can't do the wait stat calculation all the time? It'll be ~0 in non-blocking cases so maybe not much use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would just break the count as every request would flagged as waited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh thats not ideal
Add WaitCount and WaitDuration stats to pool stats to enable tracking of the delays introduced by waiting for connections from the pool. This uses the same properties as database/sql so its familiar to users. Addresses: gomodule#403
Add WaitCount and WaitDuration stats to pool stats to enable tracking of the delays introduced by waiting for connections from the pool.
This uses the same properties as database/sql so its familiar to users.
Addresses: gomodule#403