[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

【EC2】CPU使用率のsteal項目とは

システムソリューション部の中川です。

以前、あるサーバでCPU負荷が頻発していたため、調査したところ
AWSのEC2のうちT2系インスタンス特性によるということが分かりました。
良い機会でしたので、負荷原因と特性を調べてみました。

topコマンドの結果

top - 01:41:32 up 13 min, 1 user, load average: 0.17, 0.17, 0.08
Tasks: 88 total, 1 running, 87 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.7%us, 2.0%sy, 0.0%ni, 93.8%id, 3.0%wa, 0.0%hi, 0.0%si, 0.5%st
Mem: 1017372k total, 184052k used, 833320k free, 33848k buffers
Swap: 1048572k total, 52416k used, 996156k free, 24688k cached

Cpu(s):行の右端にある「st(steal)」という項目が関係しているとのことです。

CPU steal

馴染みがない項目だったのでで詳細を調べてみると、仮想サーバにおいて
「ゲストOSに処理を要求をしても、CPUリソースを割り当てられなかった時間の割合」
を意味するとのことです。
EC2には様々なインスタンスタイプがあり、その中でもT2系インスタンスは
一定の使用量を超えると、性能を制限して稼働する(バーストする)機能を備えています。

CPUクレジット

T2系インスタンスを調べていくと、またしても見慣れない単語が登場しました。
公式サイトによれば、「1CPUコア全体の1分間のパフォーマンスを表すもの」らしいです。

割り当てられた分のCPUクレジットを全消費するとバーストするので
CPU使用の目安になる数値とざっくりと捉えています。
CPUというと、コア数と比例しての処理量を一定確保できるものと考えていましたが
T2系インスタンスではそうは限らないのかもしれません。

対応方法

バーストの意味と発動条件が分かったところで、どのように対応するのか。
処理する量を変更しない場合、考えられるものとしては次の3つがあります。

・インスタンスの再起動

再起動することで、CPUクレジットが割り当て直しされます。
あくまで暫定対応なため、そのままの状態だといずれはバーストします。

・インスタンスのスペックアップ

T2系インスタンスサイズを大きくして、割り当てられるCPUクレジット量を増やします。

・インスタンスタイプを変更

T2系インスタンスはCPUクレジット方式を採っており、コア数分処理できるというわけではないため
固定パフォーマンス(M3系・C3系など)に変更して、安定に処理させるようにすることも考えられます。

最後に

EC2はインスタンス作成から立ち上げまでがスムーズなため、テスト環境としてもよく利用しています。

利用しているものの、インスタンスタイプについては構築時に指定にあった場合や
CPU・メモリ数・他インスタンスの利用料金差分の調査でしか注視していませんでした。

今回のブログ記事作成にあたり、性能面について新しく知るところが多かったので
障害対応や、業務面での技術・知識に役立てたいです。

この記事がお役に立てば【 いいね 】のご協力をお願いいたします!
0
読み込み中...
0 票, 平均: 0.00 / 10
8,503
X facebook はてなブックマーク pocket
[2024.6.30 CentOS support ended] CentOS server migration solution

[2024.6.30 CentOS support ended] CentOS server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author

Sakina Nakagawa

I joined the company in 2016 as a new graduate. Lately, I've been having fun learning the basics of servers.