SlideShare a Scribd company logo
Sunday, May 9, 2010
JRuby on App Engine
            Run Ruby apps on Google Servers,
            with access to first-class Java APIs
            John Woodell
            May 6, 2010




              2



Sunday, May 9, 2010
Google App Engine
              3



Sunday, May 9, 2010
Key Features
            • No need to install or maintain your own stack
            • Use Google scalable services via standard APIs
            • Built-in application management console
            • Google does the scaling for you
            • Pay-as-you-go, with free quota to get started




              4



Sunday, May 9, 2010
Key Limitations
            • No native code
            • No threads or sockets
            • No writing to the filesystem
            • No relational database
            • No more than 30 seconds per request




              5



Sunday, May 9, 2010
Dev AppServer
            • 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




              6



Sunday, May 9, 2010
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



              7



Sunday, May 9, 2010
Quotas and Billing
                      Resource      Provided Free      Additional Cost
                      CPU time      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 users    $0.0001/email
                                 50000/day to admins

              8



Sunday, May 9, 2010
App Engine Product Roadmap
            • SSL for third-party domains
            • Background servers capable of running for longer than 30s
            • Ability to reserve instances to reduce application loading overhead
            • Ability to select different availability vs. latency options for Datastore
            • Support for mapping operations across datasets
            • Datastore dump and restore facility
            • Raise request/response size limits for some APIs
            • Improved monitoring and alerting of application serving
            • Support for Browser Push (Comet) communication
            • Built-in support for OAuth & OpenID



              9



Sunday, May 9, 2010
JRuby on App Engine
             10



Sunday, May 9, 2010
Rails Deployment History
           • 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”
           • 2010 - Running in a servlet container with JRuby-Rack
                      “powerful/portable/scalable, rack-based, JRuby”




             11



Sunday, May 9, 2010
Benefits of JRuby
            • Outperforms MRI in many cases... 2x to 10x
            • Gem extensions written in Java (no more segfaults)
            • A wealth of integration options and first-class Java APIs
            • Spin-up new instances quickly using Duby (or Java) servlets




             12



Sunday, May 9, 2010
App Engine JRuby Milestones
            • 2009-04-08   @olabini publishes blog post on YARBL
            • 2009-05-06   RailsConf
            • 2009-11-02   0.0.5 bundler, precompilation, Duby
            • 2009-11-20   RubyConf
            • 2009-12-02   0.0.6 Rails 3.0.pre primer & image demos
            • 2009-12-27   @urekat publishes Rails 2.3.5 patches
            • 2010-01-21   0.0.8 Rails 2.3.5 Primer for DM & TinyDS
            • 2010-01-26   0.0.9 Mechanize and Hpricot demos
            • 2010-02-19   @carlhuda publishes bundler08
            • 2010-02-27   0.0.10 ActionMailer demos
            • 2010-04-08   0.0.11 deferred dispatcher (early look)
            • 2010-05-06   0.0.12 JRuby 1.5 & OpenSSL 0.7
             13



Sunday, May 9, 2010
Current Issues with JRuby on App Engine
            • Several seconds to “spin-up” a new JRuby instance
            • Some gems may need their extensions ported to Java
            • Not officially supported , but you have all that you need




                                       +
             14



Sunday, May 9, 2010
Install it Now

                      sudo gem install google-appengine



                        Everything you need installs as gems


             15



Sunday, May 9, 2010
App Engine Gems
            • Development Gems
              – appengine-sdk
              – appengine-jruby-jars
              – appengine-rack
              – appengine-tools . . . dev_appserver.rb & appcfg.rb
            • Runtime Gems
                  – appengine-rack . . . . rack & jruby-rack
                  – appengine-apis
            • Related Gems
              – dm-appengine
                  – rails_appengine
                  – rails_dm_datastore
                  – rails_tiny_ds
             16



Sunday, May 9, 2010
App Engine JRuby APIs
            • AppEngine::Users
            • AppEngine::Datastore
            • AppEngine::Memcache
            • AppEngine::Mail
            • AppEngine::URLFetch
            • AppEngine::Images
            • AppEngine::Logger
            • AppEngine::XMPP
            • AppEngine::Labs::TaskQueue




             17



Sunday, May 9, 2010
Users API
            • Existing User Account
            • Restrict your app to a domain


           map '/src' do
             use AppEngine::Rack::AdminRequired
             use AppEngine::Rack::SSLRequired
             run ActionController::Dispatcher.new
           end

           map '/' do
             run ActionController::Dispatcher.new
           end



             18



Sunday, May 9, 2010
Datastore API + DataMapper
             # Comparisons you’d expect
             Zoo.first(:name => 'Galveston')

             # The 'gt/lt' means greater/less-than.
             Person.all(:age.gt => 30)
             Person.all(:age.lt => 40)

             # The 'gte/lte' means greather/less-than-or-equal-to.
             Person.all(:age.gte => 30)
             Person.all(:age.lte => 40)

             # The value of a pair is an Array
             Person.all(:name => 'Sam', :id => [ 1, 2, 3, 4, 5 ])
             Person.all(:name => [ 'bob', 'rick', 'steve' ])

             # Ordering
             Person.all(:order => [ :age.desc ])

             19



Sunday, May 9, 2010
Memcache API
            • No configuration required
            • Same API as Ruby-Memcache
            • Keys can be any Symbol or String
            • Can store any Marshalable or Serializable object


           cache = AppEngine::Memcache.new
           cache.set_many({:a => 1, :foo => 1..5})
           a, foo = cache.get(:a, :foo)




             20



Sunday, May 9, 2010
URL Fetch API
            • Drop-in replacement for Net::HTTP


           AppEngine::URLFetch.fetch(url, options={})

                  :method
                  :payload
                  :headers
                  :allow_truncated
                  :follow_redirects
                  :deadline




             21



Sunday, May 9, 2010
Resources
            • John Woodell, @johnwoodell
            • Blog
                  – http://jruby-appengine.blogspot.com/
            • Code Site
                  – http://code.google.com/p/appengine-jruby/
            • Google Group
                  – http://groups.google.com/group/appengine-jruby




             22



Sunday, May 9, 2010
Sunday, May 9, 2010

More Related Content

PDF
MongoDB at Sailthru: Scaling and Schema Design
DATAVERSITY
 
PDF
Odnoklassniki.ru Architecture
Dmitry Buzdin
 
PDF
Optimizing WordPress Performance on Shared Web Hosting
Jon Brown
 
PDF
Immutant
Norman Richards
 
PDF
Memcached
elliando dias
 
PDF
Plugin Memcached%20 Study
Liu Lizhi
 
PPTX
Corley scalability
Corley S.r.l.
 
PDF
Deploy Python apps in 5 min with a PaaS
Appsembler
 
MongoDB at Sailthru: Scaling and Schema Design
DATAVERSITY
 
Odnoklassniki.ru Architecture
Dmitry Buzdin
 
Optimizing WordPress Performance on Shared Web Hosting
Jon Brown
 
Immutant
Norman Richards
 
Memcached
elliando dias
 
Plugin Memcached%20 Study
Liu Lizhi
 
Corley scalability
Corley S.r.l.
 
Deploy Python apps in 5 min with a PaaS
Appsembler
 

What's hot (19)

PDF
Crank Up Your Apps With TorqueBox
Jim Crossley
 
PDF
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet
 
PDF
Pitfalls of Continuous Deployment
zeeg
 
PDF
Improving Website Performance and Scalability with Memcached
Acquia
 
PDF
Uptime Database Appliance - Technology Preview
Uptime Technologies LLC
 
PDF
Thinking through puppet code layout
Tomas Doran
 
PDF
Making DSpace XMLUI Your Own
Tim Donohue
 
PDF
Docker, Kubernetes, and Mesos recipes for Java developers
Arun Gupta
 
PDF
Introducing Immutant
Jim Crossley
 
PDF
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Bruce Snyder
 
PDF
Caching and JCache with Greg Luck 18.02.16
Comsysto Reply GmbH
 
PDF
DataMapper on Infinispan
Lance Ball
 
PDF
Enterprise Messaging With Spring JMS
Bruce Snyder
 
PDF
Managing MySQL with Ansible
Ben Mildren
 
PPTX
Learn you some Ansible for great good!
David Lapsley
 
PDF
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
PDF
Postgres Plus Cloud Database on OpenStack
Kamesh Pemmaraju
 
PPTX
Puppet_training
Afroz Hussain
 
PPTX
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
In-Memory Computing Summit
 
Crank Up Your Apps With TorqueBox
Jim Crossley
 
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet
 
Pitfalls of Continuous Deployment
zeeg
 
Improving Website Performance and Scalability with Memcached
Acquia
 
Uptime Database Appliance - Technology Preview
Uptime Technologies LLC
 
Thinking through puppet code layout
Tomas Doran
 
Making DSpace XMLUI Your Own
Tim Donohue
 
Docker, Kubernetes, and Mesos recipes for Java developers
Arun Gupta
 
Introducing Immutant
Jim Crossley
 
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Bruce Snyder
 
Caching and JCache with Greg Luck 18.02.16
Comsysto Reply GmbH
 
DataMapper on Infinispan
Lance Ball
 
Enterprise Messaging With Spring JMS
Bruce Snyder
 
Managing MySQL with Ansible
Ben Mildren
 
Learn you some Ansible for great good!
David Lapsley
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
Postgres Plus Cloud Database on OpenStack
Kamesh Pemmaraju
 
Puppet_training
Afroz Hussain
 
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
In-Memory Computing Summit
 
Ad

Similar to Red Dirt Ruby Conference (20)

PDF
App Engine Meetup
John Woodell
 
PDF
Oscon 2010
John Woodell
 
PDF
Railsconf 2010
John Woodell
 
PDF
JRubyConf 2009
John Woodell
 
PDF
Aloha on-rails-2009
John Woodell
 
PDF
Rubypalooza 2009
John Woodell
 
PDF
RubyConf 2009
John Woodell
 
PDF
App Engine Overview Cloud Futures Publish
Chris Schalk
 
PDF
App Engine Presentation @ SFJUG Sep 2010
Chris Schalk
 
PDF
AppScale Talk at SBonRails
Chris Bunch
 
PDF
App engine cloud_comp_expo_nyc
Chris Schalk
 
PDF
App Engine Overview @ Google Hackathon SXSW 2010
Chris Schalk
 
PDF
Cannibalising The Google App Engine
catherinewall
 
PDF
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
ikailan
 
PDF
App engine devfest_mexico_10
Chris Schalk
 
KEY
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
PDF
What's new in App Engine and intro to App Engine for Business
Chris Schalk
 
PDF
Don Schwarz App Engine Talk
Tech in the Middle
 
PDF
2011 june-kuala-lumpur-gtug-hackathon
ikailan
 
PDF
Ruby on Google App Engine: Upgrade to Google App "Turbo" Engine
Joseph Ku
 
App Engine Meetup
John Woodell
 
Oscon 2010
John Woodell
 
Railsconf 2010
John Woodell
 
JRubyConf 2009
John Woodell
 
Aloha on-rails-2009
John Woodell
 
Rubypalooza 2009
John Woodell
 
RubyConf 2009
John Woodell
 
App Engine Overview Cloud Futures Publish
Chris Schalk
 
App Engine Presentation @ SFJUG Sep 2010
Chris Schalk
 
AppScale Talk at SBonRails
Chris Bunch
 
App engine cloud_comp_expo_nyc
Chris Schalk
 
App Engine Overview @ Google Hackathon SXSW 2010
Chris Schalk
 
Cannibalising The Google App Engine
catherinewall
 
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
ikailan
 
App engine devfest_mexico_10
Chris Schalk
 
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
What's new in App Engine and intro to App Engine for Business
Chris Schalk
 
Don Schwarz App Engine Talk
Tech in the Middle
 
2011 june-kuala-lumpur-gtug-hackathon
ikailan
 
Ruby on Google App Engine: Upgrade to Google App "Turbo" Engine
Joseph Ku
 
Ad

Recently uploaded (20)

PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂşnior
 
PDF
Beyond Automation: The Role of IoT Sensor Integration in Next-Gen Industries
Rejig Digital
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Software Development Company | KodekX
KodekX
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Doc9.....................................
SofiaCollazos
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂşnior
 
Beyond Automation: The Role of IoT Sensor Integration in Next-Gen Industries
Rejig Digital
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 

Red Dirt Ruby Conference

  • 2. JRuby on App Engine Run Ruby apps on Google Servers, with access to first-class Java APIs John Woodell May 6, 2010 2 Sunday, May 9, 2010
  • 3. Google App Engine 3 Sunday, May 9, 2010
  • 4. Key Features • No need to install or maintain your own stack • Use Google scalable services via standard APIs • Built-in application management console • Google does the scaling for you • Pay-as-you-go, with free quota to get started 4 Sunday, May 9, 2010
  • 5. Key Limitations • No native code • No threads or sockets • No writing to the filesystem • No relational database • No more than 30 seconds per request 5 Sunday, May 9, 2010
  • 6. Dev AppServer • 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 6 Sunday, May 9, 2010
  • 7. 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 7 Sunday, May 9, 2010
  • 8. Quotas and Billing Resource Provided Free Additional Cost CPU time 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 users $0.0001/email 50000/day to admins 8 Sunday, May 9, 2010
  • 9. App Engine Product Roadmap • SSL for third-party domains • Background servers capable of running for longer than 30s • Ability to reserve instances to reduce application loading overhead • Ability to select different availability vs. latency options for Datastore • Support for mapping operations across datasets • Datastore dump and restore facility • Raise request/response size limits for some APIs • Improved monitoring and alerting of application serving • Support for Browser Push (Comet) communication • Built-in support for OAuth & OpenID 9 Sunday, May 9, 2010
  • 10. JRuby on App Engine 10 Sunday, May 9, 2010
  • 11. Rails Deployment History • 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” • 2010 - Running in a servlet container with JRuby-Rack “powerful/portable/scalable, rack-based, JRuby” 11 Sunday, May 9, 2010
  • 12. Benefits of JRuby • Outperforms MRI in many cases... 2x to 10x • Gem extensions written in Java (no more segfaults) • A wealth of integration options and first-class Java APIs • Spin-up new instances quickly using Duby (or Java) servlets 12 Sunday, May 9, 2010
  • 13. App Engine JRuby Milestones • 2009-04-08 @olabini publishes blog post on YARBL • 2009-05-06 RailsConf • 2009-11-02 0.0.5 bundler, precompilation, Duby • 2009-11-20 RubyConf • 2009-12-02 0.0.6 Rails 3.0.pre primer & image demos • 2009-12-27 @urekat publishes Rails 2.3.5 patches • 2010-01-21 0.0.8 Rails 2.3.5 Primer for DM & TinyDS • 2010-01-26 0.0.9 Mechanize and Hpricot demos • 2010-02-19 @carlhuda publishes bundler08 • 2010-02-27 0.0.10 ActionMailer demos • 2010-04-08 0.0.11 deferred dispatcher (early look) • 2010-05-06 0.0.12 JRuby 1.5 & OpenSSL 0.7 13 Sunday, May 9, 2010
  • 14. Current Issues with JRuby on App Engine • Several seconds to “spin-up” a new JRuby instance • Some gems may need their extensions ported to Java • Not officially supported , but you have all that you need + 14 Sunday, May 9, 2010
  • 15. Install it Now sudo gem install google-appengine Everything you need installs as gems 15 Sunday, May 9, 2010
  • 16. App Engine Gems • Development Gems – appengine-sdk – appengine-jruby-jars – appengine-rack – appengine-tools . . . dev_appserver.rb & appcfg.rb • Runtime Gems – appengine-rack . . . . rack & jruby-rack – appengine-apis • Related Gems – dm-appengine – rails_appengine – rails_dm_datastore – rails_tiny_ds 16 Sunday, May 9, 2010
  • 17. App Engine JRuby APIs • AppEngine::Users • AppEngine::Datastore • AppEngine::Memcache • AppEngine::Mail • AppEngine::URLFetch • AppEngine::Images • AppEngine::Logger • AppEngine::XMPP • AppEngine::Labs::TaskQueue 17 Sunday, May 9, 2010
  • 18. Users API • Existing User Account • Restrict your app to a domain map '/src' do use AppEngine::Rack::AdminRequired use AppEngine::Rack::SSLRequired run ActionController::Dispatcher.new end map '/' do run ActionController::Dispatcher.new end 18 Sunday, May 9, 2010
  • 19. Datastore API + DataMapper # Comparisons you’d expect Zoo.first(:name => 'Galveston') # The 'gt/lt' means greater/less-than. Person.all(:age.gt => 30) Person.all(:age.lt => 40) # The 'gte/lte' means greather/less-than-or-equal-to. Person.all(:age.gte => 30) Person.all(:age.lte => 40) # The value of a pair is an Array Person.all(:name => 'Sam', :id => [ 1, 2, 3, 4, 5 ]) Person.all(:name => [ 'bob', 'rick', 'steve' ]) # Ordering Person.all(:order => [ :age.desc ]) 19 Sunday, May 9, 2010
  • 20. Memcache API • No configuration required • Same API as Ruby-Memcache • Keys can be any Symbol or String • Can store any Marshalable or Serializable object cache = AppEngine::Memcache.new cache.set_many({:a => 1, :foo => 1..5}) a, foo = cache.get(:a, :foo) 20 Sunday, May 9, 2010
  • 21. URL Fetch API • Drop-in replacement for Net::HTTP AppEngine::URLFetch.fetch(url, options={}) :method :payload :headers :allow_truncated :follow_redirects :deadline 21 Sunday, May 9, 2010
  • 22. Resources • John Woodell, @johnwoodell • Blog – http://jruby-appengine.blogspot.com/ • Code Site – http://code.google.com/p/appengine-jruby/ • Google Group – http://groups.google.com/group/appengine-jruby 22 Sunday, May 9, 2010