SlideShare une entreprise Scribd logo
1  sur  35
Wednesday, November 18, 2009
Ruby & Duby on
           Google App Engine
           John Woodell
           Ryan Brown
           Nov 17, 2009




             2



Wednesday, November 18, 2009
Google App Engine
             3



Wednesday, November 18, 2009
What is Google App Engine?
           • A cloud-computing platform
           • Run your web apps on Google’s infrastructure
           • We provide the container and services (PaaS)
                 – Hardware, connectivity
                 – Operating system
                 – JVM
                 – Servlet container
                 – Software services




             4



Wednesday, November 18, 2009
Key Features
           • No need to install or maintain your own stack
           • We do the scaling for you
           • Use Google’s scalable services via standard APIs
           • Charge only for actual usage
             – Always free to get started
           • Built-in application management console




             5



Wednesday, November 18, 2009
App Engine Architecture
                                                         Incoming Requests



                   Load                    App Engine     App Engine            App Engine
                  Balancer                  Front End      Front End             Front End




                                           AppServer      AppServer             AppServer



                                                                       Other Google
                           AppServer                                   Infrastructure

                                       API Layer                       - Bigtable

                                                                       - Google Accounts

                                                                       - Memcache
                               App       App       App
                                                                       - Image manipulation


             6



Wednesday, November 18, 2009
Traditional Ruby App Server Strategy
           • Load everything into memory, servers can sit idle
           • The “big box” database strategy, will eventually hit a wall
           • Ruby and C extensions, portability issues, fewer APIs
           • Allocate and administer machines, manage load balancers




             7



Wednesday, November 18, 2009
JRuby on App Engine Strategy
           • Load only what you need for each new instance
           • Distributed persistence layer... simple and scalable
           • JRuby and Java, catch exceptions and use first-class APIs
           • Only worry about your application code in the container




             8



Wednesday, November 18, 2009
WhiteHouse.gov/openforquestions




             9



Wednesday, November 18, 2009
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 users    $0.0001/email
                                50000/day to admins

            10



Wednesday, November 18, 2009
JRuby on App Engine
            11



Wednesday, November 18, 2009
Easy to Install

                  sudo gem install google-appengine



                          Everything you need installs as gems


            12



Wednesday, November 18, 2009
Support for JRuby
           • Can outperforms MRI in many cases
           • Gem extensions written in Java (no more segfaults)
           • A wealth of integration options available
           • Already works on App Engine with supported APIs




            13



Wednesday, November 18, 2009
Support for Sinatra Microframework
           • No learning curve... a simple and elegant DSL
           • Some data-driven apps don’t require MVC or ActionView
           • No need to extract the components we can’t use
           • New application instances can spin up quickly




            14



Wednesday, November 18, 2009
Support for 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
           • Better routing and Rack integration
           • Better Javascript integration and options
           • Rails conventions!




            15



Wednesday, November 18, 2009
Support for 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
           • Supports validations and legacy AR finders
           • Already works with dm-appengine wrapper




            16



Wednesday, November 18, 2009
Support for Servlet 2.5 Spec
           • 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




            17



Wednesday, November 18, 2009
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



            18



Wednesday, November 18, 2009
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




            19



Wednesday, November 18, 2009
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)




            20



Wednesday, November 18, 2009
Administration
           • Admin Console
                 – Invite others to be developers
                 – Browse your datastore & manage indexes
                 – View access data & error logs
                 – Analyze traffic
                 – View the status of scheduled tasks
                 – Test new versions of your app




            21



Wednesday, November 18, 2009
Demo

       run lambda { |env| [200, {}, 'Hello'] }




            22



Wednesday, November 18, 2009
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 an officially supported platform




            23



Wednesday, November 18, 2009
Introducing

                                 Duby


Wednesday, November 18, 2009
Duby has Ruby-inspired Syntax

                       def fib(a:int)
                         if a < 2
                           a
                         else
                           fib(a - 1) + fib(a - 2)
                         end
                       end

                       puts fib 10

