MM-43733: Set concurrency limits via configuration (#20413)
```release-note We create a new config option MaxImageDecoderConcurrency which indicates how many images can be decoded concurrently at once. The default is -1 which means number of CPUs present. This affects the total memory consumption of the server. The maximum memory of a single image is dictated by MaxImageResolution * 24 bytes. Therefore, a good rule of thumb to follow is that MaxImageResolution * MaxImageDecoderConcurrency * 24 should be less then the allocated memory for image decoding. ``` https://mattermost.atlassian.net/browse/MM-43733
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4b8cb4e272
Коммит
7c1b8cd937
@@ -197,8 +197,12 @@ func NewChannels(s *Server, services map[ServiceKey]interface{}) (*Channels, err
|
||||
}
|
||||
|
||||
var imgErr error
|
||||
decoderConcurrency := int(*ch.cfgSvc.Config().FileSettings.MaxImageDecoderConcurrency)
|
||||
if decoderConcurrency == -1 {
|
||||
decoderConcurrency = runtime.NumCPU()
|
||||
}
|
||||
ch.imgDecoder, imgErr = imaging.NewDecoder(imaging.DecoderOptions{
|
||||
ConcurrencyLevel: runtime.NumCPU(),
|
||||
ConcurrencyLevel: decoderConcurrency,
|
||||
})
|
||||
if imgErr != nil {
|
||||
return nil, errors.Wrap(imgErr, "failed to create image decoder")
|
||||
|
||||
Ссылка в новой задаче
Block a user