Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
2020年2月13日_Cloud_Native_Meetup_Tokyo.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Noriyuki TAKEI
February 13, 2020
Technology
74
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
2020年2月13日_Cloud_Native_Meetup_Tokyo.pdf
Noriyuki TAKEI
February 13, 2020
More Decks by Noriyuki TAKEI
See All by Noriyuki TAKEI
ループエンジニアリングでE2Eテストを実践
noriyukitakei
0
370
第50回 Tokyo Jazug Night/react-deepdive
noriyukitakei
0
96
RAG構築のためのAzure OpenAI Serviceリファレンスアーキテクチャ詳解/wakarimiragarchitecture
noriyukitakei
0
290
生成AI時代の検索手法〜スターウォーズの登場人物で紐解くベクトル/セマンティック/ハイブリッド検索〜/wakarimiaisearch
noriyukitakei
0
100
Prompt flowでブログ記事紹介ツイートアプリをラクチン開発/wakarimipromptflow
noriyukitakei
0
69
世界一わかりみの深いAzure OpenAI Service/wakarimiaoai
noriyukitakei
1
930
AIとペアプロ!! ChatGPTとGitHub Copilotで ToDoアプリを爆速ライブコーディング/wakarimigithubcopilot
noriyukitakei
0
100
世界一わかりみの深いApplicationGateway/wakarimiappilicationgateway
noriyukitakei
0
410
クラウドデザインパターンを使ってクールな設計をしよう/jazug12th
noriyukitakei
1
430
Other Decks in Technology
See All in Technology
AI、CDK と協働する Full TypeScript アプリケーション開発 / Full TypeScript Application with AI and CDK
geekplus_tech
2
360
凡エンジニアがこの先生きのこるためには。〜TypeScript完全に理解したい〜
alchemy1115
2
310
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
5.9k
AI時代のPlaywright活用(システムテストを自動化する ー 実行エンジンにPla ywrightを選んだ理由)
ynisqa1988
0
130
LLM/Agent評価:トップ営業の発言を「正解」にする 〜暗黙的正解による評価を営業資産に変える〜
takkuhiro
1
230
穢れた技術選定について
watany
17
5.4k
タスクの複雑さでモデルを選ぶ ── Thompson Samplingで動かす“トークン/コスト最適化
satohy0323
0
550
関数型の考えを TypeScript に持ち込んで、テストしやすい純粋関数を増やす / Pure at the Core, Effects at the Edge: Bringing Functional Thinking into TypeScript
kaminashi
2
130
AI Coding Agent時代のcdk-nagガードレール 〜組織ルールを強制CIで守り抜く設計の挑戦〜
mhrtech
3
390
シンガポールで登壇してきます
yama3133
0
240
美しいコードを書くためにF#を学んでみた話
yud0uhu
1
460
はじめてのWDM
miyukichi_ospf
1
150
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
360
A Soul's Torment
seathinner
6
3.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
190
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
Building Adaptive Systems
keathley
44
3.1k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
410
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
340
Transcript
© SIOS Technology, Inc. All rights Reserved. Azure Kubernetes Service
+ Seleniumで実現する お⼿軽負荷テスト環境 2020年2⽉13⽇ Cloud Native Meetup Tokyo #12
© SIOS Technology, Inc. All rights Reserved. About me 2
Internal Only BCPVUNF Noriyuki TAKEI Ҫ ٓߦ Information • サイオステクノロジー株式会社 • 千葉県在住 Favorites • Azure • Squash • Sweets blog https://tech-lab.sios.jp/ core skill Azure Kubernetes Service Cloud Native, Serverless全般 Twitter @noriyukitakei
© SIOS Technology, Inc. All rights Reserved. WordPress on k8s
3 Internal Only Internal Only https://tech-lab.sios.jp/archives/18591 今回のセッションのお話は、弊社技術ブログでも ご覧頂けます。 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
4 Internal Only ハッシュタグ #cloudnativejp もしくは @noriyukitakei に忌憚ないご意⾒ お願いいたします 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
5 Internal Only 負荷テストといえば やっぱり JMeterあたり、、、。 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
6 Internal Only でも⼀つ問題が。。。 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
7 Internal Only 弊社開発製品の OpenID Connectの シーケンスですが、マ ジで複雑、、、。 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
8 Internal Only OpenID ConnectのIDトークンはシーケンスによってはクライアントの ブラウザからPostされる形でサーバー側に渡るので、それをParseしな ければいけない、、、。 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
9 Internal Only Jmeterで正規表現 書くのめんどくさい 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
10 Internal Only 本セッションの ブログのURL そこで Selenium︕︕
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
11 Internal Only ブラウザのオートメーションツール Headless Chrome / Firefox使えば GUIのない環境でも動作可能 Javaなど複数の⾔語むけにSDKが提供されている 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
12 Internal Only // アクセスする driver.get("https://hogehoge.example.com/test.php"); // ログイン // ID⼊⼒ wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("loginfmt"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("idSIButton9"))); driver.findElement(By.name("loginfmt")).sendKeys(userData.getUserName()); driver.findElement(By.id("idSIButton9")).click(); // パスワード⼊⼒ wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("passwd"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("idSIButton9"))); driver.findElement(By.name("passwd")).sendKeys(userData.getPassword()); driver.findElement(By.id("idSIButton9")).click(); JavaのSDKによるSeleniumのプログラムです。とあるログイン画⾯へ のIDとパスワードを送信しています。 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
13 Internal Only 本セッションの ブログのURL Seleniumだったら ブラウザの動きを エミュレートしているだけなので、 シナリオづくり楽︕︕
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
14 Internal Only 本セッションの ブログのURL でも、 JMeterに⽐べて重いのでは︖ Jmeterは1リクエスト1スレッドで 動作するけど、Seleniumは 1プロセス1リクエストになる、、、。
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
15 Internal Only 本セッションの ブログのURL そこで Azure Kubernetes Service︕︕
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
16 Internal Only 本セッションの ブログのURL ログインする処理を実 現するSelenium(Java) をPodにデプロイ Pod間で共有するVolumeにロ グを出⼒ FluetndがApplication Insightsにログを送って、 Application Insightsのア ラートによりエラーが出た ら通知
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
17 Internal Only 本セッションの ブログのURL マネージドなサービスなので、ノード 数を動的に増やすことができる。ノー ド数増やせば負荷を増やすことができ る。
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
18 Internal Only FROM centos:7 RUN yum -y install java-1.8.0-openjdk wget unzip # 最新のSelenium Driverが最新のChromeに対応していないので、旧バージョンのSeleniumをダウンロ ードして実⾏します。 RUN wget http://dist.control.lth.se/public/CentOS-7/x86_64/google.x86_64/Packages/google- chrome-stable-71.0.3578.98-1.x86_64.rpm -P /tmp && \ yum -y install libOSMesa google-noto-cjk-fonts && \ yum -y localinstall /tmp/google-chrome-stable-71.0.3578.98-1.x86_64.rpm # Selenium Driverをダウンロードしインストールします。 RUN wget https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_linux64.zip && \ unzip chromedriver_linux64.zip && \ mv chromedriver /usr/local/bin/ && \ chown root:root /usr/local/bin/chromedriver Dockerfile 本セッションの ブログのURL Seleniumスクリプト実⾏⽤Dockerコンテナのイメージを作ります。
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
19 Internal Only # Chromeを実⾏するために必要なライブラリをインストールします。 RUN yum -y install libX11 GConf2 fontconfig # 負荷テストかけるアプリケーションをstresstest.jarという実⾏形式のjarファイルにして、 # 所定のディレクトリに配置します。 RUN mkdir -p /opt/stress-test/bin COPY ./stresstest.jar /opt/stress-test/bin RUN mkdir -p /opt/stress-test/data COPY ./test.csv /opt/stress-test/data # 負荷テストをかけるJavaアプリケーションを実⾏します。 CMD ["java","-jar","/opt/stress-test/bin/stresstest.jar"] Dockerfile 本セッションの ブログのURL 〜 前ページからの続き 〜
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
20 Internal Only <source> @type tail # Seleniumが吐き出すログの出⼒パスです。 path /var/log/stresstest/stress-test.log tag selenium.selenium <parse> @type none </parse> </source> <match **> @type application_insights # Application InsightsのInsturmentation Keyを指定しています。 instrumentation_key <Application InsightsのInsturmentation Key> </match> fluent.conf 本セッションの ブログのURL Seleniumが吐き出したログをApplication Insightsに出⼒するコンテナ のイメージを作成します。まず、fluentdの設定ファイルである fluent.confを以下のように作成します。
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
21 # fluentdのOffical Imageを使います。 FROM fluent/fluentd:v1.7-1 # fluentdのOfficial Imageのサイト(https://hub.docker.com/r/fluent/fluentd/)に # 書いてあるとおりにカスタマイズする。ただし13⾏⽬の部分はApplication Insights⽤の # プラグイン(https://github.com/microsoft/fluent-plugin-application-insights)を # インストールするように変更する。 USER root RUN apk add --no-cache --update --virtual .build-deps \ sudo build-base ruby-dev \ # cutomize following instruction as you wish && sudo gem install fluent-plugin-application-insights \ && sudo gem sources --clear-all \ && apk del .build-deps \ && rm -rf /home/fluent/.gem/ruby/2.5.0/cache/*.gem COPY fluent.conf /fluentd/etc/ USER fluent fluent.conf 本セッションの ブログのURL 次に以下のDockerfileを作成して、コンテナのイメージを作成します。
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
22 # Seleniumを実⾏するアプリケーションをデプ ロイするためのマニフェストです。 apiVersion: apps/v1beta1 kind: Deployment metadata: name: stress-test spec: # ここで指定した下図だけSeleniumが # 起動します。同時に負荷をかけたい接続数を # 指定して下さい。 replicas: 10 selector: matchLabels: app: stress-test template: metadata: labels: app: stress-test deployment.yml Seleniumを実⾏するアプリケーションをデプロイするためのマニフェス トです。 spec: containers: - name: stt image: ntakeiacr.azurecr.io/stt:1.4 # fluentdとログを共有するための # Volumeをmountします。 volumeMounts: - mountPath: /var/log/stresstest name: log-volume imagePullSecrets: - name: docker-reg-credential # fluentdとログを共有するための # Volumeを作成します。 # Pod間でデータを共有したいので # hostPathとします。 volumes: - name: log-volume hostPath: path: /var/log/stresstest 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
23 # fluentdを実⾏するためのマニフェストです。 # サイドカーとして配置するので、 # 各Nodeに⼀つづつ配置します。そのため # リソースの種別はDamemonSetとしています。 apiVersion: apps/v1 kind: DaemonSet metadata: name: fluentd spec: selector: matchLabels: app: fluentd template: metadata: labels: app: fluentd deployment.yml fluentdを実⾏するアプリケーションをデプロイするためのマニフェスト です。 spec: containers: - image: ntakeiacr.azurecr.io/fluentd:1.2 name: fluentd # Seleniumとログを共有するための # Volumeをmountします。 volumeMounts: - mountPath: /var/log/stresstest name: log-volume imagePullSecrets: - name: docker-reg-credential # Seleniumとログを共有するための # Volumeを作成します。 # Pod間でデータを共有したいので # hostPathとします。 volumes: - name: log-volume hostPath: path: /var/log/stresstest 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
24 Internal Only 本セッションの ブログのURL まとめ︕︕
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
25 Internal Only シナリオづくりが簡単 ノード数を増やせば、簡単に負荷を増やすことができる。 Javaなど複数の⾔語むけにSDKが提供されている。 開発の間⼝が広い︕︕ メリット 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
26 Internal Only Jmeterのようにたくさんの負荷をかけることは出来ない。 そこそこの負荷の要件のときしかマッチしない。 ノード数を増やすことで負荷を増やすので、 お⾦がかかる。⻑時間負荷をかけられない。 なんとなく、Kubernetesの正しい使い⽅で ないような気もする、、、。 デメリット 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. Selenium on AKSでお⼿軽負荷テスト
27 Internal Only うっかりKubernetesクラスター削除し 忘れると1⽇でこういうことになりま す、、、。 本セッションの ブログのURL
© SIOS Technology, Inc. All rights Reserved. さいごに 28 Internal
Only Internal Only https://tech-lab.sios.jp/ 弊社技術ブログは、 下記URLでお届けしております。⾒てね︕︕
ご清聴ありがとうございました