1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SageMaker AIにGatlingで負荷試験をする

Last updated at Posted at 2025-12-11

概要

SageMaker AIに対してGatlingで負荷試験を実施する方法についてまとめます。
今回はローカルからSageMaker AIに負荷試験を実施する方法です。

利用する技術

  • sagemaker-gatling

実施方法

まずは上記ツールをcloneしてきます。
まずSageMaker AIにリクエストするにはAWS SigV4認証したリクエストで送信する必要があります。
なので利用しているAWSアカウントのAccessKey, SecretAccessKey, SessionTokenをコピーします。
image.png

次にそれをsrc/test/resources/application.confに書きます。

auth {
  awsAccessKeyId = "xxx"
  awsSecretAccessKey = "xxx"
  awsSessionToken = "xxx"
}

次にSageMaker AIの設定についてもsrc/test/resources/application.confで書き換えます。

sagemaker {
  host = "runtime.sagemaker.ap-northeast-1.amazonaws.com"
  region = "ap-northeast-1"
  endpoint = "${作成したエンドポイント名}"
}

次にSageMaker AIにリクエストを送信するためのjsonも作成します。これは

{
  "inputs": [
    {
      "name": "query",
      "shape": [1],
      "datatype": "BYTES",
      "data": ["テスト"]
    }
  ],
  "outputs": [
     { "name": "sentence_embedding" }
  ]
}

作成したjsonもapplication.confのrequestsのpathで指定してあげます。

  requests = """[
    {
      "path": "bodies/1/input.json",
      "weight": 100
    }
  ]"""

ここまでできれば準備完了です。以下のコマンドを実行して、Gatlingを実行します。

mvn clean package gatling:test -f pom.xml \
-Dgatling.simulationClass=GenericSageMakerScenario

ターミナル上でOKがカウントされ続ければリクエストが送られています。

================================================================================


================================================================================
2025-12-10 12:56:45 GMT                                     655s elapsed
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=625    KO=0     )
> SageMaker-xxx... (OK=625    KO=0     )

---- SageMaker -----------------------------------------------------------------
[#########################################################################-] 99%
          waiting: 4      / active: 1      / done: 625   
================================================================================


================================================================================
2025-12-10 12:56:49 GMT                                     659s elapsed
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=630    KO=0     )
> SageMaker-xxx... (OK=630    KO=0     )

---- SageMaker -----------------------------------------------------------------
[##########################################################################]100%
          waiting: 0      / active: 0      / done: 630   
================================================================================

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?