Brock Palen the founder of ShepTech LLC, has worked in High Performance Computing (HPC) starting in 2004. In 2002 he founded MLDS-Networks.com a Joomla! and Linux consulting and hosting Provider. In 2009 he started along with Jeff Squyres RCE-cast.com a podcast focusing on HPC topics.

Friday, October 31, 2014

Lustre Stats with Graphite and Logstash

A while back Matthew Britt who handles most of our HPC Scheduler and Resource Manager services got fed up with the problem of debugging the distributed nature of jobs. We had logs on 1000+ nodes, server, scheduler, and accounting manager. To solve this he build a solution around the ELK stack, Elasticsearch, Logstash, and Kibana. His solution was one of the most useful user support and job debugging tools ever. You can see Matt's talk form MoabCon on YouTube.

Once Matt showed me how easy this is, I instantly got an idea, Lustre, it's another distributed problem. In this case I didn't care about logs I cared about time series data, and I had two goals to solve.

What is our filesystem performance over time, in both bandwidth and open/close opps.

Find the users who open 999999 files/s in a single code.

To handle time series data rather than Elasticsearch I used Graphite a tool that has been around awhile. Think of it as RRD, but with a data collector for creating databases on the fly over the network, and with great performance.

All the config files used at the time of writing this are available on Github.

First some pictures:

So how did I easily get these data? Enter Logstash and the exec {} input. Because lustre stores all its summary stats in directories like /proc/fs/lustre/[mdt|obdfilter]/stats and /proc/fs/lustre/[mdt|obdfilter]//exports//stats I had to make my own handler. Why couldn't I just cat the stats files? Logstash being designed for log files, sees each line as an event and parses them each on their own. In our case I want the entire file. The solution to this was to make a simple python script that turns the stats into json objects.

Logstash if told that the input data is json, will now treat this as an event. In general the logstash-lustre.conf and logstash-lustre-mds.conf configs parse each event, including the path to the stats and grabs each counter and builds a metric form it.

One wants to be smart about your groupings. Lucky for us the Lustre devs did things in a very logical way, and it almost falls in our laps. You will use these groups/wildcards with graphite to quickly make lots of plots for the same metric over all OST's, MDT's, or clients, etc.

I don't calculate any rates in logstash. I chose to store the raw counter value from the stats files. Graphite has built in lots of nice functions that let you calculate your rates like nonNegativeDerivative() which deals with counters that roll over such as reboot. So keep your data quite raw.

Be careful with the number of metrics and your Graphite storage schema. We keep our per OST/MDT data for a year (10s:7d,10m:30d,60m:180d,6h:1y) and per client stats for 30 days (2m:30d). In our case we have over 1000 clients, 30 OSTs 1 MDT and we store 16 metrics/MDT, 16 metrics/MDT/client, 18 metrics/OST, 4 metrics/OST/client. In call we store 53,300 metrics just for lustre. This is about 14GB of data right now, and because of the way Graphite works will not grow unless we add more metrics, or add more clients.

The more likely problem is you send metrics to fast for graphite, and the number of IO's your graphite server disk can provide won't be up to task. In our case we update OST/MDT summary stats every 10 seconds, and client OST/MDT stats every 2 minutes. This is being handled with single 7,200 RPM SATA drive with some tweaking.