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:
Harshavardhana
2023-11-06 14:26:08 -08:00
committed by GitHub
parent 64bafe1dfe
commit 754f7a8a39
14 changed files with 78 additions and 57 deletions

View File

@@ -34,6 +34,7 @@ import (
elasticsearch7 "github.com/elastic/go-elasticsearch/v7"
"github.com/minio/highwayhash"
"github.com/minio/minio/internal/event"
xioutil "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/once"
"github.com/minio/minio/internal/store"
@@ -474,7 +475,7 @@ func (c *esClientV7) createIndex(args ElasticsearchArgs) error {
if err != nil {
return err
}
defer DrainBody(resp.Body)
defer xioutil.DiscardReader(resp.Body)
if resp.IsError() {
return fmt.Errorf("Create index err: %v", res)
}
@@ -490,7 +491,7 @@ func (c *esClientV7) ping(ctx context.Context, _ ElasticsearchArgs) (bool, error
if err != nil {
return false, store.ErrNotConnected
}
DrainBody(resp.Body)
xioutil.DiscardReader(resp.Body)
return !resp.IsError(), nil
}
@@ -503,7 +504,7 @@ func (c *esClientV7) entryExists(ctx context.Context, index string, key string)
if err != nil {
return false, err
}
DrainBody(res.Body)
xioutil.DiscardReader(res.Body)
return !res.IsError(), nil
}
@@ -518,7 +519,7 @@ func (c *esClientV7) removeEntry(ctx context.Context, index string, key string)
if err != nil {
return err
}
defer DrainBody(res.Body)
defer xioutil.DiscardReader(res.Body)
if res.IsError() {
return fmt.Errorf("Delete err: %s", res.String())
}
@@ -546,7 +547,7 @@ func (c *esClientV7) updateEntry(ctx context.Context, index string, key string,
if err != nil {
return err
}
defer DrainBody(res.Body)
defer xioutil.DiscardReader(res.Body)
if res.IsError() {
return fmt.Errorf("Update err: %s", res.String())
}
@@ -572,7 +573,7 @@ func (c *esClientV7) addEntry(ctx context.Context, index string, eventData event
if err != nil {
return err
}
defer DrainBody(res.Body)
defer xioutil.DiscardReader(res.Body)
if res.IsError() {
return fmt.Errorf("Add err: %s", res.String())
}