FiveRuns has been working with the JRuby team to make sure that our Rails instrumentation layer works seamlessly with JRuby on Rails. We’re excited to announce that our customers can now monitor JRuby on Rails applications with the latest JRuby 1.0.2 release just like they could with the standard Ruby interpreter.
This post will show you how to monitor a JRuby on Rails application with FiveRuns. We’ll use the Radiant content management system as our example.
Please make sure you have the latest JRuby 1.0.2 release installed and configured.
Here are the versions of Rails and Radiant we are using:
demo:~$ jruby -S gem list | egrep "radiant|rails"
radiant (0.6.4)
rails (1.2.5)
Let’s create a new Radiant site:
demo:~$ jruby -S radiant --database=mysql newsite
create
...
For this example we will use a MySQL 5.0.45 database server installed locally. Initially, we will use the MySQL ActiveRecord adapter written in Ruby that comes with Rails. In a later blog post we’ll show how to configure the JDBC adapter.
Following this example, further standard Radiant configuration steps include the creation of a database instance and the initial preparation of all necessary database structures:
demo:~/newsite$ mysql -u root -e "create database newsite_production"
demo:~/newsite$ rake production db:bootstrap
...
Now we come to the FiveRuns specific configuration steps. If you haven’t installed the FiveRuns client on the server hosting the Radiant application please do so now.
The client collects the metric data locally and sends it to the FiveRuns service. Once installed it will discover your local Rails applications including this Radiant site.
After a fresh client installation you will find the Radiant application listed in the Subsystem section at “Settings > Active Systems”. Please activate monitoring of this application by enabling both check boxes. Only if the Rails application is enabled will the service collect metrics.
If you already have the FiveRuns client installed please trigger a local rescan by restarting the client. On a Linux system you can do this with the following command:
demo:~/newsite$ sudo /etc/init.d/fiveruns_client restart
In order for the FiveRuns client to collect the detailed application metrics you will have to download the Rails instrumentation plugin into the vendor/plugins directory. The latest plugin version is available via the FiveRuns subversion repository.
To download it, start by getting your subversion login information from the Subsystems pane in the FiveRuns web console. It provides account-specific details and a link to further documentation. For this example we use the following steps:
demo::~/newsite$ svn export --username demo \
http://svn.fiveruns.com/svn/public/fiveruns/tags/1.0.0 \
vendor/plugins/fiveruns
Authentication realm: <http://svn.fiveruns.com> FiveRuns Subscribers
Password for 'demo':
...
Now you can start this Radiant application like any other JRuby on Rails application. You can access the application at port 3000. The Radiant admin interface is available under ”/admin”.
demo:~/newsite$ jruby script/server -e production
To verify that the Rails instrumentation is working please take a look at the log directory. You should see at least one file that begins with “rails_monitor.json”. This is the location where the FiveRuns’ Rails monitoring plugins writes its instrumentation metrics. These are then picked up by the FiveRuns client and sent to the host service. This is what we see on our demo system:
demo:~/newsite$ ls log
production.log rails_monitor.json.4699264
After five minutes the web interface will update the Rails metrics in the web console. They can be viewed either under “Browse > Systems” or “Browse > Applications”. The latter location, called Application Browser, provides a detailed view into the Rails application while running in production. Here is a screenshot:
The left pane breaks an application down into controllers and their associated actions. The right hand side details individual action invocations by average model, view and controller execution times.
Please make sure that traffic is hitting the application. Otherwise, the instrumentation layer will not send updates. Ideally, the traffic should be actual user traffic so real application bottlenecks can be identified.
We designed the instrumentation layer to minimize any overhead or impact on the production application. It is resourceful in how it collects, aggregates and send metrics back to the FiveRuns service.
In this blog entry we highlighted a simple JRuby on Rails configuration. In a follow up post we will explore a more advanced setup that includes Glassfish and JDBC. Such a configuration will mimic more closely a typical JRuby on Rails production application. However, the basics as outlined above will stay the same.















Continued Discussion
No comments have been added yet.