VMwareの新PaaS "CloudFoundry"を試した!ちょっと調査もした!

CloudFoundryというのは、vmwareが作ったPaaSです。Spring, Rails and Node.jsのアプリケーションを配置できるもので、つい先日公開されたばかりの出来立てホヤホヤな、まだベータのPaaSです。
http://cloudfoundry.com/

Railsが配置できるPaaSはHerokuが有名で、ちょっと前までそれ以外のPaaSがない状況だった。ところが、先日Amazonが発表した「AWS Elastic Beanstalk」にてRailsへの対応を進めているとの話があった。そして、この界隈にVMwareが入ってきた感じになる。Rails使いの私としては、選択肢が増える事が何よりも嬉しい。

CloudFoundryのページでは、パートナーとして

  • 10gen : MongoDBの会社
  • Joyent : Node.jsのPaaS
  • Pivtal Labs : Railsで作られたアジャイル開発のスクラムをサポートするツールサービス
  • RightScale : Cloud環境を統合的に管理できるサービスの会社

が名を連ねる。

私は個人的に、このPaaSは今年のクラウド動向で非常に重要な鍵を握っていると考えている。なぜなら、このCloudFoudryそのものを作るためのソフトウェアがオープンソースで公開されているためである。
つまり、これまでホスティングなどをやってきた業者が、このオープンソースを使う事で人気があるフレームワークのPaaSとして参入することが可能になる。また、従来IaaSとして提供してきたところが一段サービスレベルをあげてPaaSとして提供する事も可能になるだろう。このように基盤ソフトがオープンソース化されることで、どのくらいのベンダーがこれらを使うかは疑問ではあるものの、人気が出てくるとベンダーとしてプラットフォームのオープン化を無視できなくなるのではないだろうか。
ユーザにしてみれば、単純に選択肢の幅が広がる可能性が極めて高く歓迎される事は間違いないだろう。

ただ同時に思うのが、本当に設備にお金をかけてきっちりした管理をしている優良なベンダーが劣悪な価格競争に巻き込まれないか心配でもある。その結果、値段だけが勝負になる世界へIaaSやPaaSがなるのは、あまり好ましい状況とは思えない。

ということで、是非とも詳しく知りたいと思い、早速試したいと思うわけです。WebよりBetaサービスへの申し込みをして、ついにアカウントが発行されたので、体験レポートしてみます。

試したい!そして、試した!

一昨晩ついに無事招待状が到着した。メールはこんな感じ。

Thank you for your interest in Cloud Foundry – the industry’s first open platform as a service.
We have approved your request for a  CloudFoundry.com account.
Your credentials are listed below.

Email:  XXXXXX
Temporary password: YYYYYYYY

メール内に記載されていたURLからマニュアルのPDFを取得できた。getting startなので、これを読みながら試してみる事にする。

表紙には、

the  VMware  Application  Platform as a Service  (PaaS)  solution.

とかかれている。

お試しのための準備

CloudFoundryは現在、自分のPCにコマンドラインツールなどをいれ、そこからデプロイや設定の変更などを行うようになっている。そして、どうやら管理ツールはコマンドラインで、かつRubyで書かれたもののようだ。またEclipseプラグイン(?)を入れる事で、IDEから直接デプロイなどもできるようだ。

さて「こちとらRails使い!スクリプターIDEなんて要らないぜ!!」という古風な人間なので、コマンドラインツールのインストールを行うことにした。

