You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/03/30 00:26:35 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1798: chore(bindings/nodejs): update presign example and init benchmark

Xuanwo commented on code in PR #1798:
URL: https://github.com/apache/incubator-opendal/pull/1798#discussion_r1152613958


##########
bindings/nodejs/examples/presign.js:
##########


Review Comment:
   This example is too complex to me. I prefer to only have an example for `presign`. Maybe we can remove this file, and add example for `presign` function. Like we does for 
   
   https://github.com/apache/incubator-opendal/blob/3ac7f07fd4f85b757be5552270fec2af7cf900cc/core/src/types/operator/operator.rs#L919-L944



##########
bindings/nodejs/benchmark/index.js:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const { suite, add, cycle, complete } = require('benny')
+const { Operator } = require('../index')
+const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3')
+const { Upload } = require('@aws-sdk/lib-storage')
+const crypto = require('crypto')
+
+const opendal = new Operator('s3', {
+  root: '/',
+  bucket: 'benchmark',
+  endpoint: process.env.AWS_S3_ENDPOINT,
+})
+
+const client = new S3Client({
+  endpoint: process.env.AWS_S3_ENDPOINT,
+  region: process.env.AWS_S3_REGION,
+  credentials: {
+    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
+    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
+  },
+  bucket: 'benchmark',
+})
+
+const s3 = {
+  write: (path, data) => {
+    const command = new PutObjectCommand({
+      Body: data,
+      Key: path,
+      Bucket: 'benchmark',
+    })
+    return client.send(command)
+  },
+  parallelUpload: (path, data) => {

Review Comment:
   I would rather remove this case to maintain a simpler benchmark. Starting from a simple baseline is more beneficial for us. Additionally, I am particularly interested in the `read` performance as opposed to the `write` performance.



##########
bindings/nodejs/package.json:
##########
@@ -43,11 +43,16 @@
     "NOTICE"
   ],
   "devDependencies": {
+    "@aws-sdk/abort-controller": "^3.296.0",
+    "@aws-sdk/client-s3": "^3.301.0",
+    "@aws-sdk/lib-storage": "^3.301.0",
+    "@aws-sdk/s3-request-presigner": "^3.301.0",

Review Comment:
   **question**: Seems we didn't use this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org