mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
replace io.Discard usage to fix some NUMA copy() latencies (#18394)
replace io.Discard usage to fix NUMA copy() latencies On NUMA systems copying from 8K buffer allocated via io.Discard leads to large latency build-up for every ``` copy(new8kbuf, largebuf) ``` can in-cur upto 1ms worth of latencies on NUMA systems due to memory sharding across NUMA nodes.
This commit is contained in:
@@ -33,6 +33,7 @@ import (
|
||||
"github.com/klauspost/compress/zstd"
|
||||
gzip "github.com/klauspost/pgzip"
|
||||
"github.com/minio/minio/internal/config"
|
||||
xioutil "github.com/minio/minio/internal/ioutil"
|
||||
"github.com/minio/minio/internal/s3select/csv"
|
||||
"github.com/minio/minio/internal/s3select/json"
|
||||
"github.com/minio/minio/internal/s3select/parquet"
|
||||
@@ -91,7 +92,7 @@ var bufioWriterPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
// io.Discard is just used to create the writer. Actual destination
|
||||
// writer is set later by Reset() before using it.
|
||||
return bufio.NewWriter(io.Discard)
|
||||
return bufio.NewWriter(xioutil.Discard)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -467,7 +468,7 @@ func (s3Select *S3Select) marshal(buf *bytes.Buffer, record sql.Record) error {
|
||||
// Use bufio Writer to prevent csv.Writer from allocating a new buffer.
|
||||
bufioWriter := bufioWriterPool.Get().(*bufio.Writer)
|
||||
defer func() {
|
||||
bufioWriter.Reset(io.Discard)
|
||||
bufioWriter.Reset(xioutil.Discard)
|
||||
bufioWriterPool.Put(bufioWriter)
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user