/Users/yuya_lush/ruby/rails% gem install vmcFetching: json_pure-1.5.1.gem (100%)
Fetching: rubyzip2-2.0.1.gem (100%)
Fetching: highline-1.6.1.gem (100%)
Fetching: rest-client-1.6.1.gem (100%)
Fetching: terminal-table-1.4.2.gem (100%)
Fetching: vmc-0.3.10.gem (100%)
Successfully installed json_pure-1.5.1
Successfully installed rubyzip2-2.0.1
Successfully installed highline-1.6.1
Successfully installed rest-client-1.6.1
Successfully installed terminal-table-1.4.2
Successfully installed vmc-0.3.10
6 gems installed
Installing ri documentation for json_pure-1.5.1...
Installing ri documentation for rubyzip2-2.0.1...
Installing ri documentation for highline-1.6.1...
Installing ri documentation for rest-client-1.6.1...
Installing ri documentation for terminal-table-1.4.2...
Installing ri documentation for vmc-0.3.10...
Installing RDoc documentation for json_pure-1.5.1...
Installing RDoc documentation for rubyzip2-2.0.1...
Installing RDoc documentation for highline-1.6.1...
Installing RDoc documentation for rest-client-1.6.1...
Installing RDoc documentation for terminal-table-1.4.2...
Installing RDoc documentation for vmc-0.3.10...
/Users/yuya_lush/ruby/rails% vmc target api.cloudfoundry.comSuccesfully targeted to [http://api.cloudfoundry.com]
/Users/yuya_lush/ruby/rails% vmc loginEmail: YYYYY@XXXXXXX
Password: ********
Successfully logged into [http://api.cloudfoundry.com]

なんと、あっさりな。
なお実行環境はMacOSXRuby1.9.2p180です。RVM使ってます。

サンプルアプリを作って、デプロイしてみる


以下の通りサンプルアプリを作ってみた。内容はgetting startの通り。

/Users/yuya_lush/ruby/rails/hello% vim hello.rb

  1 require 'sinatra'
  2 get '/' do
  3   "Hello co-meeting from Cloud Foundry"
  4 end
/Users/yuya_lush/ruby/rails/hello% vmc push
Would you like to deploy from the current directory? [Yn]: Y
Application Name: YuyaLushHello
Application Deployed URL: 'YuyaLushHello.cloudfoundry.com'?
Detected a Sinatra Application, is this correct? [Yn]: Y
Memory Reservation [Default:128M] (64M, 128M, 256M, 512M, 1G or 2G)
Creating Application: OK
Would you like to bind any services to 'YuyaLushHello'? [yN]:
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (0K): OK  
Push Status: OK
Staging Application: OK                                                        
Starting Application: OK                 

http://YuyaLushHello.cloudfoundry.comにアクセスすると・・・おぉ、表示された。

pushに掛かった時間は2~3分だろうか。凝ったものではないので、早いのかもしれない。
次に、プログラムを若干書き換えて、再度アップしなおす。

  1 require 'sinatra'  2 get '/' do
  3   "Hello, co-meeting from Cloud Foundry and VMware!"
  4 end
/Users/yuya_lush/ruby/rails/hello% vmc update YuyaLushHello
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (0K): OK  
Push Status: OK
Stopping Application: OK
Staging Application: OK                                                        
Starting Application: OK       


うふ。なんだか簡単ですね。

追加で調査1:コマンドラインからできることは?

Usage: vmc [options] command [<args>] [command_options]Try 'vmc help [command]' or 'vmc help options' for more information.

Currently available vmc commands are:
  Getting Started
    target [url]                                 Reports current target or sets a new target
    login  [email] [--email, --passwd]           Login
    info                                         System and account information
  Applications
    apps                                         List deployed applications
  Application Creation
    push [appname]                               Create, push, map, and start a new application
    push [appname] --path                        Push application from specified path
    push [appname] --url                         Set the url for the application
    push [appname] --instances <N>               Set the expected number <N> of instances
    push [appname] --mem M                       Set the memory reservation for the application
    push [appname] --no-start                    Do not auto-start the application
  Application Operations
    start <appname>                              Start the application
    stop  <appname>                              Stop the application
    restart <appname>                            Restart the application
    delete <appname>                             Delete the application
    rename <appname> <newname>                   Rename the application
  Application Updates
    update <appname> [--path]                    Update the application bits
    mem <appname> [memsize]                      Update the memory reservation for an application
    map <appname> <url>                          Register the application to the url
    unmap <appname> <url>                        Unregister the application from the url
    instances <appname> <num|delta>              Scale the application instances up or down
  Application Information
    crashes <appname>                            List recent application crashes
    crashlogs <appname>                          Display log information for crashed applications
    logs <appname> [--all]                       Display log information for the application
    files <appname> [path] [--all]               Display directory listing or file download for [path]
    stats <appname>                              Display resource usage for the application
    instances <appname>                          List application instances
  Application Environment
    env <appname>                                List application environment variables
    env-add <appname> <variable[=]value>         Add an environment variable to an application
    env-del <appname> <variable>                 Delete an environment variable to an application
  Services
    services                                     Lists of services available and provisioned
    create-service <service> [--name,--bind]     Create a provisioned service
    create-service <service> <name>              Create a provisioned service and assign it <name>
    create-service <service> <name> <app>        Create a provisioned service and assign it <name>, and bind to <app>
    delete-service [servicename]                 Delete a provisioned service
    bind-service <servicename> <appname>         Bind a service to an application
    unbind-service <servicename> <appname>       Unbind service from the application
    clone-services <src-app> <dest-app>          Clone service bindings from <src-app> application to <dest-app>
  Administration
    user                                         Display user account information
    passwd                                       Change the password for the current user
    logout                                       Logs current user out of the target system
    add-user [--email, --passwd]                 Register a new user (requires admin privileges)
    delete-user <user>                           Delete a user and all apps and services (requires admin privileges)
  System
    runtimes                                     Display the supported runtimes of the target system
    frameworks                                   Display the recognized frameworks of the target system
  Misc
    aliases                                      List aliases
    alias <alias[=]command>                      Create an alias for a command
    unalias <alias>                              Remove an alias
    targets                                      List known targets and associated authorization tokens
  Help
    help [command]                               Get general help or help on a specific command
    help options                                 Get help on available options

追加の調査2:選択できるインスタンスのスペック

/Users/yuya_lush/ruby/rails/hello% vmc info

VMware's Cloud Application Platform
For support visit support@cloudfoundry.com
Target:   http://api.cloudfoundry.com (v0.999)
Client:   v0.3.10
User:     YYYYYYYYY@XXXXXXXXXXX
Usage:    Memory   (128.0M of 2.0G total)
          Services (0 of 16 total)
          Apps     (1 of 20 total)

あらま!かなりテストで使えそう。

追加の調査3:データの永続つまり、データストアは何が使えるの?
/Users/yuya_lush/ruby/rails/hello% vmc services

============== System Services ==============

+---------+---------+-------------------------------+
| Service | Version | Description                   |
+---------+---------+-------------------------------+
| mysql   | 5.1     | MySQL database service        |
| mongodb | 1.8     | MongoDB NoSQL store           |
| redis   | 2.2     | Redis key-value store service |
+---------+---------+-------------------------------+

=========== Provisioned Services ============
追加の調査4:abで負荷テストしてみた

いきなりで可哀想な気もするが、abで負荷テスト。


まずは、localhostMacOSXに最初から入っているApacheで行った。

Server Software:        Apache/2.2.17
Server Hostname:        localhost
Server Port:            80
Document Path:          /
Document Length:        44 bytes
Concurrency Level:      10
Time taken for tests:   5.473 seconds
Complete requests:      50000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    49510
Total transferred:      23029831 bytes
HTML transferred:       2200132 bytes
Requests per second:    9135.74 [#/sec] (mean)
Time per request:       1.095 [ms] (mean)
Time per request:       0.109 [ms] (mean, across all concurrent requests)
Transfer rate:          4109.27 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     0    1   9.6      1     896
Waiting:        0    1   9.6      0     895
Total:          0    1   9.6      1     896


次がCloudFoundry

Benchmarking YYYYYYY.cloudfoundry.com (be patient)
Finished 2112 requests
Server Software:        nginx
Server Port:            80
Document Path:          /
Document Length:        48 bytes
Concurrency Level:      10
Time taken for tests:   30.063 seconds
Complete requests:      2112
Failed requests:        0
Write errors:           0
Keep-Alive requests:    2112
Total transferred:      477240 bytes
HTML transferred:       101376 bytes
Requests per second:    70.25 [#/sec] (mean)
Time per request:       142.342 [ms] (mean)
Time per request:       14.234 [ms] (mean, across all concurrent requests)
Transfer rate:          15.50 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   9.6      0     144
Processing:   131  141  68.0    140    3131
Waiting:      131  141  68.0    140    3131
Total:        131  142  68.7    140    3131


そして、ニフティクラウド。www

Benchmarking NNNNNNNNNNNNN(be patient)
Finished 22832 requests
Server Software:        nginx/0.8.54
Server Port:            80
Document Path:          /
Document Length:        151 bytes
Concurrency Level:      10
Time taken for tests:   30.004 seconds
Complete requests:      22832
Failed requests:        0
Write errors:           0
Keep-Alive requests:    22608
Total transferred:      8378224 bytes
HTML transferred:       3447632 bytes
Requests per second:    760.96 [#/sec] (mean)
Time per request:       13.141 [ms] (mean)
Time per request:       1.314 [ms] (mean, across all concurrent requests)
Transfer rate:          272.69 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   6.8      0     990
Processing:     8   13   8.0     12     248
Waiting:        8   12   6.5     11     246
Total:          8   13  10.5     12    1009


という感じでした。
比較するには色々と条件が違ったりするので、あえて結果のみを載せるだけにしておきます。

ということで、以上ファーストコンタクトでした!!

追記

youTubeで公開されているWebinarを見ているが全編英語。ゆっくり話しているところなら、何となく解るが3人で話しているシーンとかになると、全く解らん。。。
勉強しないとなぁ。