forked from TrueCloudLab/xk6-frostfs
[#5] Avoid payload copy in put methods
With goja.ArrayBuffer type VU won't perform copy operation during every put invocation. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
b17261cc3c
commit
1c0abb2479
4 changed files with 8 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { uuidv4 } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
|
import { uuidv4 } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
|
||||||
import native from 'k6/x/neofs/native';
|
import native from 'k6/x/neofs/native';
|
||||||
|
|
||||||
const payload = new Uint8Array(open('../go.sum', 'b'));
|
const payload = open('../go.sum', 'b');
|
||||||
const container = "AjSxSNNXbJUDPqqKYm1VbFVDGCakbpUNH8aGjPmGAH3B"
|
const container = "AjSxSNNXbJUDPqqKYm1VbFVDGCakbpUNH8aGjPmGAH3B"
|
||||||
const neofs_cli = native.connect("s01.neofs.devenv:8080", "")
|
const neofs_cli = native.connect("s01.neofs.devenv:8080", "")
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { uuidv4 } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
|
import { uuidv4 } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
|
||||||
import s3 from 'k6/x/neofs/s3';
|
import s3 from 'k6/x/neofs/s3';
|
||||||
|
|
||||||
const payload = new Uint8Array(open('../go.sum', 'b'));
|
const payload = open('../go.sum', 'b');
|
||||||
const bucket = "cats"
|
const bucket = "cats"
|
||||||
const s3_cli = s3.connect("http://s3.neofs.devenv:8080")
|
const s3_cli = s3.connect("http://s3.neofs.devenv:8080")
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/dop251/goja"
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||||
|
@ -37,8 +38,8 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) Put(inputContainerID string, headers map[string]string, payload []byte) PutResponse {
|
func (c *Client) Put(inputContainerID string, headers map[string]string, payload goja.ArrayBuffer) PutResponse {
|
||||||
rdr := bytes.NewReader(payload)
|
rdr := bytes.NewReader(payload.Bytes())
|
||||||
sz := rdr.Size()
|
sz := rdr.Size()
|
||||||
|
|
||||||
// preparation stage
|
// preparation stage
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go-v2/aws"
|
"github.com/aws/aws-sdk-go-v2/aws"
|
||||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||||
|
"github.com/dop251/goja"
|
||||||
"github.com/nspcc-dev/xk6-neofs/internal/stats"
|
"github.com/nspcc-dev/xk6-neofs/internal/stats"
|
||||||
"go.k6.io/k6/js/modules"
|
"go.k6.io/k6/js/modules"
|
||||||
"go.k6.io/k6/metrics"
|
"go.k6.io/k6/metrics"
|
||||||
|
@ -29,8 +30,8 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) Put(bucket, key string, payload []byte) PutResponse {
|
func (c *Client) Put(bucket, key string, payload goja.ArrayBuffer) PutResponse {
|
||||||
rdr := bytes.NewReader(payload)
|
rdr := bytes.NewReader(payload.Bytes())
|
||||||
sz := rdr.Size()
|
sz := rdr.Size()
|
||||||
|
|
||||||
stats.Report(c.vu, objPutTotal, 1)
|
stats.Report(c.vu, objPutTotal, 1)
|
||||||
|
|
Loading…
Reference in a new issue