Xaprb

Stay curious!

Archive for November, 2008

A metric for MySQL load average

with 3 comments

If you were to measure MySQL’s “loadavg,” how would you do it?

The following metric (in pseudocode) is borrowed from Trevor Price at Aggregate Knowledge. It’s a way to calculate average query response time. What do you think of it?

$start = microtime();
$status1 = SHOW GLOBAL STATUS LIKE Questions;
for ( 1 .. 100 ) {
   $num_running += SELECT COUNT(*) FROM SHOW PROCESSLIST WHERE Command = Query;
}
$time = microtime() - $start;
return 0 unless $time;
$status2 = SHOW GLOBAL STATUS LIKE Questions;
$qps = ($status2 - $status1) / $time;
return 0 unless $qps;
return ($num_running / 100) / $qps;

If you do the dimensional analysis, if I’m not mistaken, it works. You get seconds. There are problems — for example, SHOW PROCESSLIST doesn’t show you what sampling theory predicts it will, for various reasons. What improvements can you suggest in order to solve the shortcomings? What other shortcomings do you see?

What other metrics can you suggest to get a dimensionless number that can give you an idea of the server’s load at a given time?

Written by Xaprb

November 26th, 2008 at 9:27 pm

Posted in SQL

Tagged with , ,

Google Code rocks my world

with one comment

Google Code just rocks. It is clean, sparse, elegant, and it has all the functionality I need. Its template-driven issue tracking system (totally flexible and totally easy to flex!), niceties like cross-references between issues and Subversion revisions, simple but completely adequate Wiki, and nice download system are the bomb. And the code reviews and ability to comment on revisions are super nice. Oh, and it’s really nice that the data is stored in a place I feel pretty sure is safe.

It has all the nice features I admired a lot about Trac, which is my other favorite collaboration tool for software development.

A while ago I moved Maatkit development to Google Code from Sourceforge. It was a move I’d been considering but dreading. A friend pushed me over the edge by promising to migrate the Subversion repo for me. In all it was really painless, and certainly a move that has enabled Maatkit’s development to proceed much more quickly and smoothly than it would have at Sourceforge. Not to pick on Sourceforge, but their interface is seemingly designed to prevent you from getting anything done — it is really hard to use in about every possible way, and makes simple tasks take hours (making a new release, anyone?). And Sourceforge doesn’t even back up your data! What’s the point of project hosting if you’re supposed to back up your own revision control, website, and database?

Thank you Google!

Written by Xaprb

November 23rd, 2008 at 10:47 pm

Posted in Coding, Maatkit, Tools

Tagged with , ,

How much network traffic does your MySQL server receive?

with 12 comments

This is a quick informal poll. I’d like to know how much network traffic your server receives (not sends), in bytes per second. Give both avg and max if you have them. I’m especially interested in hearing about big, heavily loaded systems.

I’ll start things off: just by looking at a couple of customer systems, I see one customer’s server is at 56k and 79k per second. Another slightly larger one is pulling 76k average and 200k max. A third who pushes the systems really hard is doing 1020k/second average and 1408k/sec max.

What about you? Get your friends at big enterprises to say how much traffic they get, too. Let’s get a broad look at how much traffic comes into big workhorse MySQL servers.

Written by Xaprb

November 22nd, 2008 at 5:22 pm

Posted in SQL

Tagged with ,