Clojure WebアプリケーションについてGoogle App Engineのスピンアップ時間を調べた


スマホ向けのclojure.jarでは、スタートアップ処理に修正が入っているらしいので、スピンアップにも影響があるか調べてみた。

##比較に使ったclojure.jarの種類

1.公式より

```clj:
[org.clojure/clojure "1.6.0"]
```

2.[lein-droid](https://github.com/clojure-android/lein-droid)より - A Leiningen plugin for building Clojure/Android projects

```clj:
[org.clojure-android/clojure "1.6.0-RC1"]
```

3.[lein-fruit](https://github.com/oakes/lein-fruit)より - A Leiningen plugin for building Clojure/iOS projects

```clj:
[org.clojars.oakes/clojure "1.6.0"]
```

## 手順
プロジェクトの作成とGAEのデプロイ手順は下記の記事のとおり
[Create and deploy a Clojure app to Google App Engine ](http://flowa.fi/blog/2014/04/25/clojure-gae-howto.html)

warアーカイブのlibフォルダにclojure-1.3.0.jarが入ってた場合は、起動に支障があるため削除した。

```bash:
lein new compojure-app gae-app-demo
cd gae-app-demo
vim project.clj # org.clojure/clojureを修正
lein ring server
unzip -d war target/gae-app-demo-0.1.0-SNAPSHOT-standalone.war
rm war/WEB-INF/lib/clojure-1.3.0.jar # 1.3.0は不要
vim war/WEB-INF/appengine-web.xml # applicationとversionを編集
dev_appserver.sh war
appcfg.sh update war
```


## スピンアップ時間（最短）
メモリはどれも95MB程度消費していた。実際のアプリではF2以上が無難？
10秒切るにはF3が必要で、現状ではスピンアップ5秒以内は無理。

### ms
ms, F1, F2, F3
公式, 25944, 18872, 7667
droid, 24591, 17342, 8440
fruit, 24663, 15419, 8645

###  cpu_ms
cpu_ms, F1, F2, F3
公式, 15253, 14693, 12480
droid, 14267, 13947, 13387
fruit, 14053, 12453, 13733

## ログ
### 公式 
#### F1 (600MHz, 128MB)

* xxx.xxx.xxx.xxx - - [25/Apr/2014:22:38:59 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=31481 cpu_ms=16213 cpm_usd=0.000024 loading_request=1 instance=00c61b117cc5eaaffd8bfae55cb1b03d13efa7 app_engine_release=1.9.4
* xxx.xxx.xxx.xxx - - [25/Apr/2014:22:41:10 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=28174 cpu_ms=16027 cpm_usd=0.000024 loading_request=1 instance=00c61b117c19f44c588290b93551c2ec84b7e6 app_engine_release=1.9.4
* xxx.xxx.xxx.xxx - - [25/Apr/2014:22:59:05 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=25944 cpu_ms=15253 cpm_usd=0.000024 loading_request=1 instance=00c61b117c6c269b9ff7ff33805f28f1ba5c41 app_engine_release=1.9.4

#### F2 (1200MHz, 256MB)

* xxx.xxx.xxx.xxx - - [26/Apr/2014:00:05:50 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=18872 cpu_ms=14693 cpm_usd=0.000024 loading_request=1 instance=00c61b117c5956327818e5febcb6990cd48c39 app_engine_release=1.9.4

#### F3 (2400MHz, 512MB)
* xxx.xxx.xxx.xxx - - [26/Apr/2014:00:01:48 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=7667 cpu_ms=12480 cpm_usd=0.000024 loading_request=1 instance=00c61b117c9dd638fd2bee72e52dd1201d7d95 app_engine_release=1.9.4


### droid
#### F1 (600MHz, 128MB)
* xxx.xxx.xxx.xxx - - [25/Apr/2014:22:53:37 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=25358 cpu_ms=14587 cpm_usd=0.000024 loading_request=1 instance=00c61b117c95ed88bc9c303ef5f00480c98cf4 app_engine_release=1.9.4
* xxx.xxx.xxx.xxx - - [25/Apr/2014:23:00:27 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=24591 cpu_ms=14267 cpm_usd=0.000024 loading_request=1 instance=00c61b117c44f998e9046c42ac37fada9a4ac9 app_engine_release=1.9.4

※時間帯影響を考えて１件削除

#### F2 (1200MHz, 256MB)
* xxx.xxx.xxx.xxx - - [26/Apr/2014:00:06:15 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=17342 cpu_ms=13947 cpm_usd=0.000024 loading_request=1 instance=00c61b117c392b735a42dbfca1da28f1e9e12b app_engine_release=1.9.4

#### F3 (2400MHz, 512MB)
* xxx.xxx.xxx.xxx - - [26/Apr/2014:00:02:03 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=8440 cpu_ms=13387 cpm_usd=0.000024 loading_request=1 instance=00c61b117c5b07548878f11f36caab9aa92f1f4b app_engine_release=1.9.4

### fruit
#### F1 (600MHz, 128MB)
* xxx.xxx.xxx.xxx - - [25/Apr/2014:23:15:07 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=28230 cpu_ms=15307 cpm_usd=0.000024 loading_request=1 instance=00c61b117c099addbc89691628f5a97d7f476774 app_engine_release=1.9.4
* xxx.xxx.xxx.xxx - - [25/Apr/2014:23:17:00 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=24663 cpu_ms=14053 cpm_usd=0.000024 loading_request=1 instance=00c61b117ce565798fa6b22c6803172a5b358fef app_engine_release=1.9.4
* xxx.xxx.xxx.xxx - - [25/Apr/2014:23:18:17 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=26067 cpu_ms=15200 cpm_usd=0.000024 loading_request=1 instance=00c61b117c89a4a60727e95c0c03eb90de837172 app_engine_release=1.9.4

#### F2 (1200MHz, 256MB)
* xxx.xxx.xxx.xxx - - [26/Apr/2014:00:06:40 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=15419 cpu_ms=12453 cpm_usd=0.000024 loading_request=1 instance=00c61b117c4b3222669874a2a5042028d1a8f8 app_engine_release=1.9.4

#### F3 (2400MHz, 512MB)
* xxx.xxx.xxx.xxx - - [26/Apr/2014:00:02:19 -0700] "GET / HTTP/1.1" 200 216 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "*****.appspot.com" ms=8645 cpu_ms=13733 cpm_usd=0.000024 loading_request=1 instance=00c61b117ce955b1e7bc17ede158a173a47a4b app_engine_release=1.9.4