Wednesday, November 18, 2009
// Generated from examples/Test.duby

           public class Test extends java.lang.Object {

                public static void main(String[] argv) {
                  System.out.println(Test.fib(10));
                }

                public static int fib(int a) {
                  return (a < 2) ?
                      (a) :
                      ((Test.fib((a - 1)) + Test.fib((a - 2))));
                }

           }


Wednesday, November 18, 2009
Duby’s not Ruby
           • Statically typed
           • No Duby runtime
           • Uses Java’s type system




            27



Wednesday, November 18, 2009
A Simple Duby App
             import javax.servlet.http.HttpServlet
             import com.google.appengine.ext.duby.db.Model

             class Post < Model
               def initialize; end

               property title, String
               property body, Text
             end

             class DubyApp < HttpServlet
               def_edb(list, 'com/ribrdb/list.dhtml')

                 def doGet(request, response)
                   @posts = Post.all.run
                   response.getWriter.write(list)
                 end

               def doPost(request, response)
                 post = Post.new
                 post.title = request.getParameter('title')
                 post.body = Text.new(request.getParameter('body'))
                 post.save
                 doGet(request, response)
               end
             end


            28



Wednesday, November 18, 2009
A Simple Duby App
             import javax.servlet.http.HttpServlet
             import com.google.appengine.ext.duby.db.Model

             class Post < Model
               def initialize; end

               property title, String
               property body, Text
             end                                          Types
             class DubyApp < HttpServlet           inferred from parent
               def_edb(list, 'com/ribrdb/list.dhtml')
                                                           class
                 def doGet(request, response)
                   @posts = Post.all.run
                   response.getWriter.write(list)
                 end

               def doPost(request, response)
                 post = Post.new
                 post.title = request.getParameter('title')
                 post.body = Text.new(request.getParameter('body'))
                 post.save
                 doGet(request, response)
               end
             end


            29



Wednesday, November 18, 2009
A Simple Duby App
             import javax.servlet.http.HttpServlet
             import com.google.appengine.ext.duby.db.Model

             class Post < Model
               def initialize; end

               property title, String
               property body, Text
             end
                                                    Plugins
             class DubyApp < HttpServlet
               def_edb(list, 'com/ribrdb/list.dhtml')

                 def doGet(request, response)
                   @posts = Post.all.run
                   response.getWriter.write(list)
                 end

               def doPost(request, response)
                 post = Post.new
                 post.title = request.getParameter('title')
                 post.body = Text.new(request.getParameter('body'))
                 post.save
                 doGet(request, response)
               end
             end


            30



Wednesday, November 18, 2009
Duby Supports Plugins
                Only form of metaprogramming (for now)


            require 'erb'

            Duby::AST.defmacro('def_edb') do |duby, fcall, p|
              name = fcall.args_node.get(0).name
              path = fcall.args_node.get(1).value
              erb = ERB::Compiler.new(nil)
            ...
              src = erb.compile(IO.read(path))
              duby.eval(src, p, “(edb)”)
            end




Wednesday, November 18, 2009
Duby Can Use erb Templates
              <title>Posts</title>
              <body>
                <h1>All Posts:</h1>
                <% for post in @posts %>
                  <h2><%= post.title %></h2>
                  <p><%= post.body.getValue %></p>
                <% end %>
                <hr>
                <h1>New Post:</h1>
                <form method=post>
                  Title: <input type=text name=title><br>
                  Body: <textarea name=body></textarea><br>
                  <input type=submit>
                </form>
              </body>



Wednesday, November 18, 2009
More to Come
           • Open classes
           • Mix ins
           • Blocks
           • More




            33



Wednesday, November 18, 2009
Resources
           • Ryan Brown, ribrdb@google.com
              John Woodell, woodie@google.com
           • 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/




            34



Wednesday, November 18, 2009
Wednesday, November 18, 2009

Contenu connexe

Tendances

Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraStoyan Zhekov
 
Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...
Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...
Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...Umbra Software
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin ProgrammingAtlassian
 
SemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptxSemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptxSumanMitra22
 
Domino OSGi Development
Domino OSGi DevelopmentDomino OSGi Development
Domino OSGi DevelopmentPaul Fiore
 
PHP in the Cloud
PHP in the CloudPHP in the Cloud
PHP in the CloudAcquia
 
Axceleon Presentation at Siggraph 2009
Axceleon Presentation at Siggraph 2009Axceleon Presentation at Siggraph 2009
Axceleon Presentation at Siggraph 2009Axceleon Inc
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3Anton Narusberg
 

Tendances (11)

Java withrealworldtechnology
Java withrealworldtechnologyJava withrealworldtechnology
Java withrealworldtechnology
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
 
SOA on Rails
SOA on RailsSOA on Rails
SOA on Rails
 
Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...
Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...
Umbra Ignite 2015: Graham Wihlidal – Adapting a technology stream to ever-evo...
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
 
SemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptxSemeruRuntimesUnderTheCover .pptx
SemeruRuntimesUnderTheCover .pptx
 
Domino OSGi Development
Domino OSGi DevelopmentDomino OSGi Development
Domino OSGi Development
 
PHP in the Cloud
PHP in the CloudPHP in the Cloud
PHP in the Cloud
 
Splunk for JMX
Splunk for JMXSplunk for JMX
Splunk for JMX
 
Axceleon Presentation at Siggraph 2009
Axceleon Presentation at Siggraph 2009Axceleon Presentation at Siggraph 2009
Axceleon Presentation at Siggraph 2009
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3
 

En vedette

En vedette (6)

Appengine ja-night-10
Appengine ja-night-10Appengine ja-night-10
Appengine ja-night-10
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009
 
Jrubykaigi 2010
Jrubykaigi 2010Jrubykaigi 2010
Jrubykaigi 2010
 
Oscon 2010
Oscon 2010Oscon 2010
Oscon 2010
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
Rejectkaigi 2010
Rejectkaigi 2010Rejectkaigi 2010
Rejectkaigi 2010
 

Similaire à Ruby & Duby on Google App Engine: A Comparison of JRuby and Duby for Building Apps

Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
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
 
2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathonikailan
 
Cloud Computing for Barcamp NOLA 2009
Cloud Computing for Barcamp NOLA 2009Cloud Computing for Barcamp NOLA 2009
Cloud Computing for Barcamp NOLA 2009Steven Evatt
 
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT Group
 
Introduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesIntroduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesChris Schalk
 
What's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for BusinessWhat's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for BusinessChris Schalk
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Charles Nutter
 
Introduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for CloudIntroduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for CloudGear6
 
Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalkChris Schalk
 
Introduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesIntroduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesChris Schalk
 
Devfest09 App Engine Java
Devfest09  App Engine  JavaDevfest09  App Engine  Java
Devfest09 App Engine JavaChris Schalk
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.jsRichard Rodger
 
Empowering the Social Web with Apache Shindig
Empowering the Social Web with Apache ShindigEmpowering the Social Web with Apache Shindig
Empowering the Social Web with Apache Shindigplindner
 
Google Developer Days Brazil 2009 - Java Appengine
Google Developer Days Brazil 2009 -  Java AppengineGoogle Developer Days Brazil 2009 -  Java Appengine
Google Developer Days Brazil 2009 - Java AppenginePatrick Chanezon
 
GR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf
 

Similaire à Ruby & Duby on Google App Engine: A Comparison of JRuby and Duby for Building Apps (20)

Don Schwarz App Engine Talk
Don Schwarz App Engine TalkDon Schwarz App Engine Talk
Don Schwarz App Engine Talk
 
JRubyConf 2009
JRubyConf 2009JRubyConf 2009
JRubyConf 2009
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
What is Google App Engine?
What is Google App Engine?What is Google App Engine?
What is Google App Engine?
 
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
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
 
2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon
 
Cloud Computing for Barcamp NOLA 2009
Cloud Computing for Barcamp NOLA 2009Cloud Computing for Barcamp NOLA 2009
Cloud Computing for Barcamp NOLA 2009
 
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
 
Introduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesIntroduction to Google's Cloud Technologies
Introduction to Google's Cloud Technologies
 
What's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for BusinessWhat's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for Business
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016
 
Introduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for CloudIntroduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for Cloud
 
Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalk
 
Introduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesIntroduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform Technologies
 
Devfest09 App Engine Java
Devfest09  App Engine  JavaDevfest09  App Engine  Java
Devfest09 App Engine Java
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.js
 
Empowering the Social Web with Apache Shindig
Empowering the Social Web with Apache ShindigEmpowering the Social Web with Apache Shindig
Empowering the Social Web with Apache Shindig
 
Google Developer Days Brazil 2009 - Java Appengine
Google Developer Days Brazil 2009 -  Java AppengineGoogle Developer Days Brazil 2009 -  Java Appengine
Google Developer Days Brazil 2009 - Java Appengine
 
GR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting Grails
 

Dernier

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Dernier (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Ruby & Duby on Google App Engine: A Comparison of JRuby and Duby for Building Apps

  • 2. Ruby & Duby on Google App Engine John Woodell Ryan Brown Nov 17, 2009 2 Wednesday, November 18, 2009
  • 3. Google App Engine 3 Wednesday, November 18, 2009
  • 4. What is Google App Engine? • A cloud-computing platform • Run your web apps on Google’s infrastructure • We provide the container and services (PaaS) – Hardware, connectivity – Operating system – JVM – Servlet container – Software services 4 Wednesday, November 18, 2009
  • 5. Key Features • No need to install or maintain your own stack • We do the scaling for you • Use Google’s scalable services via standard APIs • Charge only for actual usage – Always free to get started • Built-in application management console 5 Wednesday, November 18, 2009
  • 6. App Engine Architecture Incoming Requests Load App Engine App Engine App Engine Balancer Front End Front End Front End AppServer AppServer AppServer Other Google AppServer Infrastructure API Layer - Bigtable - Google Accounts - Memcache App App App - Image manipulation 6 Wednesday, November 18, 2009
  • 7. Traditional Ruby App Server Strategy • Load everything into memory, servers can sit idle • The “big box” database strategy, will eventually hit a wall • Ruby and C extensions, portability issues, fewer APIs • Allocate and administer machines, manage load balancers 7 Wednesday, November 18, 2009
  • 8. JRuby on App Engine Strategy • Load only what you need for each new instance • Distributed persistence layer... simple and scalable • JRuby and Java, catch exceptions and use first-class APIs • Only worry about your application code in the container 8 Wednesday, November 18, 2009
  • 9. WhiteHouse.gov/openforquestions 9 Wednesday, November 18, 2009
  • 10. 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 users $0.0001/email 50000/day to admins 10 Wednesday, November 18, 2009
  • 11. JRuby on App Engine 11 Wednesday, November 18, 2009
  • 12. Easy to Install sudo gem install google-appengine Everything you need installs as gems 12 Wednesday, November 18, 2009
  • 13. Support for JRuby • Can outperforms MRI in many cases • Gem extensions written in Java (no more segfaults) • A wealth of integration options available • Already works on App Engine with supported APIs 13 Wednesday, November 18, 2009
  • 14. Support for Sinatra Microframework • No learning curve... a simple and elegant DSL • Some data-driven apps don’t require MVC or ActionView • No need to extract the components we can’t use • New application instances can spin up quickly 14 Wednesday, November 18, 2009
  • 15. Support for 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 • Better routing and Rack integration • Better Javascript integration and options • Rails conventions! 15 Wednesday, November 18, 2009
  • 16. Support for 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 • Supports validations and legacy AR finders • Already works with dm-appengine wrapper 16 Wednesday, November 18, 2009
  • 17. Support for Servlet 2.5 Spec • 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 17 Wednesday, November 18, 2009
  • 18. 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 18 Wednesday, November 18, 2009
  • 19. 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 19 Wednesday, November 18, 2009
  • 20. 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) 20 Wednesday, November 18, 2009
  • 21. Administration • Admin Console – Invite others to be developers – Browse your datastore & manage indexes – View access data & error logs – Analyze traffic – View the status of scheduled tasks – Test new versions of your app 21 Wednesday, November 18, 2009
  • 22. Demo run lambda { |env| [200, {}, 'Hello'] } 22 Wednesday, November 18, 2009
  • 23. 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 an officially supported platform 23 Wednesday, November 18, 2009
  • 24. Introducing Duby Wednesday, November 18, 2009
  • 25. Duby has Ruby-inspired Syntax def fib(a:int) if a < 2 a else fib(a - 1) + fib(a - 2) end end puts fib 10 Wednesday, November 18, 2009
  • 26. // Generated from examples/Test.duby public class Test extends java.lang.Object { public static void main(String[] argv) { System.out.println(Test.fib(10)); } public static int fib(int a) { return (a < 2) ? (a) : ((Test.fib((a - 1)) + Test.fib((a - 2)))); } } Wednesday, November 18, 2009
  • 27. Duby’s not Ruby • Statically typed • No Duby runtime • Uses Java’s type system 27 Wednesday, November 18, 2009
  • 28. A Simple Duby App import javax.servlet.http.HttpServlet import com.google.appengine.ext.duby.db.Model class Post < Model def initialize; end property title, String property body, Text end class DubyApp < HttpServlet def_edb(list, 'com/ribrdb/list.dhtml') def doGet(request, response) @posts = Post.all.run response.getWriter.write(list) end def doPost(request, response) post = Post.new post.title = request.getParameter('title') post.body = Text.new(request.getParameter('body')) post.save doGet(request, response) end end 28 Wednesday, November 18, 2009
  • 29. A Simple Duby App import javax.servlet.http.HttpServlet import com.google.appengine.ext.duby.db.Model class Post < Model def initialize; end property title, String property body, Text end Types class DubyApp < HttpServlet inferred from parent def_edb(list, 'com/ribrdb/list.dhtml') class def doGet(request, response) @posts = Post.all.run response.getWriter.write(list) end def doPost(request, response) post = Post.new post.title = request.getParameter('title') post.body = Text.new(request.getParameter('body')) post.save doGet(request, response) end end 29 Wednesday, November 18, 2009
  • 30. A Simple Duby App import javax.servlet.http.HttpServlet import com.google.appengine.ext.duby.db.Model class Post < Model def initialize; end property title, String property body, Text end Plugins class DubyApp < HttpServlet def_edb(list, 'com/ribrdb/list.dhtml') def doGet(request, response) @posts = Post.all.run response.getWriter.write(list) end def doPost(request, response) post = Post.new post.title = request.getParameter('title') post.body = Text.new(request.getParameter('body')) post.save doGet(request, response) end end 30 Wednesday, November 18, 2009
  • 31. Duby Supports Plugins Only form of metaprogramming (for now) require 'erb' Duby::AST.defmacro('def_edb') do |duby, fcall, p| name = fcall.args_node.get(0).name path = fcall.args_node.get(1).value erb = ERB::Compiler.new(nil) ... src = erb.compile(IO.read(path)) duby.eval(src, p, “(edb)”) end Wednesday, November 18, 2009
  • 32. Duby Can Use erb Templates <title>Posts</title> <body> <h1>All Posts:</h1> <% for post in @posts %> <h2><%= post.title %></h2> <p><%= post.body.getValue %></p> <% end %> <hr> <h1>New Post:</h1> <form method=post> Title: <input type=text name=title><br> Body: <textarea name=body></textarea><br> <input type=submit> </form> </body> Wednesday, November 18, 2009
  • 33. More to Come • Open classes • Mix ins • Blocks • More 33 Wednesday, November 18, 2009
  • 34. Resources • Ryan Brown, ribrdb@google.com John Woodell, woodie@google.com • 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/ 34 Wednesday, November 18, 2009