Closed fonoisrev closed 10 months ago
版本v1.1.0
使用内存缓存,如下配置
cache.NewGorm2Cache(&config.CacheConfig{ CacheLevel: config.CacheLevelAll, CacheStorage: config.CacheStorageMemory, InvalidateWhenUpdate: true, // when you create/update/delete objects, invalidate cache CacheTTL: 10000, // 10s CacheSize: 5000, // exceeds this number, then don't cache }
AfterUpdate方法耗时会慢慢累积,最终会导致数据读写操作均超时
以下是go trace看到的结果
首先可以看到AfterUpdate是耗时大户
大量的goroutine在AfterUpdate
scheduler wait
可以看到阻塞在写channel
对应的代码
这里为什么采用deletables chan *Item这样的设计?
实际上你已经跟到了ccache包里了,不是这个包的问题。另外这个往channel加是为了把链表里的item删掉
ccache
感谢楼上asjdf的评论,如果是因为ccache包的问题,您可以自行fork替换一下cache层的实现。我因为日常工作繁忙,投入时间不会很多。欢迎提交pr!
版本v1.1.0
使用内存缓存,如下配置
AfterUpdate方法耗时会慢慢累积,最终会导致数据读写操作均超时
以下是go trace看到的结果
首先可以看到AfterUpdate是耗时大户
大量的goroutine在AfterUpdate
scheduler wait
可以看到阻塞在写channel
对应的代码
这里为什么采用deletables chan *Item这样的设计?