xorm 开启redis缓存,并发超过MaxOpenConns数后程序阻塞 #1381

Open
opened 2019-08-03 00:54:38 +00:00 by baiweiyll · 0 comments
baiweiyll commented 2019-08-03 00:54:38 +00:00 (Migrated from github.com)

xorm开启redis缓存并设置MaxOpenConns=15
执行 ab -c 15 -n 100 http://localhost:8080/v2/users/xorm@xorm.com后,所有数据库接口阻塞,其他接口正常响应,查看pprof
xorm
sql :
engine.SetMaxIdleConns(5)
engine.SetMaxOpenConns(15)
engine.SetConnMaxLifetime(30 * time.Second)
engine.Where("email=? AND mark=?", email, types.UserUnDeleted).Get(users)
engine.SetDefaultCacher(cacher)
cache:
cStore = cachestore.NewRedisCache(cfg)
cacher = xorm.NewLRUCacher2(cStore, cacheConf.ExpiredTime, mes)
version:
github.com/go-xorm/builder v0.1.0
github.com/go-xorm/cachestore v0.0.0-20170409031804-adfa3466c8e4
github.com/go-xorm/core v0.5.8
github.com/go-xorm/xorm v0.7.0

xorm开启redis缓存并设置MaxOpenConns=15 执行 ab -c 15 -n 100 http://localhost:8080/v2/users/xorm@xorm.com后,所有数据库接口阻塞,其他接口正常响应,查看pprof ![xorm](https://user-images.githubusercontent.com/7495193/62404936-3a24f580-b5cb-11e9-981c-11a9dd235f86.jpg) sql : engine.SetMaxIdleConns(5) engine.SetMaxOpenConns(15) engine.SetConnMaxLifetime(30 * time.Second) engine.Where("email=? AND mark=?", email, types.UserUnDeleted).Get(users) engine.SetDefaultCacher(cacher) cache: cStore = cachestore.NewRedisCache(cfg) cacher = xorm.NewLRUCacher2(cStore, cacheConf.ExpiredTime, mes) version: github.com/go-xorm/builder v0.1.0 github.com/go-xorm/cachestore v0.0.0-20170409031804-adfa3466c8e4 github.com/go-xorm/core v0.5.8 github.com/go-xorm/xorm v0.7.0
lunny added the
need
test
label 2021-06-12 09:40:59 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1381
No description provided.