Skip to content

Commit

Permalink
deploy: 86a7fc7
Browse files Browse the repository at this point in the history
  • Loading branch information
akkinoc committed Nov 2, 2024
1 parent 93b5e57 commit a1c7704
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion archive/categories/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion archive/posts/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion archive/tags/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion feed.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://akkinoc.dev/feed.xml" rel="self" type="application/atom+xml"/><link href="https://akkinoc.dev/" rel="alternate" type="text/html"/><updated>2024-11-01T19:41:34+09:00</updated><id>https://akkinoc.dev/feed.xml</id><title type="html">akkinoc.dev</title><subtitle>akkinoc&apos;s personal website.</subtitle><author><name>Akihiro Kondo</name></author><entry><title type="html">Java Buildpack Memory Calculator を Amazon ECS + AWS Fargate で動かす</title><link href="https://akkinoc.dev/posts/2024/05/20/java-buildpack-memory-calculator-on-aws-ecs-fargate/" rel="alternate" type="text/html" title="Java Buildpack Memory Calculator を Amazon ECS + AWS Fargate で動かす"/><published>2024-05-20T00:00:00+09:00</published><updated>2024-05-20T00:57:13+09:00</updated><id>https://akkinoc.dev/posts/2024/05/20/java-buildpack-memory-calculator-on-aws-ecs-fargate</id><content type="html" xml:base="https://akkinoc.dev/posts/2024/05/20/java-buildpack-memory-calculator-on-aws-ecs-fargate/"><![CDATA[<p>Spring Boot アプリケーションを Amazon ECS + AWS Fargate で動かした際、<br/> <a href="https://paketo.io/docs/reference/java-reference/#memory-calculator">Java Buildpack Memory Calculator</a> が正しく機能していないことに気付き、調査しました。</p> <h2 id="前提">前提</h2> <ul> <li>環境 <ul> <li>Java 17</li> <li>Gradle 8.7</li> <li>Spring Boot 3.2</li> </ul> </li> <li>Docker イメージ ビルド方法 <ul> <li>Spring Boot Gradle Plugin の <code class="language-plaintext highlighter-rouge">gradle bootBuildImage</code> でビルド</li> </ul> </li> <li>Docker イメージ 実行環境 <ul> <li>Amazon ECS + AWS Fargate</li> </ul> </li> <li>(僕はコンテナ技術に明るくありません)</li> </ul> <h2 id="java-buildpack-memory-calculator-とは">Java Buildpack Memory Calculator とは</h2> <p><a href="https://paketo.io/docs/reference/java-reference/#memory-calculator">Java Buildpack Memory Calculator</a> は、 Java アプリケーションのメモリ配分について、<br/> 実行環境のキャパシティ等から最適な値を自動計算し割当ててくれるそうです。<br/> Spring Boot の Maven / Gradle プラグインでイメージビルドすると組み込まれました。</p> <p>計算式は次のように算出されるようです。</p> <blockquote> <p>Heap = Total Container Memory - Non-Heap - Headroom<br/> Non-Heap = Direct Memory + Metaspace + Reserved Code Cache + (Thread Stack * Thread Count)</p> <footer><cite><a href="https://paketo.io/docs/reference/java-reference/#memory-calculator">Java Buildpack Reference - Paketo Buildpacks</a></cite></footer> </blockquote> <h2 id="起きていたこと">起きていたこと</h2> <p>ECS タスク定義のメモリ (<a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#ContainerDefinition-taskmemory">Task size &gt; memory</a>) は 1GB で設定していたのですが、<br/> コンテナ起動時に流れていたログは次のような内容でした。<br/> (見やすいように適当に改行を入れてます。)</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Calculated JVM Memory Configuration:
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://akkinoc.dev/feed.xml" rel="self" type="application/atom+xml"/><link href="https://akkinoc.dev/" rel="alternate" type="text/html"/><updated>2024-11-03T00:52:59+09:00</updated><id>https://akkinoc.dev/feed.xml</id><title type="html">akkinoc.dev</title><subtitle>akkinoc&apos;s personal website.</subtitle><author><name>Akihiro Kondo</name></author><entry><title type="html">Java Buildpack Memory Calculator を Amazon ECS + AWS Fargate で動かす</title><link href="https://akkinoc.dev/posts/2024/05/20/java-buildpack-memory-calculator-on-aws-ecs-fargate/" rel="alternate" type="text/html" title="Java Buildpack Memory Calculator を Amazon ECS + AWS Fargate で動かす"/><published>2024-05-20T00:00:00+09:00</published><updated>2024-05-20T00:57:13+09:00</updated><id>https://akkinoc.dev/posts/2024/05/20/java-buildpack-memory-calculator-on-aws-ecs-fargate</id><content type="html" xml:base="https://akkinoc.dev/posts/2024/05/20/java-buildpack-memory-calculator-on-aws-ecs-fargate/"><![CDATA[<p>Spring Boot アプリケーションを Amazon ECS + AWS Fargate で動かした際、<br/> <a href="https://paketo.io/docs/reference/java-reference/#memory-calculator">Java Buildpack Memory Calculator</a> が正しく機能していないことに気付き、調査しました。</p> <h2 id="前提">前提</h2> <ul> <li>環境 <ul> <li>Java 17</li> <li>Gradle 8.7</li> <li>Spring Boot 3.2</li> </ul> </li> <li>Docker イメージ ビルド方法 <ul> <li>Spring Boot Gradle Plugin の <code class="language-plaintext highlighter-rouge">gradle bootBuildImage</code> でビルド</li> </ul> </li> <li>Docker イメージ 実行環境 <ul> <li>Amazon ECS + AWS Fargate</li> </ul> </li> <li>(僕はコンテナ技術に明るくありません)</li> </ul> <h2 id="java-buildpack-memory-calculator-とは">Java Buildpack Memory Calculator とは</h2> <p><a href="https://paketo.io/docs/reference/java-reference/#memory-calculator">Java Buildpack Memory Calculator</a> は、 Java アプリケーションのメモリ配分について、<br/> 実行環境のキャパシティ等から最適な値を自動計算し割当ててくれるそうです。<br/> Spring Boot の Maven / Gradle プラグインでイメージビルドすると組み込まれました。</p> <p>計算式は次のように算出されるようです。</p> <blockquote> <p>Heap = Total Container Memory - Non-Heap - Headroom<br/> Non-Heap = Direct Memory + Metaspace + Reserved Code Cache + (Thread Stack * Thread Count)</p> <footer><cite><a href="https://paketo.io/docs/reference/java-reference/#memory-calculator">Java Buildpack Reference - Paketo Buildpacks</a></cite></footer> </blockquote> <h2 id="起きていたこと">起きていたこと</h2> <p>ECS タスク定義のメモリ (<a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#ContainerDefinition-taskmemory">Task size &gt; memory</a>) は 1GB で設定していたのですが、<br/> コンテナ起動時に流れていたログは次のような内容でした。<br/> (見やすいように適当に改行を入れてます。)</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Calculated JVM Memory Configuration:
-XX:MaxDirectMemorySize=10M
-Xmx7128493K
-XX:MaxMetaspaceSize=138570K
Expand Down
Loading

0 comments on commit a1c7704

Please sign in to comment.