Ruby on Google App Engine: Upgrade to Google App "Turbo" Engine
-
Upload
joseph-ku -
Category
Technology
-
view
2.780 -
download
3
Transcript of Ruby on Google App Engine: Upgrade to Google App "Turbo" Engine
Ruby on Google App EngineUpgrade to Google App “Turbo” Engine
Joseph Ku (Chieh-Fang Ku)[email protected]
Outline
What’s Google App Engine?
Why Google App Engine?
Free quotas and limits
Significant features
Be prepared
What’s JRuby
Why Sinatra and why not Rails?
Hack! Hack! Hack!
References
v1.2.0Build 201105111230
Who am I?
Joseph Ku (Chieh-Fang Ku)(@josephku)
Male
Single, but not rich
A Linux user since 1996
Fed by embedded Linux and Android
Ruby lover and Guitar Hero rocker
Before we start...
Don’t take any notes. This slide will be published with CC BY-NC-ND.
Don’t judge my look and shape. It’s cold, and I need Calories.
Don’t play Angry Birds during my presentation
...including Angry Birds Seasons edition
Before we start...
You CAN interrupt me anytime.
You CAN take pictures anytime.
You CAN go to the toilet anytime.
What’s Google App Engine?
GAE (Google App Engine) lets you run your web apps on Google's infrastructure.
Reliable PaaS (Platform as a Service)
Easy to use, maintain and scale
Almost free!
What’s Google App Engine?
GAE (Google App Engine) lets you run your web apps on Google's infrastructure.
Typical PaaS (Platform as a Service)
Only supports Python and Java runtime environments
Who did choose GAE?...
Why Google App Engine?
World-class infrastructure
Light-weight PaaS
Booming of Client-Side JavaScript
Obey its limitations
Free quotas and limits
Free Quotas (without enabling billing)
43,200,000 requests per day
45,200 requests per minute
1 GB shared Datastore/Blobstore size
6.5 CPU-hours per day
1 GB shared bandwidth in/out per day
Reduced again and again...and again?
Free quotas and limits
Limits
10 apps for developer account
30 sec per request
10 MB HTTP response size
150 MB app code size
1,000 deployments
200 indexes
Significant features
Schedule tasks
Schedule tasks - Like Cron service
Every minutes!
Up to 20 tasks
Task queues - only support Python
Google account integration
URL fetch
Memcache
Image manipulation
What’s URL Shortener?
Such as:
TinyURL.com
bit.ly
goo.gl
t.co
fb.me
Create your own URL shortener
I want this: http://mrku.co/j3Rs7k
Base 62 (0-9, a-z, A-Z)
Generated by O(1) algorithm
I want my service fast
I don’t wanna pay
I ♡ Ruby!
Why this happen?
You just said GAE could only support Python and Java...
Mighty JVM
JRuby
DataMapper
appengine-jruby project (John Woodell)
Be Prepared
Java SE Development Kit (JDK)
Ruby
RubyGems
JRuby
(...Wh...Where is GAE?)
Be Prepared
Install all packages we need:
$ gem install google-appengine
(rack, jruby-rack, jruby-jars, appengine-rack, appengine-apis, appengine-sdk, bundler08, rubyzip, appengine-tools, google-appengine)
Be Prepared
Create a GAE app and test it:
$ appcfg.rb generate_app myapp
$ dev_appserver.rb myapp
Go and check http://localhost:8080/
...That’s all?
Wake up!!This world is NOT
perfect!
Be prepared for the real world
Java SE Development Kit (JDK) 6
Ruby 1.8.7-p330 or 1.8.7-p334
RubyGems 1.3.7
JRuby 1.5.6
Be prepared for the real world
Suggestions:
Use “RVM” to deploy your Ruby environment on Linux or Mac
Use “Pik” to deploy your Ruby environment on Windows
Be prepared for the real world
Install all packages we need:
$ gem install google-appengine
And do some tricks...
$ gem uninstall appengine-sdk
$ gem install appengine-sdk -v "1.4.0"
Be prepared for the real world
Create a GAE app and test it:
$ appcfg.rb generate_app myapp
$ echo “gem 'jruby-rack', '< 1.0.6'” >> myapp/Gemfile
$ dev_appserver.rb myapp
Go and check http://localhost:8080/
What’s JRuby
100% Java implementation of the Ruby programming language
We could call Ruby MRI, “CRuby.”
Open source, Started in 2001
Always aiming for compatibility with current Ruby version
Latest release: 1.6.1 (update to 2011.05.11)
Why Sinatra and why not Rails
Sinatra is lighter than Rails
Sinatra’s CGI-friendly is more close to GAE
Tons of problems while trying to deploy a Rails app to GAE
Big performance issues in Rails apps on GAE
Besides...
Why Sinatra and why not Rails
There is Heroku!!
$ gem install heroku
$ heroku create myapp
$ git push heroku master
Go and check http://myapp.heroku.com
Hack! Hack! Hack!
References
Google App Engine: Quotas
http://code.google.com/intl/en/appengine/docs/quotas.html
JRuby
http://www.jruby.org/
References
DataMapper
http://datamapper.org/
appengine-jruby project
http://code.google.com/p/appengine-jruby/
John Woodell ([email protected])
References
RVM: Ruby Version Manger
http://rvm.beginrescueend.com/
Pik: Ruby version manager for Windows
https://github.com/vertiginous/pik/
Sinatra
http://www.sinatrarb.com/
Any questions?