Webアプリケーションとメモリ

11,395 views

Published on

Published in: Internet
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
11,395
On SlideShare
0
From Embeds
0
Number of Embeds
8,253
Actions
Shares
0
Downloads
20
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Webアプリケーションとメモリ

  1. 1. Webアプリケーションとメモリ JVM Operation Casual Talks 2014/04/07 長野雅広 kazeburo
  2. 2. LTだけど自己紹介 • 長野雅広 Masahiro Nagano • @kazeburo • Perl Monger • Operations Engineer, Site Reliability • LINE Corp. Development support on LINE Familly, livedoor
  3. 3. Javaは1行も書いた事ない
  4. 4. Javaなアプリケーションを 運用したことはあります
  5. 5. GCで苦労した話やJVMの チューニングの話は他の方が すると思うので、Perlな Webアプリケーションの メモリ周りの運用の話をします
  6. 6. Perlの普通のWebアプリケーション 実行環境 • mod_perl Apache HTTP Serverにperlインタプリタ を組み込んだもの。古代から存在 • Starlet, Starman Perlで構築されたWebアプリケーション サーバ
  7. 7. 特徴 •Multi Process / Prefork •MaxRequestPerChild
  8. 8. 親 Worker accept Worker accept Worker accept Worker accept bind listen fork(2) fork(2) fork(2) fork(2) Client Client ClientClient Multi Process / Prefork CoW によるメモリ共有もされる
  9. 9. MaxReqsPerChild accept accept accept accept accept accept accept accept exit life time of process fork
  10. 10. exit/fork burstborn exit born exit born exit born exit born exit born exit born exit born exit born exit born exit born exit born exit service start bornbornbornborn
  11. 11. exit/fork burstborn exit born exit born exit born exit born exit born exit born exit born exit born exit born exit born exit born exit service start bornbornbornborn HIGH LOAD HIGH LOAD HIGH LO
  12. 12. bumpy lifeborn exit born exit born exit born exit born exit born exit born exit born exit born exit born exit born exit born exit service start with --max-reqs-per-child=# --min-reqs-per-child=# randomize lifetime of processes born born born born
  13. 13. process life & memory usage born exit usage time 大容量のメモリ確保 循環参照によるメモリリーク
  14. 14. process life & memory usage born exit born exit born exit born exit born exit born exit born exit born exit born exit born born born usage time 通常のメモリ使用量
  15. 15. Multi Process / Prefork, MaxReqsPerChildな アプリケーションの運用 • MaxReqsPerChildによりメモリが確実に解放さ れるので、一時的に大きなメモリ領域を確保し たり、メモリリークの許容ができる • イレギュラーなメモリ使用量の増加を 見つけて対応する
  16. 16. 運用で対処ってやつ 最近ではアプリケーションサーバでは Hot-Deploy もできるので サービスに影響させずにコード変更・設定変更ができる
  17. 17. それ、JVMだと どうなるの?? どうしてんの??
  18. 18. 参考にさせて頂きます ありがとうございました

×