JRuby 㨠CRuby ã® Rails ã¢ããªã®æ§è½æ¯ (並å度ã¨ã®é¢ä¿)
前回の記事ã§ã¯ãApache Bench ã§ä¸¦å度ã 10 ã«åºå®ããç¶æ
ã§ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ããã¨ã® render :text => 'xxx' ã®æ§è½æ¯ãã¿ã¦ã¿ã¾ããããCharles Nutter さんからもコメントをもらったのでã並å度ã«å¿ããæ§è½ã®å¤åã調ã¹ã¦ã¿ã¾ããã
- Charles O Nutter 2009/01/31 02:56
You may want to try running your benchmark with a higher concurrency. GlassFish does better and better as the number of concurrent requests is increased.
ç°å¢ã¯ç¸å¤ããã Core 2 Duo 㪠iMac ä¸ã§ãã¢ããªã ab ãåããã¦ãã®ã§ããã£ã±ããã£ã±ãã«ãªã£ã¦ãã¾ã£ã¦ããã¨ãããããã¾ãããã¯ã©ã¤ã¢ã³ãããã®åææ¥ç¶æ°ã®å¢å ã«ã¨ããªãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®æ§è½å¤åã«ã¤ãã¦ã以ä¸ã®çµæãå¾ããã¾ããã
CRuby ã§ã¯ãMongrel ã®å ´åã並å度ããããã»ã©æ§è½ãæãã«å£åãã¾ãããThin ã¯ãªããªãããæãã§ããä¸æ¹ JRuby ã§ã¯ãGlassFish 㯠Thin ã«è¿«ãããçµæã§ããã¡ãªã¿ã« server ãªãã·ã§ã³ã§åããã¾ããã
ãã£ã¨è¦ãéããCRuby + Thin ã JRuby + GlassFish ãã並å度 100 ãããã§ã¯æ§è½å£åã®æ°é
ã¯ã»ã¨ãã©è¦ããã¾ããã§ããã
# GlassFish ã¯ã¡ã¢ãªã®ä½¿ç¨éãå¢ãã¦ããã¨æ§è½å£åãã¦ãã¾ãããããã¯ã¾ãããã¨ãã¦...ã (^^;
ããå°ãã³ã¢æ°ã®å¤ãç°å¢ã§æ¯ã¹ã¦ã¿ãããªã£ã¦ãã¾ããã...ã
çµæ
並å度 | CRuby+Mongrel | CRuby+Thin | JRuby+GlassFish |
---|---|---|---|
1 | 357.16 | 427.33 | 220.95 |
2 | 331.06 | 445.27 | 364.69 |
5 | 319.43 | 455.82 | 415.80 |
10 | 313.83 | 461.64 | 440.32 |
20 | 307.54 | 461.57 | 443.40 |
50 | 293.56 | 461.36 | 435.78 |
100 | 274.87 | 457.43 | 421.24 |
# 表ã®æ°åã¯ãä¸è¨ã§åå¾ãã Requests per seconds [#/sec] ã®å¹³åå¤ã¨ãªãã¾ãã
% ab -n 10000 -c 並å度 http://localhost:xxx
ç°å¢
- iMac (intel Core 2 Duo 2.33GHz)
- Mac OS X 10.5.6
- å¦çç³»ãã©ã¤ãã©ãªã®ãã¼ã¸ã§ã³ã¯ä»¥ä¸ã®ã¨ãã
% ruby186 -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin9.6.0] % jruby -v jruby 1.1.6RC1 (ruby 1.8.6 patchlevel 114) (2008-12-03 rev 8263) [i386-java] % java -version java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode) % $GLASSFISH_HOME/bin/asadmin version ãã¼ã¸ã§ã³ = Sun GlassFish Enterprise Server v2.1 % gem list --local *** LOCAL GEMS *** mongrel (1.1.5) rails (2.2.2) thin (1.0.0) warbler (0.9.12) ... # ç®ã¼ãããã®ãé©å½ã«æç²
測ãæ¹
- render :text => 'Hello World!' ã ãã®ã¢ã¯ã·ã§ã³ãç¨æ
- ab -n 10000 -c 10 http://localhost:xxx 㧠-c ã«æ¸¡ãå¤ã 1, 2, 5, 10, 20, 50, 100 ã«å¤åããã¦è¨æ¸¬
- ab 㨠Rails ã¯åä¸çä½ã§åä½
- Rails ã® threadsafe ãªãã·ã§ã³ã¯ uncomment (ã¤ã¾ãå©ç¨)
- å½ããåã ãã©ãproduction ç°å¢
- å並å度ãã¨ã« 5åè¨æ¸¬ãã¦ãæå°/æ大å¤ãé¤å¤ãã¦å¹³åå¤ãç®åº (5ååãã¹ã¦ã®ãã¼ã¿ã¯ä¸è¨åç §)
- JRuby + GlassFish ã¯ã¡ã¢ãªä½¿ç¨éãå¢ããã¨æ§è½ãå£åããã®ã§ããã®å¾åãã§ã¯ãããã GlassFish ãåèµ·åãã¦åè¨æ¸¬
詳細
å·¦ããé ã«ã並å度ãæå°/æ大å¤ãé¤å¤ããå¹³åå¤ãå ¨è¨æ¸¬çµæ(5åå) ã§ãã
- CRuby + Mongrel
concurrency:1 average:357.16 <= [357.32, 355.97, 356.73, 357.45, 357.43] concurrency:2 average:331.06 <= [331.27, 332.16, 331.48, 330.42, 328.91] concurrency:5 average:319.43 <= [321.23, 318.95, 320.2, 318.73, 319.13] concurrency:10 average:313.83 <= [314.14, 313.71, 313.49, 314.03, 313.74] concurrency:20 average:307.54 <= [308.16, 307.94, 306.59, 304.89, 308.08] concurrency:50 average:293.56 <= [295.57, 292.58, 292.52, 293.64, 294.47] concurrency:100 average:274.87 <= [276.25, 274.7, 275.47, 274.31, 274.44]
- CRuby + Thin
concurrency:1 average:427.33 <= [426.65, 427.25, 428.03, 426.7, 429.2] concurrency:2 average:445.27 <= [443.02, 445.57, 443.83, 448.66, 446.41] concurrency:5 average:455.82 <= [456.15, 458.36, 454.6, 455.05, 456.25] concurrency:10 average:461.64 <= [462.86, 461.37, 445.55, 461.57, 461.97] concurrency:20 average:461.57 <= [462.58, 460.16, 463.06, 461.96, 459.45] concurrency:50 average:461.36 <= [461.56, 461.09, 462.14, 460.27, 461.43] concurrency:100 average:457.43 <= [457.8, 458.65, 456.21, 458.28, 455.2]
concurrency:1 average:220.95 <= [150.02, 204.79, 225.9, 232.15, 232.94] concurrency:2 average:364.69 <= [362.36, 358.22, 374.37, 360.24, 371.46] concurrency:5 average:415.80 <= [403.02, 420.01, 419.93, 407.47, 423.66] concurrency:10 average:440.32 <= [434.1, 429.52, 444.21, 447.44, 442.66] concurrency:20 average:443.40 <= [441.94, 420.8, 442.01, 446.26, 447.42] concurrency:50 average:435.78 <= [419.98, 435.91, 438.71, 433.98, 437.44] concurrency:100 average:421.24 <= [411.54, 425.45, 426.73, 432.83, 393.01]