Download - Aloha on-rails-2009
![Page 1: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/1.jpg)
Tuesday, October 13, 2009
![Page 2: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/2.jpg)
Ship your App in a ContainerJRuby on Google App Engine
John WoodellOct 5, 2009
2
Tuesday, October 13, 2009
![Page 3: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/3.jpg)
Rails Deployment Roadmap
• 2004 - FastCGI on Apache or Lighttpd “a rocket that sometimes blows up in strange ways”
• 2006 - Mongrel clusters behind Apache mod_proxy “high throughput, but requires multiple moving parts”
• 2008 - Phusion Passenger on Apache “simply upload files, rack-based, REE/COW”
3
• 2010 - Rails3 or Sinatra + DataMapper in a servlet container “powerful/portable/scalable, rack-based, JRuby”
Tuesday, October 13, 2009
![Page 4: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/4.jpg)
Why JRuby?
• Outperforms MRI in many cases... 2x to 10x• Gem extensions written in Java (no more segfaults)• A wealth of integration options available
4
• Already works on App Engine with supported APIs
Tuesday, October 13, 2009
![Page 5: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/5.jpg)
Why Rails3?
• More modular, load only what you need for each request• Intelligent gem management and deployment tools• First-class integrations with “other” ORMs like DataMapper
5
• Better routing and Rack integration• Better Javascript integration and options• Rails conventions!
Tuesday, October 13, 2009
![Page 6: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/6.jpg)
Why Sinatra?
• No learning curve... a simple and elegant DSL• Some data-driven apps don’t require MVC or ActionView
6
• No need to extract the components we can’t use• New application instances can spin up quickly
Tuesday, October 13, 2009
![Page 7: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/7.jpg)
Why DataMapper?
• Data mapped in your model, auto-migrations or no migrations• Text fields treated like associations, lazy-load by default• Create concise queries without using method_missing
7
• Supports validations and legacy AR finders• Already works with dm-appengine wrapper
Tuesday, October 13, 2009
![Page 8: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/8.jpg)
Why a Servlet Container?
8
• Various app servers to choose from• Everything you need in in the container• JRuby-Rack dispatches to Rack
while providing access to servlet features• Access to Google App Engine APIs for Java
via Ruby APIs that are feature compatible• Our tools allow you to develop in the container
with the ability to integrate Java servlets
Tuesday, October 13, 2009
![Page 9: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/9.jpg)
9
JRuby on App Engine
Tuesday, October 13, 2009
![Page 10: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/10.jpg)
10
Install it Now
sudo gem install google-appengine
Everything you need installs as gems
Tuesday, October 13, 2009
![Page 11: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/11.jpg)
• A cloud-computing platform• We provide the container and services
What is Google App Engine?
• Run your web apps on Google’s infrastructure• Pay-as-you-go, with free quota to get started
11
Tuesday, October 13, 2009
![Page 12: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/12.jpg)
App Engine JRuby APIs
• AppEngine::Users• AppEngine::Datastore• AppEngine::Memcache• AppEngine::Mail• AppEngine::URLFetch• AppEngine::Images• AppEngine::Logger• AppEngine::Testing• AppEngine::XMPP• AppEngine::Labs::TaskQueue
12
Tuesday, October 13, 2009
![Page 13: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/13.jpg)
Dev_AppServer
• Customized Jetty server• Local implementation of services
– LRU memcache– Disk-backed datastore– HttpClient-backed URLFetch
• Emulates the production environment– Sandbox restrictions may be inconsistent,
so run tests on production servers as well
13
Tuesday, October 13, 2009
![Page 14: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/14.jpg)
Deployment
• Your app lives at– <app_id>.appspot.com, or– Custom domain with Google Apps
• Deploying uploads– Static files– Resource files– Other metadata (datastore indexes, cron jobs)
• Admin Console– dashboards– manage multiple versions– view logs
14
Tuesday, October 13, 2009
![Page 15: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/15.jpg)
App Engine ArchitectureIncoming Requests
App Engine Front End
App Engine Front End
App Engine Front End
AppServer AppServer AppServer
Load Balancer
AppServer
API Layer
Other Google Infrastructure
- Bigtable
- Google Accounts
- Memcache
- Image manipulation
App App App
15
Tuesday, October 13, 2009
![Page 16: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/16.jpg)
WhiteHouse.gov/openforquestions
16
Tuesday, October 13, 2009
![Page 17: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/17.jpg)
Quotas and Billing
Resource Provided Free Additional Cost
CPU 6.5 hours/day $0.10/hour
Bandwidth In 1GByte/day $0.10/GByte
Bandwidth Out 1GByte/day $0.12/GByte
Stored Data 1 GB $0.005/GB-day
Emails sent 2000/day to users50000/day to admins
$0.0001/email
17
Tuesday, October 13, 2009
![Page 18: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/18.jpg)
Demo
run lambda { |env| [200, {}, 'Aloha'] }
18
Tuesday, October 13, 2009
![Page 19: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/19.jpg)
Resources
• John Woodell, [email protected]• Google App Engine for JRuby
– http://code.google.com/p/appengine-jruby/
• Google Group– http://groups.google.com/group/appengine-jruby
• Blog: JRuby on App Engine Blog– http://jruby-appengine.blogspot.com/
19
Tuesday, October 13, 2009
![Page 20: Aloha on-rails-2009](https://reader033.vdocument.in/reader033/viewer/2022051608/5455c7bcb1af9f39378b4a99/html5/thumbnails/20.jpg)
Tuesday, October 13, 2009