JRuby,	
  a	
  Pi	
  and	
  a	
  Database	
  
PHILIPP	
  FEHRE	
  
Twi3er:	
  @ischi	
  	
  
Github:	
  @sideshowcoder	
  
Developer	
  Advocate,	
  Couchbase	
  
It’s	
  just	
  ruby!	
  
NaEve	
  threads	
  
99%	
  vs	
  125%	
  |	
  17	
  sec	
  vs	
  11	
  sec	
  
Yes	
  jruby	
  startup	
  Eme	
  is	
  slow	
  …	
  
And	
  more	
  
GC,	
  Java	
  Debugging	
  tools,	
  Java	
  
Servers…	
  
-­‐-­‐dev	
  tradeoff	
  performance	
  for	
  startup	
  @me	
  
Lets	
  see	
  it	
  in	
  pracEce	
  
Couchbase	
  Lite	
  
Couchbase	
  Mobil	
  
Couchbase	
  Lite	
  +	
  Sync	
  Gateway	
  
Couchbase	
  Mobil	
  
Couchbase	
  Lite	
  +	
  Sync	
  Gateway	
  
Channels	
  
Tags…	
  
AuthenEcaEon	
  
Facebook,	
  Mozilla	
  Persona,	
  User	
  +	
  
Password,	
  OAuth	
  	
  
Sync	
  FuncEon	
  
Channels	
  
AuthenEcaEon	
  
Why	
  JRuby?	
  
NEED	
  TO	
  CALL	
  TO	
  JAVA	
  
Java	
  has	
  loads	
  of	
  libraries	
  (like	
  Couchbase	
  Lite)	
  which	
  ar...
Pi	
  on	
  Couch	
  
Using	
  JRuby	
  
Loading	
  JARs	
  
Loading	
  naEve	
  JARs	
  
Just	
  for	
  reference…	
  ;)	
  
Calling	
  Java	
  Methods	
  
Calling	
  Java	
  Methods	
  
CreaEng	
  Items	
  in	
  the	
  database	
  
Some	
  Java	
  Idioms	
  
in	
  Ruby	
  
Naming	
  
Se3er	
  and	
  Ge3er	
  
Se3er	
  and	
  Ge3er	
  
Se3er	
  and	
  Ge3er	
  
Method	
  names	
  
Anonymous	
  Classes	
  
Java	
  
Ruby	
  way	
  number	
  1	
  
Ruby	
  way	
  number	
  2	
  
GENERICS	
  
They	
  don’t	
  auto	
  convert	
  types	
  
