Scaling Rails on App Engine with JRuby and Duby

Similar documents
JRuby and Ioke. On Google AppEngine. Ola Bini

Google App Engine: Java Technology In The Cloud

Developing Solutions for Google Cloud Platform (CPD200) Course Agenda

Developing with Google App Engine

Google GCP-Solution Architects Exam

Oracle Mix. A Case Study. Ola Bini JRuby Core Developer ThoughtWorks Studios.

Cloud Computing Platform as a Service

App Engine MapReduce. Mike Aizatsky 11 May Hashtags: #io2011 #AppEngine Feedback:

Getting the most out of Spring and App Engine!!

App Engine: Datastore Introduction

Scaling App Engine Applications. Justin Haugh, Guido van Rossum May 10, 2011

nacelle Documentation

Configuring and Using Osmosis Platform

Building Scalable Web Apps with Python and Google Cloud Platform. Dan Sanderson, April 2015

Toby Crawley. Creative Commons BY-SA 3.0. Raleigh.rb April 2011


AWS Lambda: Event-driven Code in the Cloud


Code Generation. The Safety Scissors Of Metaprogramming

Seminar report Google App Engine Submitted in partial fulfillment of the requirement for the award of degree Of CSE

Servlets by Example. Joe Howse 7 June 2011

Rekall. Rekall Agent - OSDFCon Forensics. We will remember it for you wholesale! Michael Cohen

RACK / SSO. and a little bit about the Bundler. Tuesday, December 1, 2009 hello hello

Overview of the Ruby Language. By Ron Haley

DOI: /ijarcsse/V7I1/01103

What Is NetBeans? Free and open-source based > Open source since June, 2000 > Large community of users and developers

Rails on HBase. Zachary Pinter and Tony Hillerson RailsConf 2011

Mitchell Bosecke, Greg Burlet, David Dietrich, Peter Lorimer, Robin Miller

JRuby: Who What Now. Thomas Enebo JRuby Guy Sun Microsystems

OpenShift State of the Union brought to you by JBoss

Rails powered by GlassFish & jmaki

High performance reactive applications with Vert.x

VIVIT TQA Webinar: "DISCOVER THE POSSIBILITIES OF USING THE HP QUALITY CENTER API" May 12th 2010

Toby Crawley. Creative Commons BY-SA 3.0. Charlotte.rb May 2011

THE VOEIS HIS GATEWAY. A REST Interface for HydroServer using ODM 1.1

Real Application Security Administration

Module 6 Node.js and Socket.IO

JRuby. A Ruby VM in Java jruby.sourceforge.net Charles Oliver Nutter, presenting

The Script Bowl Featuring Groovy, JRuby, Jython and Scala. Raghavan Rags N. Srinivas CTO, Technology Evangelism

Keeping Rails Applications on Track with Brakeman. Justin RailsConf 2012

Using Scala for building DSL s

This book is dedicated to Sara, Inara, and the newest little one, who make it all worthwhile.

Angular 2 and Hexo. Static Meets Dynamic For the Best of Both Worlds! Copyright 2016 Code Career Academy

Qiufeng Zhu Advanced User Interface Spring 2017

Mission Possible - Near zero overhead profiling. Klara Ward Principal Software Developer Java Mission Control team, Oracle February 6, 2018

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul

From EC2 to Alex Tolley

Next Generation Collaborative Reversing with Ida Pro and CollabREate. Chris Eagle and Tim Vidas Naval Postgraduate School

PaaS Cloud mit Java. Eberhard Wolff, Principal Technologist, SpringSource A division of VMware VMware Inc. All rights reserved

WEEBLY CLOUD FOR BC PARTNERS, AN INTRO

EMPLOYEE LOCATION TRACKING SERVICE

E21Commerce Product Roadmap

SitelokTM. Stripe Plugin V1.5

A10 HARMONY CONTROLLER

Defending the Gibson in 2015

FUJITSU Cloud Service K5 CF Service Functional Overview

Cloud + Big Data Putting it all Together

SYSTEM REQUIREMENTS M.APP ENTERPRISE

Large-Scale Web Applications

MRI Internals. Koichi Sasada.

CSC 405 Computer Security. Web Security

Heckaton. SQL Server's Memory Optimized OLTP Engine

Rails Four For you and for me!

Build Native-like Experiences in HTML5

BaasBox. Open Source Backend as a Service. Otto Hylli

Comet for Highly- Scalable Applications

Configuring and Operating a Hybrid Cloud with Microsoft Azure Stack

VMware vrealize Operations Management Pack for vcloud Director 4.5 Guide

St. Louis JUG Trivia Night. January 2010

Optimizing Your App Engine App

Present and Future of the RhoMobile platform. Migrating legacy applications, Node.js on mobile devices right now and more

VMware vrealize Operations Management Pack for vcloud Director 5.0 Guide

MSI Primer. Aron Rubin

Serverless Architecture Hochskalierbare Anwendungen ohne Server. Sascha Möllering, Solutions Architect

