jruby · 2007. 11. 8. · timeline (extremely detailed, thank you) correctness performance compiler...

34
JRuby on and off Rails by Mathieu Martin

Upload: others

Post on 19-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

JRubyon and off Rails

by Mathieu Martin

Page 2: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Ruby interpreters

MRI

YARV

JRuby

Rubinius

IronRuby

XRubyCardinal

Ruby.Net

by Mathieu Martin

Page 3: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

What JRuby is

An interpreter

A compiler

by Mathieu Martin

Page 4: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Timeline(Extremely detailed, thank you)

Correctness

PerformanceCompiler

New regex engine

1.0

1.1

1.0.1

1.0.2

(June)

(August)

(Soon, beta out)

(Last week-end)

by Mathieu Martin

Page 5: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Why do we care?

by Mathieu Martin

Page 6: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Why do we care?

Performance-critical code is

Java

not C

by Mathieu Martin

Page 7: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Why do we care?

Use Java libraries from Ruby code

CryptoCredit card processing

Source code parsing Legacy Java code

RFID

by Mathieu Martin

Page 8: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Why do we care?

Using Rails in Java shops

=> Just deploy your WAR file

by Mathieu Martin

Page 9: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Why do we care?

Real threads

Thread pools(A temporary advantage)

by Mathieu Martin

Page 10: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

But C extensions?

Once thought impossible. Now:

Declaration

Use

Thanks to the JNA Java library

by Mathieu Martin

Page 11: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Source at the end

by Mathieu Martin

Page 12: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

And performance?

As of JRuby 1.1

With Java 1.6...

by Mathieu Martin

Page 13: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

And performance?

JRuby 1.1 might be the fastest way

to run Ruby 1.8 and Rails

by Mathieu Martin

Page 14: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

About performance

Performance improvements come from:

•JRuby team improving JRuby (free)

•Sun improving the JVM (free)

•Tweaking JVM settings and profiling (risk-free)

•You fixing your ugly code (work!)

by Mathieu Martin

Page 15: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Let’s back this up

Based on Nick Sieger’s blog post from Oct 24th

Page 16: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Let’s back this up

Based on Nick Sieger’s blog post from Oct 24th

Page 17: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

So?

All that on JRuby 1.0.1

by Mathieu Martin

Page 18: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Use cases

by Mathieu Martin

Page 19: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Use case: scripting

Not really its strength:

x JVM too long to start

x console clunky when Ruby and JRuby live side by side

mm:~ mat$ jruby -S gem list

by Mathieu Martin

Page 20: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Use case: client-side app

Might work:

✓App runs long enough

✓No frills install (+/-)

Java has a good market penetration

✓Swing’s getting pretty fast

Check out Profligacy by Zed Shaw

by Mathieu Martin

Page 21: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Use case: server-side app

That’s where it’s happening

✓ Server JVM optimizes app at runtime

✓ Lots of great servers• Glassfish, JBoss, Oracle, Tomcat, Jetty...

✓ Great monitoring tools

✓ Deployment of a WAR file

by Mathieu Martin

Page 22: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Demo time?

by Mathieu Martin

Page 23: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

What I’m about to use...

• mysql jdbc adapter• activerecord-jdbc gem• Glassfish and Jetty web servers• Goldspike: Rails app => WAR file

Other options

• Warbler: also Rails app => WAR

• Glassfish gem is also available

by Mathieu Martin

Page 24: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Demo time!

by Mathieu Martin

Page 25: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

What’s the catch?

by Mathieu Martin

Page 26: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Downsides to JRuby

• Moving at breakneck speed

✓ Getting very good very fast

x Documentation is lagging a bit and scattered over different blogs

by Mathieu Martin

Page 27: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Downsides to JRuby

• Some bugs remaining

• Still some differences vs MRI

• Not all plugins will work out of the box

by Mathieu Martin

Page 28: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

We can help!

• Contribute to the wiki

• Blog about your findings, then put it on the wiki

• Contribute code fixes

• To JRuby

• To Goldspike

• To Glassfish, Jetty

by Mathieu Martin

Page 29: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

To know more• Charles Oliver Nutter

=> headius.blogspot.com

• Ola Bini=> ola-bini.blogspot.com

• Nick Sieger => blog.nicksieger.com

• Thomas Enebo => bloglines.com/blog/ThomasEEnebo

by Mathieu Martin

Page 30: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

To know more

• The sites=>jruby.org -> jruby.codehaus.org=>headius.com/jrubywiki

• Mailing lists

=>user =>dev=>scm

by Mathieu Martin

Page 31: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

To know more

• Other sources=> ADS blog: rorblog.techcfl.com/category/jruby/

(2 great step by step JRuby tutorials)=> jrubyinside.com=> glassfish.dev.java.net=> Glassfish gem:

=> weblogs.java.net/blog/arungupta/archive/2007/09/announcing_glas.html

=> Profligacy (Swing): ihate.rubyforge.org/profligacy

by Mathieu Martin

Page 33: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Shameless plug

I’ll put this presentation on my blog

=> webmat.wordpress.com

by Mathieu Martin

Note: the performance charts are available athttp://spreadsheets.google.com/pub?key=ps7Wjwj1ZaG0mmOXH5bRtTA

Page 34: JRuby · 2007. 11. 8. · Timeline (Extremely detailed, thank you) Correctness Performance Compiler New regex engine 1.0 1.1 1.0.1 1.0.2 (June) (August) (Soon, beta out) (Last week-end)

Questions?Comments?

Insults? => /dev/null

by Mathieu Martin