Recommended Viewing : A Rubyist in Clojure-land

A very nice presentation from the Barcelona Ruby Conference 2013 showing the effect of working in Clojure did for a Ruby developer.  In this wonderful talk David Chelimsky provides insights into how working in Clojure had an effect on his Ruby code. After working with Ruby for several years, he “joined a project team focused on Clojure, which provided an opportunity to look at programming through a new lens.” The talk shares  the challenges, lessons learned, and old lessons  reinforced.


In the talk, David mentioned Jay Fields expectations software. You can read more here :

jfields-expectations

github-expectations

jfields-blog

 

 

 

Food For Thought on Web Frameworks

If you are curious about the performance aspects of various web frameworks then it is worth looking at pretty impressive suite of benchmarks at techempower :

techempower

In the Round 7 benchmarks they benchmarked 84 web frameworks.  You can see the results here for JSON Serialization, Single Query, Multiple Queries, Fortunes, Data Updates  and Plaintext benchmarks.  Done both on an i7 server and Amazon Web Services.

round7

Recommended (from Rails Conf 2013) : Postgres, the Best Tool You’re Already Using

There is a nice presentation by Adam Sanderson from LiquidPlanner discussing some of the things he has learned and some new unique features in Postgres.  He covers tagging, hierarchy and modeling tree structures, custom data (sparse data) and full text search.  He provides SQL code showing how to go about defining arrays in SQL which include tags. He also shows this in ActiveRecord. He shows how to use the contains and overlaps operators with these tag arrays and how to go about querying Tags in ActiveRecord and compositing new features. He also covers Hstore in Postgres which provides a way to creating custom data. He also shows how to query Hstore in ActiveRecord. He then also shows how to use Postgres’ full text search. He provides a lot of detail into these topics.

Don’t stop here. Visit his blog it has even more information on these topics :

postgres05

 

Recommended Viewing : JRuby at Square

Xavier Shay from Square gave a talk about how they use JRuby.  You can watch the video :

He described the initial use of only Ruby on Rails and the eventual move to multiple programming languages and frameworks Ruby, Rails, Java, Rack and Sinatra. This lead them to move their Ruby stuff to move to JRuby. In the talk he covers Java integration, deployment, Rails and development and developer environments.  The Java integration was not used as much as initially they thought it would be.  JRuby allowed them to integrate with Neo4J libraries (graph database).  There is a gem call RubyNeo4J which wraps the Java classes into Rubyisms.

rbyneo4j

They ended up not using the gem but using the Java classes directly.  Worked really well.  He mentioned that the shared JVM experience is a win.  In talking about deployment he mentioned that they deployed Java on Jetty and they started deploying their Ruby code on Jetty as well – and it is paying dividends being able to share the same app engine.  He asked the question how to deploy Ruby web apps in a JRuby framework.  One way, is to package up the Ruby stuff into a war file and deploy it on a Java app server. Works – but they didn’t have a Java app server.  Also by packaging into a war-file – this is very unRuby like.  A second way, is to use Trinidad which allows you to use Rails or Rackup apps within an embedded Tomcat Container.They didn’t use this approach because they were using Jetty. 

rack

trinidad02The third approach they initially used was Kirk which wrapped around Jetty and wraps your Rack app.  They had issues with it within an embedded Tomcat Container.  They didn’t use this approach because they were using Jetty. The third approach they initially used was Kirk which wrapped around Jetty and wraps your Rack app. They had issues with it. A fourth option, Mizuno also did not fit their efforts very well.   So, they wrote a tool called Jetpack.

jetpack02

Jetpack provides a way to package your JRuby webapp for Jetty.  It creates a little self-contained JRuby/Jetty/vendored-gem world around your project.  Jetpack gives you a script to start and stop your service.

The philosophy behind Jetpack is to let “Jetty be Jetty” and “Ruby be Ruby”. It worked for them.  They deploy to n servers and coordinate with haproxy and use capistrano to orchestrate it.  HAProxy is an open source TCP/HTTP load balancer, commonly used to improve the performance of web sites and services by spreading requests across multiple servers.

capistrano

Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH. They have one process with real threads and girl_fridaythey can start/stop the service on the fly.  He also talked about Rails. They use girl_friday for doing asynchronous tasks. Rails thread-safe mode is not widely tested. He also touched on development. He mentioned that between jRuby and the JVM it does have a long start-up time. They develop on 1.9.3 and deploy on jRuby.  They are using jRuby for apps that do analytics, transaction viewing (anti-fraud), settlement and reconciliation, interact with graph database and some other apps.

Ruby, JRuby, the Stack and Performance

Lately, I’ve spent time looking Ruby and jRuby. I ran in to a presentation by Joe Kutner on JRuby and the JRuby stack.  Here are slides :

 and here is the video of Joe Kutner talking about a JRuby stack :
I
I found it interesting and led me to look at TorqueBox. This was the real take-away from this talk for me. I’ve also been looking at a number of posts comparing performance on Ruby and JRuby.  The first one that I found interesting related a comparison between CRuby and JRuby – where JRuby out-performed it substantially. In the post – the author explains why :

jruby_cruby

Another interesting comparison :

jrubyrails

 

 

Recommended : The Future of JRuby

One of the more interesting aspects of Sun’s stewardship of Java was the encouragement of alternative languages to use the JVM as a platform.  The result is there are a large number of development languages that leverage the JVM and sit on top of it – able to use the full range of class libraries.  One language, JRuby, is a Ruby-based implementation.  It has made considerable progress over the past few years.  With Oracle’s purchase of Sun – Oracle does not quite have the same interest and the original, talented JRuby team has left and gone their own ways.  However, JRuby continues.  This week in Barcelona, Spain, Charles Nutter from RedHat presented these slides on the ‘Future of JRuby’.

nutter1

The video below is almost the same presentation presented at RubyKaigi 2013.  Charles Nutter and Thomas Enebo presenting :

The Future of JRuby? – RubyKaigi 2013 from rubykaigi2 on Vimeo.

 

Interesting Read : Ruby 2.1 GC Addresses Large Deployment Issues

It is worth noting that Ruby which has played second fiddle to Java for a very long time is attempting to address a number of issues. With Ruby 2.1 garbage collection the hope is to address criticisms relative to large scale deployments.  Ruby has made a lot of progress in this respect in recent years.

infoqruby

A description of what one Ruby developer suggests is a way around some of the garbage collection is was presented by Chris Kelly at this week’s Ruby Conference in Barcelona.

ruby02