2
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?

Satori GCをMSBuild SDKとして公開しました!

2
Posted at

はじめに

Satori GCは、高スループット、短い停止時間と低リソース消費を特徴とするGCですが、手元やプロジェクトでも手軽に使いたかったため、今回導入用のSDKとして公開しました。

導入方法

プロジェクトファイル(.csproj など)に以下の <Sdk> 要素を1行追加します。

.NET 10 の場合

<Sdk Name="PublishWithSatoriGC" Version="10.0.13-satori.37965325580.1" />

.NET 11 の場合

<Sdk Name="PublishWithSatoriGC" Version="11.0.0-satori.37965325036.1" />

注意:Satori GCの開発に合わせてバージョンも更新していく予定です。新しいバージョンが出ていないかは適宜ご確認ください。

使い方

追加したら、あとは通常通り dotnet publish を実行するだけです。

自己完結型(self-contained)の発行でのみ有効になるため、必ず --self-contained を指定してください。PublishAot、PublishReadyToRun、PublishTrimmed、PublishSingleFile にも対応しています。

例:

# 単一ファイル・トリミング有効
dotnet publish -c Release -r win-x64 --self-contained /p:PublishSingleFile=true /p:PublishTrimmed=true

# NativeAOT
dotnet publish -c Release -r win-x64 /p:PublishAot=true

対応 OS

  • Windows、Linux、macOS
  • .NET 11 の場合は Android でも利用可能

有効化の確認方法

プログラム内で Satori GC が正しく有効になっているかは、以下の戻り値で確認できます。

bool enabled = GC.GetConfigurationVariables().ContainsKey("SatoriGC");
Console.WriteLine(enabled);

モードの切り替え

Satori GC には Interactive と LowLatency の2つのモードがあります。

  • Interactive(デフォルト): メモリ消費やスループットを重視
  • LowLatency: 停止時間の短さをより重視

どちらも停止時間は短いですが、実行中に GCSettings.LatencyMode を設定することで切り替えが可能です。

ベンチマーク結果

二分木のストレステストで異なる GC を計測して比較してみました。

指標 Satori (Interactive) Satori (LowLatency) Workstation Server (DATAS)
総実行時間 (ms) 12,611.39 15,383.19 35,289.56 16,112.36
最大停止時間 (ms) 8.360 1.998 30.062 159.651
平均停止時間 (ms) 0.381 0.233 3.366 2.850
P99.9 停止時間 (ms) 8.224 1.867 26.852 150.798
P99 停止時間 (ms) 1.759 1.126 24.465 41.442
P95 停止時間 (ms) 0.789 0.570 14.992 4.046
P90 停止時間 (ms) 0.664 0.440 13.575 2.139
P80 停止時間 (ms) 0.477 0.331 4.711 1.782
ピークメモリ使用量 (MB) 1,258.16 1,460.84 1,420.30 2,582.51
GC 後のメモリ使用量 (MB) 27.31 51.21 30.81 73.70

今回のテストでは、Interactive、LowLatencyともに従来のWorkstation / Server GCと比べてはるかに優位な結果になりました。特に LowLatency モードでは、最大停止時間が 2 ms を切る水準に収まっています。

これで手元のプロジェクトでも Satori GC を手軽に試せるようになるので、ぜひ使ってみてください!

2
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
2
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?