Xaprb

Stay curious!

Archive for March, 2011

How to gather statistics at regular intervals

with 4 comments

I gather a lot of statistics such as performance data. Sometimes I have multiple things going on a system and I want to be able to align and compare the resulting data from multiple processes later. That means they need to be aligned on time intervals. Here is a naive way to gather stats at intervals:

while sleep 1; do gather-some-stats; done

There are two problems: each iteration will take longer than a second, so there will be drift; and the iterations will not be aligned exactly on the clock ticks, so the data isn’t as easy to correlate with other samples. This becomes a bigger problem when there are many such jobs gathering data at longer intervals such as 15 seconds or 5 minutes, where the lack of correlation between samples can be frustrating.

Here is what I’ve been doing recently. Is there a better way?

INTERVAL=1
while true; do
   sleep=$(date +%s.%N | awk "{print $INTERVAL - (\$1 % $INTERVAL)}")
   sleep $sleep
   gather-some-stats
done

Written by Xaprb

March 18th, 2011 at 10:17 am

Posted in Coding,Sys Admin

See you at Collaborate 2011

without comments

I’ll be speaking at IOUG’s Collaborate conference in Florida the week of April 10-14. My session is called MySQL Performance Basics. For those who know MySQL, this won’t be exciting, but if you’re new to it, I hope it will be a good orientation to what you should focus on and ignore.

Sheeri Cabral posted a good round-up of the MySQL talks at Collaborate on the PalominoDB blog.

Written by Xaprb

March 11th, 2011 at 8:38 am

Posted in Conferences,Oracle,SQL

No Hotsos? Go to the MySQL Conference instead.

without comments

I wish I could be at the Hotsos Symposium. I would keep my mouth very tightly closed and my ears wide open, and try to learn from people who are completely out of my league about performance analysis topics I won’t grok for another decade (if I’m lucky). But I just can’t cram in that much travel.

If you’re like me, why don’t you go to the O’Reilly MySQL Conference instead? I’ll be trying my feeble best to bring some of the Oracle performance scientist’s mentality to this event, with presentations such as my Forecasting MySQL Performance and Scalability session. And a lot of smart people will be there from many database communities. Percona has a 20% discount, too — not a bad enticement.

Written by Xaprb

March 8th, 2011 at 2:38 pm