iris: Poor performance of session.UpdateExpiration on 200 thousands+ keys with new radix lib
Hello Makis!
I have more 200 thousands key in redis on prod server and found that after upgrading iris on v11 from redigo to radix lib that I have problems with perfomance when calling session.UpdateExpiration method (it`s executing minimum 10 seconds on a powerful prod server and more than 30 seconds on usual local).
While debugging I found place where freezes, it`s here:
func (r *Service) UpdateTTLMany(prefix string, newSecondsLifeTime int64) error {
keys, err := r.getKeys(prefix)
if err != nil {
return err
}
...
}
and inside getKeys here:
scanner := radix.NewScanner(r.pool, radix.ScanOpts{
Command: "SCAN",
Pattern: r.Config.Prefix + prefix + r.Config.Delim + "*", // get all of this session except its root sid.
// Count: 9999999999,
})
var key string
for scanner.Next(&key) {
keys = append(keys, key)
}
Just has watched old v10 iris and old method getKeysConn did not cause such delay …
func (r *Service) getKeysConn(c redis.Conn, prefix string) ([]string, error) {
if err := c.Send("SCAN", 0, "MATCH", r.Config.Prefix+prefix+"*", "COUNT", 9999999999); err != nil {
return nil, err
}
if err := c.Flush(); err != nil {
return nil, err
}
reply, err := c.Receive()
if err != nil || reply == nil {
return nil, err
}
Maybe reason in difference between old and new scan commands? Could you help?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (10 by maintainers)
Commits related to this issue
- redis sessiondb: support more than one driver - builtin redigo(default) and radix - rel to: #1328 — committed to kataras/iris by kataras 5 years ago
- improvement for https://github.com/kataras/iris/issues/1328#issuecomment-522952979 — committed to kataras/iris by kataras 5 years ago
- fix radix get keys issue described at: #1328 — committed to kataras/iris by kataras 5 years ago
- redis sessiondb: support more than one driver - builtin redigo(default) and radix - rel to: #1328 Former-commit-id: 1eee58f2c49f64899fffc3ad61bcf074f8949cc1 — committed to goproxies/github.com-kataras-iris by kataras 5 years ago
- improvement for https://github.com/kataras/iris/issues/1328#issuecomment-522952979 Former-commit-id: a2519c17a039b67129bd5683e9e9a1239c441c0a — committed to goproxies/github.com-kataras-iris by kataras 5 years ago
- fix radix get keys issue described at: #1328 Former-commit-id: beaf1f301ba8967fb7b56dc670818dedda324819 — committed to goproxies/github.com-kataras-iris by kataras 5 years ago
yes it is true . Bravo. Good point Thank You @kataras .
@kataras Hello Makis! Today I pushed changes to prod server, all works fine now, no problem with perfomance at all! Thank you again!