You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the example code, it uses const testFile = open('./bonjour.txt', 'r')open(). But as per the documentation, it suggests the usage of SharedArray.
Could you please clarify which is ideal for AWS? Thanks!
The text was updated successfully, but these errors were encountered:
You're right, the documentation is probably misleading in this specific scenario.
To offer you the best support, would you be able to tell me more about your use case? An example script would be even better if that's possible.
I realize the README examples are not up-to-date with the documentation itself (going to work on that) and might be misleading because they do not represent real-world scripts. In general, whenever possible, SharedArray should indeed be used.
Thanks @oleiade One of my use cases is, after executing the k6 script, I would like to upload my results (in CSV, JSON, or HTML) to S3. In this case, is using open() ideal, considering the file size for a simple load testing.
But for endurance testing, the duration would be like days. So, in this case, I believe using SharedArray() makes sense?
Unless I missed some aspect of your use case, you should be able to get away without using open(), nor SharedArray. In fact, you should be able to use S3Client.putObject with the summary data directly in the handleSummary() function (which is called only once at the end of the execution.
Would something along the lines of the following fit your use case?
importhttpfrom"k6/http";import{check}from"k6";import{AWSConfig,S3Client}from"https://jslib.k6.io/aws/0.3.0/s3.js";constawsConfig=newAWSConfig(__ENV.AWS_REGION,__ENV.AWS_ACCESS_KEY_ID,__ENV.AWS_SECRET_ACCESS_KEY);consts3=newS3Client(awsConfig);exportdefaultfunction(){letres=http.get("https://test-api.k6.io");check(res,{"is status 200": (r)=>r.status===200});}exportfunctionhandleSummary(data){s3.putObject("myBucket","myResultsKey",JSON.stringify(data));}
Hi Team,
As per the example code, it uses
const testFile = open('./bonjour.txt', 'r')
open()
. But as per the documentation, it suggests the usage ofSharedArray
.Could you please clarify which is ideal for AWS? Thanks!
The text was updated successfully, but these errors were encountered: