SlideShare una empresa de Scribd logo
1 de 31
Wednesday, May 5, 2010
JRuby on Google App Engine
            Extending the Java Platform & APIs
            John Woodell
            May 4, 2010




              2



Sunday, May 9, 2010
Google App Engine
             3



Wednesday, May 5, 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



Wednesday, May 5, 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

             6



Wednesday, May 5, 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




             7



Wednesday, May 5, 2010
JRuby on App Engine
             8



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




                                      +
             9



Wednesday, May 5, 2010
App Engine Gems
           • Development Gems
             – appengine-rack
             – appengine-tools . . . . dev_appserver.rb & appcfg.rb
             – appengine-sdk
             – appengine-jruby-jars
           • Runtime Gems
            – appengine-rack
            – dm-appengine
            – appengine-apis




             10



Wednesday, May 5, 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




             11



Wednesday, May 5, 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



             12



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




             13



Wednesday, May 5, 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
             14



Wednesday, May 5, 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 ])

             15



Wednesday, May 5, 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)




             16



Wednesday, May 5, 2010
URL Fetch API
           • Drop-in replacement for Net::HTTP


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

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




             17



Wednesday, May 5, 2010
XMPP API




             18



Wednesday, May 5, 2010
App Engine JRuby Milestones
           • 2009-04-07   Early look at Java
           • 2009-04-08   @olabini publishes blog post on YARBL
           • 2009-05-06   RailsConf (Sinatra Demo)
           • 2009-11-02   0.0.5 bundler, precompilation & Duby
           • 2009-11-20   RubyConf (Rails 3 Demo)
           • 2009-12-02   0.0.6 Image manipulation examples
           • 2010-01-21   0.0.8 Rails 2.3.5 Primer for DM & TinyDS
           • 2010-01-26   0.0.9 Mechanize and Hpricot examples
           • 2010-02-19   @carlhuda publishes bundler08
           • 2010-02-27   0.0.10 ActionMailer example
           • 2010-04-08   0.0.11 Deferred Dispatcher (early look)
           • 2010-05-05   0.0.12 JRuby 1.5.0.dev (jruby-openssl)
             19



Wednesday, May 5, 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




             20



Wednesday, May 5, 2010
Resources
           • John Woodell, woodie@google.com
           • Twitter, @johnwoodell
           • Blog: JRuby on App Engine Blog
                  – http://jruby-appengine.blogspot.com/
           • Google App Engine for JRuby
             – http://code.google.com/p/appengine-jruby/
           • Google Group
             – http://groups.google.com/group/appengine-jruby




             21



Wednesday, May 5, 2010
Bio


                       • John Wang
                         iPhone, Android, and Web Developer at Fresh Blocks in Honolulu, HI
                         Twitter: @johntwang
                         Github: jwang

                       • Objective
                         I wanted to show that JRuby on GAE is a viable solution for
                         providing RESTful JSON with Google’s Datastore to iPhone and
                         Android apps.




Tuesday, May 4, 2010
My App
                       • iPhone-JSON is a demo app used to show
                         that AppEngine with Rails 2.3.5 is fully
                         capable of being a RESTful provider with
                         DataMapper.
                       • It is currently up and running on iphone-
                         json.appspot.com for others to copy.
                       • It is also serving as the datastore for an
                         iPhone and an iPad App that are awaiting
                         approval from Apple.

Tuesday, May 4, 2010
What I Learned
                       •   When I started out, I knew I would have to use the DM-Serializer
                           plugin to add back in the RESTful abilities to DM. I did not expect
                           the JSON being POSTed to be case-sensitive for the parameters.
                       •   There was a small bug in the DM adapter that was causing
                           problems initially, but that was remedied very quickly thanks to
                           John.
                       •   I did need to add in the necessary render statements to each area in
                           the generated responds_to and was also able to get custom REST
                           actions to work without any problems.
                       •   Most 3rd Party gems come with scripts to generate models, tables,
                           etc take for work as scripts are written for ActiveRecord and not
                           DataMapper. I needed to modify some scripts for other 3-party
                           gems. Primarily the ones I’m using for doing Push Notifications to
                           the iPhone from GAE.


Tuesday, May 4, 2010
!"#$!%&'(&!"#!$%&%&'%(
)'((*+                               C1'!%44!8!"2.(0+!2/.-3!D%.(/!
,#!-%,'!./!)"*"(+,!+$-               E<F<G!%-7!H%0%I%44':+!./!5%(('7!
.+"!&"$/0%(01*231!,*/0!4'*4('!       !"#$!%&'(&0%-7!01:*231!.0!
5%((!,'!"1"1%"2/6%-7!86"2.(7!%44/!   %-#*-'!5%-!,*-.0*:!01'.:!
9*:!%!(.;.-3<                        '@4'-/'/B'%:-.-3/!%-7!J.9!
                                     #*2K:'!%!L:''M!5.0.&'-?!
=*2!5%-!9.-7!,'!%0>                  01'6:'5'.40/!#*2!3%01':!9:*,!
"?!%&%&'%(<@'(.@./<-'0               #*2:!42:51%/'/<
0?!0A.00':<5*,B%&%&'%(
3?!3.012"<5*,B%&%&'%(                0%@/0':<3:!1%/!J52::'-0(#?!EEN!
                                     2/':/<
!"#$%$&"'()$*''+,)$-..$/0+10)2341,(

56 748)$9#$'!0$&,':;$!1<"':<$=)10+$4$(#($4;9106
>6 ?1;$#':$0'<1&)$<")$@*''+,)@$10(1;)$@*''+,)$-..$/0+10)@A
B6 %<C($DE))$D'E$(94,,$4..(6
F6 G))9);$4$=1<$10<)E)(<10+$<'$;)8),'.$:(10+$341,($D'E$4$
   (#(<)9$<"4<$;1;0C<$(:..'E<$1<$5HHI6$J),<$4$=1<$"4&KL1("6
M6 N'"0$O'';),,$0)8)E$(,)).(6$3)4,,# 6
!"#$%&'"()*

 +,-./*%0,#0%#12%*344"*2$%0"%5"1)%5-0,%#%6/27%-.*0#''6%
 $".80%9-:2%13&;<"42.-$=%"42.**'>:
 +,2%*4-.<34%-**32%5#*%#%4#-.%3.0-'%?312)#0%$"7-.#02$%-0:
 @8A2%.2A21%12#(,2$%0,2%4"-.0%5,212%@8$%.22$%#%
 *2(".$#1;%-.*0#.(2%0"%*21A2%7;%3*21*%9;20>%&30%@%B22'%
 0,#0%5,2.%@%$"=%-08''%,310:
!"##$%$&'$"($)*)"+,

-./0/12$+'$3.)+3/$(.)($%$!'+1($4/$&/5/#'6"+*$!"(.$7)"#2$)+&$
&/6#'8"+*$'+$9''*#/$:66$;+*"+/<



                    !"#$%&'()*'*+#,-$.
                         #/#/+#0
MYSELF

    • Joshua Moore, Quality           • Find   me here:
       Assurance Manger at
       Armorize Technologies            • Twitter: @codingforrent

    • Wanted    to develop apps         • github: http://github.com/
       with Rails without the pains      joshsmoore
       of being a sys admin so
       started to work with Rails       • blog:
       on the GAE                        www.codingforrent.com


Monday, May 3, 2010
MY APP

    • Rails Turbine  - Goal to be a no config drop in blog engine for
       built with Rails on the GAE (still a work in progress).

    • Open             source on github

    • Built           with Rails 2.3.5, Datamapper, and HAML

    • Coauthor             the rails_dm_datastore gem to fix some rails/dm
       bugs

    • Currently           it powers my blog (www.codingforrent.com)

Monday, May 3, 2010
ROAD BLOCKS


    • Initiallyhad some bugs with datamapper and rails not always
       playing nice together. Most of those are worked out in the
       rails_dm_datastore.

    • The   next biggest problem has been testing. It can be difficult
       and sometimes unreliable for testing within the Datastore
       environment.



Monday, May 3, 2010
Wednesday, May 5, 2010

Más contenido relacionado

Destacado

Customizing Your Document in PerfectForms
Customizing Your Document in PerfectFormsCustomizing Your Document in PerfectForms
Customizing Your Document in PerfectFormsKaren Hunter-Sliger
 
Lincs Business networking presentation
Lincs Business networking presentationLincs Business networking presentation
Lincs Business networking presentationMalcolm York
 
Babelfish Articles Dec 2011
Babelfish Articles Dec 2011Babelfish Articles Dec 2011
Babelfish Articles Dec 2011Brian Crotty
 
Building Workflow Applications Through the Web
Building Workflow Applications Through the WebBuilding Workflow Applications Through the Web
Building Workflow Applications Through the WebT. Kim Nguyen
 
BPM und SOA machen mobil - Ein Architekturüberblick
BPM und SOA machen mobil - Ein ArchitekturüberblickBPM und SOA machen mobil - Ein Architekturüberblick
BPM und SOA machen mobil - Ein ArchitekturüberblickOPITZ CONSULTING Deutschland
 
Fredericton Newcomers Guide 2013
Fredericton Newcomers Guide 2013Fredericton Newcomers Guide 2013
Fredericton Newcomers Guide 2013LaurieGuthrie
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSam Brannen
 
Preparing #EdCampSantiago 2013: Looking @ Dialogue
Preparing #EdCampSantiago 2013: Looking @ Dialogue Preparing #EdCampSantiago 2013: Looking @ Dialogue
Preparing #EdCampSantiago 2013: Looking @ Dialogue Baker Publishing Company
 
Livroabelhas brasileiras 2002
Livroabelhas brasileiras 2002Livroabelhas brasileiras 2002
Livroabelhas brasileiras 2002Roberta Leme
 
[En] epayments in Europe -mbaesg Paris
[En] epayments in Europe -mbaesg Paris[En] epayments in Europe -mbaesg Paris
[En] epayments in Europe -mbaesg ParisYann Gourvennec
 
Mexican Muralist Movement
Mexican Muralist MovementMexican Muralist Movement
Mexican Muralist Movementrosabrito
 
SPSUK Apps for Office
SPSUK Apps for OfficeSPSUK Apps for Office
SPSUK Apps for OfficeWes Hackett
 
Seoul tap water arisu
Seoul tap water arisu Seoul tap water arisu
Seoul tap water arisu simrc
 
Evolution and digital design business models
Evolution and digital design business modelsEvolution and digital design business models
Evolution and digital design business modelsdigital wellbeing labs
 
IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)Nico Meisenzahl
 
オススメの技術書
オススメの技術書オススメの技術書
オススメの技術書Hiromu Shioya
 

Destacado (20)

Customizing Your Document in PerfectForms
Customizing Your Document in PerfectFormsCustomizing Your Document in PerfectForms
Customizing Your Document in PerfectForms
 
Lincs Business networking presentation
Lincs Business networking presentationLincs Business networking presentation
Lincs Business networking presentation
 
Babelfish Articles Dec 2011
Babelfish Articles Dec 2011Babelfish Articles Dec 2011
Babelfish Articles Dec 2011
 
Building Workflow Applications Through the Web
Building Workflow Applications Through the WebBuilding Workflow Applications Through the Web
Building Workflow Applications Through the Web
 
BPM und SOA machen mobil - Ein Architekturüberblick
BPM und SOA machen mobil - Ein ArchitekturüberblickBPM und SOA machen mobil - Ein Architekturüberblick
BPM und SOA machen mobil - Ein Architekturüberblick
 
Fredericton Newcomers Guide 2013
Fredericton Newcomers Guide 2013Fredericton Newcomers Guide 2013
Fredericton Newcomers Guide 2013
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
 
Preparing #EdCampSantiago 2013: Looking @ Dialogue
Preparing #EdCampSantiago 2013: Looking @ Dialogue Preparing #EdCampSantiago 2013: Looking @ Dialogue
Preparing #EdCampSantiago 2013: Looking @ Dialogue
 
Livroabelhas brasileiras 2002
Livroabelhas brasileiras 2002Livroabelhas brasileiras 2002
Livroabelhas brasileiras 2002
 
[En] epayments in Europe -mbaesg Paris
[En] epayments in Europe -mbaesg Paris[En] epayments in Europe -mbaesg Paris
[En] epayments in Europe -mbaesg Paris
 
Mexican Muralist Movement
Mexican Muralist MovementMexican Muralist Movement
Mexican Muralist Movement
 
SPSUK Apps for Office
SPSUK Apps for OfficeSPSUK Apps for Office
SPSUK Apps for Office
 
IGNITS @NIT Silchar
IGNITS @NIT SilcharIGNITS @NIT Silchar
IGNITS @NIT Silchar
 
Seoul tap water arisu
Seoul tap water arisu Seoul tap water arisu
Seoul tap water arisu
 
Evolution and digital design business models
Evolution and digital design business modelsEvolution and digital design business models
Evolution and digital design business models
 
IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)IBM Connections Adminblast - Connect17 (DEV 1268)
IBM Connections Adminblast - Connect17 (DEV 1268)
 
Oh life pdf presentation
Oh life pdf presentationOh life pdf presentation
Oh life pdf presentation
 
Comments (1)
Comments (1)Comments (1)
Comments (1)
 
オススメの技術書
オススメの技術書オススメの技術書
オススメの技術書
 
Bangalore IT Directory
Bangalore IT DirectoryBangalore IT Directory
Bangalore IT Directory
 

Similar a App Engine Meetup

Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009John Woodell
 
AppEngine Performance Tuning
AppEngine Performance TuningAppEngine Performance Tuning
AppEngine Performance TuningDavid Chen
 
What is Google App Engine?
What is Google App Engine?What is Google App Engine?
What is Google App Engine?weschwee
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGuillaume Laforge
 
Gaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge
Gaelyk - Groovy Grails eXchange 2010 - Guillaume LaforgeGaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge
Gaelyk - Groovy Grails eXchange 2010 - Guillaume LaforgeGuillaume Laforge
 
AppScale Talk at SBonRails
AppScale Talk at SBonRailsAppScale Talk at SBonRails
AppScale Talk at SBonRailsChris Bunch
 
Gaelyk - Paris GGUG 2011 - Guillaume Laforge
Gaelyk - Paris GGUG 2011 - Guillaume LaforgeGaelyk - Paris GGUG 2011 - Guillaume Laforge
Gaelyk - Paris GGUG 2011 - Guillaume LaforgeGuillaume Laforge
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java3Pillar Global
 
Google App Engine - September 17 2009
Google App Engine - September 17 2009Google App Engine - September 17 2009
Google App Engine - September 17 2009sullis
 
Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.pptYoung Alista
 
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Amazon Web Services
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.WO Community
 
Testing for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration MondayTesting for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration MondayBizTalk360
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
App engine feature
App engine featureApp engine feature
App engine featureSophea Mak
 

Similar a App Engine Meetup (20)

Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009
 
AppEngine Performance Tuning
AppEngine Performance TuningAppEngine Performance Tuning
AppEngine Performance Tuning
 
What is Google App Engine?
What is Google App Engine?What is Google App Engine?
What is Google App Engine?
 
Oscon 2010
Oscon 2010Oscon 2010
Oscon 2010
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Gaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge
Gaelyk - Groovy Grails eXchange 2010 - Guillaume LaforgeGaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge
Gaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge
 
JRubyConf 2009
JRubyConf 2009JRubyConf 2009
JRubyConf 2009
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
AppScale Talk at SBonRails
AppScale Talk at SBonRailsAppScale Talk at SBonRails
AppScale Talk at SBonRails
 
Node.js
Node.jsNode.js
Node.js
 
Gaelyk - Paris GGUG 2011 - Guillaume Laforge
Gaelyk - Paris GGUG 2011 - Guillaume LaforgeGaelyk - Paris GGUG 2011 - Guillaume Laforge
Gaelyk - Paris GGUG 2011 - Guillaume Laforge
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java
 
Google App Engine - September 17 2009
Google App Engine - September 17 2009Google App Engine - September 17 2009
Google App Engine - September 17 2009
 
Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.ppt
 
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Testing for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration MondayTesting for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration Monday
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
App engine feature
App engine featureApp engine feature
App engine feature
 

Más de John Woodell

Deploying and Maintaining an Enterprise OpenLDAP Directory
Deploying and Maintaining an Enterprise OpenLDAP DirectoryDeploying and Maintaining an Enterprise OpenLDAP Directory
Deploying and Maintaining an Enterprise OpenLDAP DirectoryJohn Woodell
 
Enterprise Mail and Calendaring with Open Software
Enterprise Mail and Calendaring with Open SoftwareEnterprise Mail and Calendaring with Open Software
Enterprise Mail and Calendaring with Open SoftwareJohn Woodell
 
Appengine ja-night-10
Appengine ja-night-10Appengine ja-night-10
Appengine ja-night-10John Woodell
 

Más de John Woodell (6)

Deploying and Maintaining an Enterprise OpenLDAP Directory
Deploying and Maintaining an Enterprise OpenLDAP DirectoryDeploying and Maintaining an Enterprise OpenLDAP Directory
Deploying and Maintaining an Enterprise OpenLDAP Directory
 
Enterprise Mail and Calendaring with Open Software
Enterprise Mail and Calendaring with Open SoftwareEnterprise Mail and Calendaring with Open Software
Enterprise Mail and Calendaring with Open Software
 
Appengine ja-night-10
Appengine ja-night-10Appengine ja-night-10
Appengine ja-night-10
 
Rejectkaigi 2010
Rejectkaigi 2010Rejectkaigi 2010
Rejectkaigi 2010
 
Jrubykaigi 2010
Jrubykaigi 2010Jrubykaigi 2010
Jrubykaigi 2010
 
Rubypalooza 2009
Rubypalooza 2009Rubypalooza 2009
Rubypalooza 2009
 

App Engine Meetup

  • 2. JRuby on Google App Engine Extending the Java Platform & APIs John Woodell May 4, 2010 2 Sunday, May 9, 2010
  • 3. Google App Engine 3 Wednesday, May 5, 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 Wednesday, May 5, 2010
  • 5. 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 6 Wednesday, May 5, 2010
  • 6. Key Limitations • No native code • No threads or sockets • No writing to the filesystem • No relational database • No more than 30 seconds per request 7 Wednesday, May 5, 2010
  • 7. JRuby on App Engine 8 Wednesday, May 5, 2010
  • 8. Current Issues with JRuby on App Engine • Several seconds to “spin-up” a new JRuby instance • Some gems still need their extensions ported to Java • Not officially supported, but you have all that you need + 9 Wednesday, May 5, 2010
  • 9. App Engine Gems • Development Gems – appengine-rack – appengine-tools . . . . dev_appserver.rb & appcfg.rb – appengine-sdk – appengine-jruby-jars • Runtime Gems – appengine-rack – dm-appengine – appengine-apis 10 Wednesday, May 5, 2010
  • 10. 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 11 Wednesday, May 5, 2010
  • 11. 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 12 Wednesday, May 5, 2010
  • 12. App Engine JRuby APIs • AppEngine::Users • AppEngine::Datastore • AppEngine::Memcache • AppEngine::Mail • AppEngine::URLFetch • AppEngine::Images • AppEngine::Logger • AppEngine::XMPP • AppEngine::Labs::TaskQueue 13 Wednesday, May 5, 2010
  • 13. 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 14 Wednesday, May 5, 2010
  • 14. 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 ]) 15 Wednesday, May 5, 2010
  • 15. 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) 16 Wednesday, May 5, 2010
  • 16. URL Fetch API • Drop-in replacement for Net::HTTP AppEngine::URLFetch.fetch(url, options={}) :method :payload :headers :allow_truncated :follow_redirects :deadline 17 Wednesday, May 5, 2010
  • 17. XMPP API 18 Wednesday, May 5, 2010
  • 18. App Engine JRuby Milestones • 2009-04-07 Early look at Java • 2009-04-08 @olabini publishes blog post on YARBL • 2009-05-06 RailsConf (Sinatra Demo) • 2009-11-02 0.0.5 bundler, precompilation & Duby • 2009-11-20 RubyConf (Rails 3 Demo) • 2009-12-02 0.0.6 Image manipulation examples • 2010-01-21 0.0.8 Rails 2.3.5 Primer for DM & TinyDS • 2010-01-26 0.0.9 Mechanize and Hpricot examples • 2010-02-19 @carlhuda publishes bundler08 • 2010-02-27 0.0.10 ActionMailer example • 2010-04-08 0.0.11 Deferred Dispatcher (early look) • 2010-05-05 0.0.12 JRuby 1.5.0.dev (jruby-openssl) 19 Wednesday, May 5, 2010
  • 19. 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 20 Wednesday, May 5, 2010
  • 20. Resources • John Woodell, woodie@google.com • Twitter, @johnwoodell • Blog: JRuby on App Engine Blog – http://jruby-appengine.blogspot.com/ • Google App Engine for JRuby – http://code.google.com/p/appengine-jruby/ • Google Group – http://groups.google.com/group/appengine-jruby 21 Wednesday, May 5, 2010
  • 21. Bio • John Wang iPhone, Android, and Web Developer at Fresh Blocks in Honolulu, HI Twitter: @johntwang Github: jwang • Objective I wanted to show that JRuby on GAE is a viable solution for providing RESTful JSON with Google’s Datastore to iPhone and Android apps. Tuesday, May 4, 2010
  • 22. My App • iPhone-JSON is a demo app used to show that AppEngine with Rails 2.3.5 is fully capable of being a RESTful provider with DataMapper. • It is currently up and running on iphone- json.appspot.com for others to copy. • It is also serving as the datastore for an iPhone and an iPad App that are awaiting approval from Apple. Tuesday, May 4, 2010
  • 23. What I Learned • When I started out, I knew I would have to use the DM-Serializer plugin to add back in the RESTful abilities to DM. I did not expect the JSON being POSTed to be case-sensitive for the parameters. • There was a small bug in the DM adapter that was causing problems initially, but that was remedied very quickly thanks to John. • I did need to add in the necessary render statements to each area in the generated responds_to and was also able to get custom REST actions to work without any problems. • Most 3rd Party gems come with scripts to generate models, tables, etc take for work as scripts are written for ActiveRecord and not DataMapper. I needed to modify some scripts for other 3-party gems. Primarily the ones I’m using for doing Push Notifications to the iPhone from GAE. Tuesday, May 4, 2010
  • 24. !"#$!%&'(&!"#!$%&%&'%( )'((*+ C1'!%44!8!"2.(0+!2/.-3!D%.(/! ,#!-%,'!./!)"*"(+,!+$- E<F<G!%-7!H%0%I%44':+!./!5%(('7! .+"!&"$/0%(01*231!,*/0!4'*4('! !"#$!%&'(&0%-7!01:*231!.0! 5%((!,'!"1"1%"2/6%-7!86"2.(7!%44/! %-#*-'!5%-!,*-.0*:!01'.:! 9*:!%!(.;.-3< '@4'-/'/B'%:-.-3/!%-7!J.9! #*2K:'!%!L:''M!5.0.&'-?! =*2!5%-!9.-7!,'!%0> 01'6:'5'.40/!#*2!3%01':!9:*,! "?!%&%&'%(<@'(.@./<-'0 #*2:!42:51%/'/< 0?!0A.00':<5*,B%&%&'%( 3?!3.012"<5*,B%&%&'%( 0%@/0':<3:!1%/!J52::'-0(#?!EEN! 2/':/<
  • 25. !"#$%$&"'()$*''+,)$-..$/0+10)2341,( 56 748)$9#$'!0$&,':;$!1<"':<$=)10+$4$(#($4;9106 >6 ?1;$#':$0'<1&)$<")$@*''+,)@$10(1;)$@*''+,)$-..$/0+10)@A B6 %<C($DE))$D'E$(94,,$4..(6 F6 G))9);$4$=1<$10<)E)(<10+$<'$;)8),'.$:(10+$341,($D'E$4$ (#(<)9$<"4<$;1;0C<$(:..'E<$1<$5HHI6$J),<$4$=1<$"4&KL1("6 M6 N'"0$O'';),,$0)8)E$(,)).(6$3)4,,# 6
  • 26. !"#$%&'"()* +,-./*%0,#0%#12%*344"*2$%0"%5"1)%5-0,%#%6/27%-.*0#''6% $".80%9-:2%13&;<"42.-$=%"42.**'>: +,2%*4-.<34%-**32%5#*%#%4#-.%3.0-'%?312)#0%$"7-.#02$%-0: @8A2%.2A21%12#(,2$%0,2%4"-.0%5,212%@8$%.22$%#% *2(".$#1;%-.*0#.(2%0"%*21A2%7;%3*21*%9;20>%&30%@%B22'% 0,#0%5,2.%@%$"=%-08''%,310:
  • 28. MYSELF • Joshua Moore, Quality • Find me here: Assurance Manger at Armorize Technologies • Twitter: @codingforrent • Wanted to develop apps • github: http://github.com/ with Rails without the pains joshsmoore of being a sys admin so started to work with Rails • blog: on the GAE www.codingforrent.com Monday, May 3, 2010
  • 29. MY APP • Rails Turbine - Goal to be a no config drop in blog engine for built with Rails on the GAE (still a work in progress). • Open source on github • Built with Rails 2.3.5, Datamapper, and HAML • Coauthor the rails_dm_datastore gem to fix some rails/dm bugs • Currently it powers my blog (www.codingforrent.com) Monday, May 3, 2010
  • 30. ROAD BLOCKS • Initiallyhad some bugs with datamapper and rails not always playing nice together. Most of those are worked out in the rails_dm_datastore. • The next biggest problem has been testing. It can be difficult and sometimes unreliable for testing within the Datastore environment. Monday, May 3, 2010