Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cache/disk/casblob/casblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const (

var zstdFastestLevel = zstd.WithEncoderLevel(zstd.SpeedFastest)

var encoder, _ = zstd.NewWriter(nil, zstdFastestLevel) // TODO: raise WithEncoderConcurrency ?
var decoder, _ = zstd.NewReader(nil) // TODO: raise WithDecoderConcurrency ?
var encoder, _ = zstd.NewWriter(nil, zstdFastestLevel, zstd.WithLowerEncoderMem(true)) // TODO: raise WithEncoderConcurrency ?
var decoder, _ = zstd.NewReader(nil, zstd.WithDecoderLowmem(true)) // TODO: raise WithDecoderConcurrency ?

var encoderPool = zstdpool.GetEncoderPool()
var decoderPool = zstdpool.GetDecoderPool()
Expand Down
2 changes: 1 addition & 1 deletion server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

var blobNameSHA256 = regexp.MustCompile("^/?(.*/)?(ac/|cas/)([a-f0-9]{64})$")

var decoder, _ = zstd.NewReader(nil) // TODO: raise WithDecoderConcurrency ?
var decoder, _ = zstd.NewReader(nil, zstd.WithDecoderLowmem(true)) // TODO: raise WithDecoderConcurrency ?

// HTTPCache ...
type HTTPCache interface {
Expand Down
6 changes: 4 additions & 2 deletions utils/zstdpool/zstdpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ func GetEncoderPool() *sync.Pool {
onceEncPool.Do(func() {
encoderPool = syncpool.NewEncoderPool(
zstd.WithEncoderConcurrency(1),
zstd.WithEncoderLevel(zstd.SpeedFastest))
zstd.WithEncoderLevel(zstd.SpeedFastest),
zstd.WithLowerEncoderMem(true))
})

return encoderPool
Expand All @@ -26,7 +27,8 @@ func GetEncoderPool() *sync.Pool {
func GetDecoderPool() *sync.Pool {
onceDecPool.Do(func() {
decoderPool = syncpool.NewDecoderPool(
zstd.WithDecoderConcurrency(1))
zstd.WithDecoderConcurrency(1),
zstd.WithDecoderLowmem(true))
})

return decoderPool
Expand Down