Se[ng	
  up	
  sync	
  
Querying	
  Couchbase	
  Lite	
  
Querying	
  Couchbase	
  Lite	
  
Querying	
  Couchbase	
  Lite	
  
Querying	
  Couchbase	
  Lite	
  
LOOKING	
  UNDER	
  THE	
  HOOD	
  
How	
  JRuby	
  is	
  implemented	
  
HACKING	
  JRUBY	
  
CreaEng	
  a	
  method	
  from	
  Scratch	
  
git	
  clone	
  h3ps://github.com/jruby/jruby	
  
	
  
mvn	
  -­‐pBoostrap	
  
Running	
  the	
  tests	
  
	
  
1.to_froscon	
  #	
  =>	
  “froscon”	
  
Adding	
  to	
  RubyFixnum	
  
Couchbase	
  Server	
  3.0	
  Beta	
  Bug	
  Bash	
  	
  
Download,	
  Find,	
  Report,	
  Win	
  
•  DOWNLOAD	
  Couchbas...
QuesEons?	
  
Links	
  
•  h3p://github.com/couchbaselabs/pi-­‐on-­‐couch	
  
•  h3p://www.couchbase.com/communiEes	
  
•  h3p://jruby.o...
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Jruby a Pi and a database
Upcoming SlideShare
Loading in …5
×

Jruby a Pi and a database

304 views

Published on

JRuby is a great way to use native Java libraries and get around the project overhead of Java, but how do you actually use Java from JRuby? This talk explores building a JRuby application, backed by the portable Java version of Couchbase Mobile.

While JRuby is build to interface with Java, when calling out to JVM land there are all those little hurdles to overcome. Handling Strings correctly, using native Collection types, and interfacing with libraries which expect those native types instead of the ones provided by JRuby, and last but not least Implementing native interfaces to pass around.

Oh and by the way all of this runs on a little Raspberry Pi!

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
304
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Jruby a Pi and a database

  1. 1. JRuby,  a  Pi  and  a  Database  
  2. 2. PHILIPP  FEHRE   Twi3er:  @ischi     Github:  @sideshowcoder   Developer  Advocate,  Couchbase  
  3. 3. It’s  just  ruby!  
  4. 4. NaEve  threads  
  5. 5. 99%  vs  125%  |  17  sec  vs  11  sec   Yes  jruby  startup  Eme  is  slow  …  
  6. 6. And  more   GC,  Java  Debugging  tools,  Java   Servers…  
  7. 7. -­‐-­‐dev  tradeoff  performance  for  startup  @me  
  8. 8. Lets  see  it  in  pracEce  
  9. 9. Couchbase  Lite  
  10. 10. Couchbase  Mobil   Couchbase  Lite  +  Sync  Gateway  
  11. 11. Couchbase  Mobil   Couchbase  Lite  +  Sync  Gateway  
  12. 12. Channels   Tags…  
  13. 13. AuthenEcaEon   Facebook,  Mozilla  Persona,  User  +   Password,  OAuth    
  14. 14. Sync  FuncEon  
  15. 15. Channels  
  16. 16. AuthenEcaEon  
  17. 17. Why  JRuby?  
  18. 18. NEED  TO  CALL  TO  JAVA   Java  has  loads  of  libraries  (like  Couchbase  Lite)  which  are  only  on  Java  
  19. 19. Pi  on  Couch  
  20. 20. Using  JRuby  
  21. 21. Loading  JARs  
  22. 22. Loading  naEve  JARs  
  23. 23. Just  for  reference…  ;)  
  24. 24. Calling  Java  Methods  
  25. 25. Calling  Java  Methods  
  26. 26. CreaEng  Items  in  the  database  
  27. 27. Some  Java  Idioms   in  Ruby  
  28. 28. Naming  
  29. 29. Se3er  and  Ge3er  
  30. 30. Se3er  and  Ge3er  
  31. 31. Se3er  and  Ge3er  
  32. 32. Method  names  
  33. 33. Anonymous  Classes  
  34. 34. Java  
  35. 35. Ruby  way  number  1  
  36. 36. Ruby  way  number  2  
  37. 37. GENERICS   They  don’t  auto  convert  types  
  38. 38. Se[ng  up  sync  
  39. 39. Querying  Couchbase  Lite  
  40. 40. Querying  Couchbase  Lite  
  41. 41. Querying  Couchbase  Lite  
  42. 42. Querying  Couchbase  Lite  
  43. 43. LOOKING  UNDER  THE  HOOD   How  JRuby  is  implemented  
  44. 44. HACKING  JRUBY   CreaEng  a  method  from  Scratch  
  45. 45. git  clone  h3ps://github.com/jruby/jruby     mvn  -­‐pBoostrap  
  46. 46. Running  the  tests    
  47. 47. 1.to_froscon  #  =>  “froscon”  
  48. 48. Adding  to  RubyFixnum  
  49. 49. Couchbase  Server  3.0  Beta  Bug  Bash     Download,  Find,  Report,  Win   •  DOWNLOAD  Couchbase  Server  3.0  Beta   •  Run  some  workload,  play  with  it,  FIND  a  bug   •  If  you  find  a  bug,  REPORT  it!     ­  All  bugs  count  –  anything  from  correctness,  to  performance,  to   usability,  to  docs   •  WIN  Prizes!!     h`p://www.couchbase.com/bugbash      Contest  ends  Aug  31st  2014  
  50. 50. QuesEons?  
  51. 51. Links   •  h3p://github.com/couchbaselabs/pi-­‐on-­‐couch   •  h3p://www.couchbase.com/communiEes   •  h3p://jruby.org  

×