MM-59934: Add Redis to CI and other improvements (#28164)

- Update library version.
- Added MaxFlush delay to help reduce CPU usage.
- Fall back to LRU cache for the caches which use SCAN.
- Added mattermost-redis and running for all api layer
tests in Postgres.

https://mattermost.atlassian.net/browse/MM-59934
```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2024-09-18 19:13:44 +05:30
коммит произвёл GitHub
родитель 02dfc2d205
Коммит 75ed2860ac
15 изменённых файлов: 88 добавлений и 29 удалений

11
server/platform/services/cache/provider.go поставляемый
Просмотреть файл

@@ -82,6 +82,7 @@ type RedisOptions struct {
RedisAddr string
RedisPassword string
RedisDB int
DisableCache bool
}
// NewProvider creates a new CacheProvider
@@ -91,8 +92,14 @@ func NewRedisProvider(opts *RedisOptions) (Provider, error) {
Password: opts.RedisPassword,
SelectDB: opts.RedisDB,
ForceSingleClient: true,
CacheSizeEachConn: 16 * (1 << 20), // 16MiB local cache size
//TODO: look into MaxFlushDelay
CacheSizeEachConn: 32 * (1 << 20), // 32MiB local cache size
DisableCache: opts.DisableCache,
// This is used to collect more commands before flushing to Redis.
// This increases latency at the cost of lower CPU usage at Redis.
// It's a tradeoff we are willing to make because Redis is only
// meant to be used at very high scales. The docs suggest 20us,
// but going as high as 250us doesn't make any material difference.
MaxFlushDelay: 250 * time.Microsecond,
})
if err != nil {
return nil, err