Profiling Ruby Programs

The Ruby Interpreter includes a profiling tool which is invoked with the -rprofile option on the command line. Below is an example running the Ruby Fibonacci program (fib.rb) included in Ruby documentation samples. The list of functions is sorted from most to least time spent exclusively in the function (self seconds). The first column provides the percentage of self seconds for each function. The cumulative seconds indicates the amount of time spent in that function and the functions it calls directly and indirectly. The calls, self ms/call, and total ms/call provide some indication whether the function is called frequently and the average cost of each call to a function.

Continue reading “Profiling Ruby Programs”


Using Python’s Virtualenv with RHSCL

I’ve been getting more and more questions about using Python’s virtualenv with python27 and python33 collections from RHSCL, so I decided to write a very short tutorial about this topic. The “tl;dr” version is: everything works perfectly fine as long as you remember to enable the collection first.

Update 2018: An updated article has been published, See How to install Python 3, pip, venv, virtualenv, and pipenv on Red Hat Enterprise Linux.

What is Virtualenv

Citing Virtualenv official documentation: “virtualenv is a tool to create isolated Python environments”. In short, Virtualenv allows you to setup multiple runtime environments with different sets of Python extension packages on a single machine. Unlike Ruby’s RVM (Ruby Virtual Machine), it can’t install the language interpreter itself – just the extension libraries.

Continue reading “Using Python’s Virtualenv with RHSCL”


Extending Red Hat Enterprise Virtualization with Vdsm hooks

oVirt is an open source management system for KVM-powered virtual machines. Red Hat Enterprise Virtualization (RHEV) derives from oVirt in the same fashion that Red Hat Enterprise Linux is derived from Fedora. oVirt’s (and RHEV’s) central management component, called oVirt-Engine, is written in Java and runs on top of JBoss. Engine controls dozens of nodes that may run many dozens of VMs each.

Besides sounding like an improper innuendo when pronounced in by Spanish-speaking people, “Vdsm” is Engine’s per-node agent. It’s written in python and is responsible to prepare storage and network connectivity for the virtual machine, as well as to track the life cycle of the VM.

Continue reading “Extending Red Hat Enterprise Virtualization with Vdsm hooks”


DevNation developer event registration now open

The DevNation agenda is now live ( and registration is open!  With over 250 submissions, 43 selected sessions, 12 birds-of-a-feather panels, full day training courses, a hackathon, and an evening event, we hope to make DevNation an amazing event targeting and featuring the Developer and DevOps communities. The conference has participation from Twitter, Netflix, Facebook, Hortonworks, ThoughtWorks, Docker, the Eclipse Foundation, the jQuery Foundation, the Java Community Process, Docker, countless others, and of course, Red Hat!

Migrate to Python 3 with RHSCL

Although most of Python enterprise applications still use Python 2 (e.g. Python 2.4 on RHEL 5 or Python 2.6 on RHEL 6), Python 3 has already become a mature variant and is worth considering. Why, you ask?

  • Python 3 series is being actively developed by upstream, while Python 2 now only gets security fixes and bug fixes. Python 2.7 is the latest minor release of the 2.X series and there will be no Python 2.8. This is very important since Python 3 will be getting new modules (check the new asyncio module coming in 3.4, for example) and optimizations, while Python 2 will just stay where it is and will be abandoned sooner or later.
  • Although the initial Python 3.0 release had worse performance than Python 2, upstream has kept improving it and Python 3.3 is comparable to Python 2.7 performance-wise.
  • Python 3 is already adopted by major libraries and frameworks: Django since version 1.5, SciPy since 0.9.0, mod_wsgi since 3.0, …

Migrating projects to Python 3 takes some time, but with RHSCL it’s as easy as it can get. Read on to get information about changes in the language itself and about the suggested approach to using RHSCL as a migration helper.

Continue reading “Migrate to Python 3 with RHSCL”


Profiling Python Programs

For RHEL6 and newer distributions tools are available to profile Python code and to generate dynamic call graphs of a program’s execution. Flat profiles can be obtained with the cProfile module and dynamic callgraphs can be obtained with pycallgraph.

The cProfile Python module records information about each of the python methods run. For older versions of Python that do not include the cProfile module you can use the higher overhead profile module. Profiling is fairly simple with the cProfile module.

Continue reading “Profiling Python Programs”