Tuesday, April 26, 2011

Another difference is that the kernel includes only the suspend to memory mechanism, and not the suspend to hard disk, which is used on PCs.

Monkeybars Tools-enabled Swing development with JRuby

Microservices without the Servers: AWS Lambda in Action

AZURE CONTAINER INSTANCES

code://rubinius/technical

Intro to Couchbase Server for ColdFusion - Clustered NoSQL and Caching at its Finest

Manual Visual Studio 2010 Web Developer Tools 2012 Professional

what is cloud computing?

Cloud Computing. Chapter 3 Platform as a Service (PaaS)

Groovy For Java Programmers

Aquarium: AOP for Ruby

Are you using Ruby on Rails?

comparing groovy & jruby *

RubyConf China. Why Ruby? Yukihiro "Matz" Matsumoto. Copyright (c) 2008 Yukihiro "Matz" Matsumoto, No rights reserved

DataMan. version 6.5.4

Rails: MVC in action

System Requirements for ConSol CM Version Architectural Overview

Building Scalable Web Apps with Google App Engine. Brett Slatkin June 14, 2008

Client-side Debugging. Gary Bettencourt

nucleon Documentation

Datacenter Simulation Methodologies Web Search. Tamara Silbergleit Lehman, Qiuyun Wang, Seyed Majid Zahedi and Benjamin C. Lee

Dynamic Programming. See p of the text

Data Centers and Cloud Computing

Data Centers and Cloud Computing. Slides courtesy of Tim Wood

Cloud Computing. Chapter 3 Platform as a Service (PaaS)

Transcription:

Scaling Rails on App Engine with JRuby and Duby Run your apps on Google Servers, with access to first-class Java APIs John Woodell David Masover Ryan Brown June 9, 2010 2

Google App Engine 3

Key Features No need to install or maintain your own stack Use Google scalable services via standard APIs Built-in application management console Pay-as-you-go, with free quota to get started 4

Key Limitations No native code No threads or sockets No writing to the filesystem No more than 30 seconds per request 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 50000/day to admins $0.0001/email 6

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 7

JRuby on App Engine 8

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 9

App Engine JRuby Milestones 2009-04-08 @olabini publishes blog post on YARBL 2009-04-09 @nicksieger publishes warbler demo 2009-05-06 RailsConf (sinatra & merb) 2009-11-02 0.0.5 bundler, precompilation & Duby preview 2009-11-20 RubyConf (Rails 3.0.pre & Duby App) 2009-12-27 @urekat publishes Rails 2.3.5 patches 2010-01-11 @codingforrent published rails/dm gem 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-27 0.0.10 ActionMailer, ImageService, jruby-openssl 2010-04-08 @azazeal blog post on taxster.gr (OpenID) 2010-06-09 0.0.14 JRuby 1.5.1 & app.yaml preview 10

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 + 11

Install it Now sudo gem install google-appengine Everything you need installs as gems 12

App Engine Gems Development Gems appengine-sdk appengine-tools... dev_appserver.rb & appcfg.rb Runtime Gems appengine-rack.... jruby-jars & jruby-rack appengine-apis Related Gems dm-appengine rails_appengine rails_dm_datastore rails_tiny_ds 13

App Engine JRuby APIs AppEngine::Users AppEngine::Datastore AppEngine::Memcache AppEngine::Mail AppEngine::URLFetch AppEngine::Images AppEngine::Logger AppEngine::XMPP AppEngine::Labs::TaskQueue AppEngine::OAuth AppEngine::Blobstore 14

dm-appengine David Masover 15

DataMapper 16

ActiveRecord contains SQL strings 17

Use AppEngineResource 18

Relationships 19

Simple 20

Transactions Idempotence "Why can't I click submit more than once?" Transactions on datastore Optimistic locking Atomic Only across entity-groups 21

Simple case is Simple 22

Entity-groups 23

Global transactions Don't do them! Really, you don't need them! They wouldn't scale anyway! but sometimes... 24

Inventory tracking 25

Shopping Cart 26

Duby Ryan Brown

Duby s not Ruby Statically typed No Duby runtime Uses Java s type system 28

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

// 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)))); } }

A Simple Duby App import javax.servlet.http.httpservlet import com.google.appengine.ext.duby.db.model class Post < Model 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 31

A Simple Duby App import javax.servlet.http.httpservlet import com.google.appengine.ext.duby.db.model class Post < Model 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 Types inferred from parent class 32

A Simple Duby App import javax.servlet.http.httpservlet import com.google.appengine.ext.duby.db.model class Post < Model 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 33

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

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>

More to Come Open classes Mix ins Macros More 36

Resources Blog http://jruby-appengine.blogspot.com/ Code Site http://code.google.com/p/appengine-jruby/ Google Group http://groups.google.com/group/appengine-jruby Resources http://rails2010-dm.appspot.com/ http://github.com/masover/rails2010 http://github.com/masover/cart http://cart-demo.appspot.com/ 37