InfoQ

News

Monitoring Ruby

Posted by Werner Schuster on Dec 14, 2007 08:00 PM

Community
Ruby
Topics
Performance & Scalability,
Debugging
Tags
JRuby,
DTrace
A recent interview with Philippe Hanrigou goes into the topic of monitoring and troubleshooting Ruby. Figuring out why a Ruby process fails, has a memory leak or some performance issue, is important to keep applications running. Figuring this out fast is even more important, particularly if a production server has developed a problem and this is now impeding business.

Next to the basic Unix tools such as gdb or strace (a tool that shows the syscalls a program made by a program), DTrace is mentioned as a potentially useful tool. DTrace, tool that allows low-overhead profiling of and tracing of programs, was originally developed for Solaris. It has since been ported to and shipped with other systems, most recently to Mac OS X Leopard which includes DTrace support for the Ruby interpreter.

Philippe suggests a solution for Linux, a system where DTrace isn't supported yet:
For the most hardcore members of the community it might be worth investing some time and energy to help push SystemTap forward. Unfortunately, while many Ruby applications are deployed on Linux, DTrace is not available on this platform. Due to licensing and unresolved issues there is actually very little chance that DTrace will ever be ported to Linux in the foreseeable future. The closest alternative to DTrace on Linux is SystemTap, which shares the same objectives but is not quite as mature yet. In particular, SystemTap still does not seem to provide support for traces in user space programs.

Running Ruby apps on JRuby gives developers access to the host of profiling and monitoring tools available for the Java platform. Ola Bini mentioned this as an advantage some time ago in a blog post titled "Can your Ruby do this", where he uses JConsole (shipped with JDKs) to look inside a JRuby app. JConsole can attach to a running JVM and - using JMX - access information such as Garbage Collection information (generation sizes, collection runs, etc.), thread information and all other information exposed through MBeans. Philippe also mentions another tool to deal with memory leaks:
Finally, when it comes to memory leaks, the usual Java tools also come to the rescue. A useful technique is to get a heap dump with jmap and then inspect it with jhat or any standard Java heap dump analyzer. Give the SAP Memory Analyzer a try—Ola had a great experience with it.
InfoQ recently discussed some free memory analyzer tools from SAP or IBM.

Philippe finishes by expressing his interest in Rubinius:
Finally building troubleshooting tools for Ruby would be a lot easier if any Ruby developer could easily access the Ruby interpreter to instrument and extend it. This is why I consider the success of a project such as Rubinius to be the best way for take the platform to a whole new level in the long term. Any time and effort that the community invest in Rubinius will be well spent.

No comments

Reply

Exclusive Content

Using Ruby Fibers for Async I/O: NeverBlock and Revactor

Ruby 1.9's Fibers and non-blocking I/O are getting more attention - we talked to Mohammad A. Ali of the NeverBlock project and Tony Arcieri of the Revactor project.

Agile and Beyond - The Power of Aspirational Teams

Tim Mackinnon talks about the aspirations behind the Agile principles and practices, the desire to become efficient, to write quality code which does not end up being thrown away.

Concurrency: Past and Present

Brian Goetz discusses the difficulties of creating multithreaded programs correctly, incorrect synchronization, race conditions, deadlock, STM, concurrency, alternatives to threads, Erlang, Scala.

ActionScript 3 for Java Programmers

Often the hardest part of changing technologies is language syntax differences. This new article provides Java developers with a transition guide to Actionscript which forms the foundation of Flex.

Neal Ford On Programming Languages and Platforms

Neal Ford talks about having multiple languages running on one of the two major platforms: Java and .NET. He also presents the advantages offered by Ruby compared to static languages like Java or C#.

Future Directions for Agile

David Anderson talks about the history of Agile, the current status of it and his vision for the future. The role of Agile consists in finding ways to implement its principles.

Nick Sieger on JRuby

Nick Sieger talks about the future of JRuby, Java Integration, and his work on JEE deployment tools for Ruby on Rails like Warbler.

Rustan Leino and Mike Barnett on Spec#

Rustan Leino and Mike Barnett of Microsoft Research discuss the technology in Spec# and its futures.