This version of mysqlsla has been modified to work with huge (multi-gigabyte) slow logs by using BerkeleyDB instead of plain perl hashes. This version is about 2 times slower and we did not test it with anything but slow logs (but it should work, so submit [your issues] 4, I'll try to fix). Patches are welcome too.
[Replays] 5 work too in this patch. There a difference: it stores several files instead of a single one. If your relay file called "mylog.relay", mysqlsla-bdb will create several files "mylog.relay.*.tmp", where it will store BDB files and additional hashes. Please note: I have removed third limitation: total users (all log-wide unique "user@host IP") does not work with replays.
This package contains both old (unpatched) version of mysqlsla, and the patched one, called mysqlsla-bdb. All arguments are the same.
Here are some stats: 70 Gb slow log file took 7 hours to build a report. Memory usage is about 20-30 Mb.
mysqlsla parses, filters, analyzes and sorts MySQL slow, general, binary and microslow patched slow logs in order to create a customizable report of the queries and their meta-property values.
Since these reports are customizable, they can be used for human consumption or be fed into other scripts to further analyze the queries.
For example, to profile with mk-query-profiler (a script from Baron Schwartz's
Maatkit) every unique SELECT
statement using database foo from a slow log:
mysqlsla -lt slow slow.log -R print-unique -mf "db=foo" -sf "+SELECT" | \
mk-query-profiler -separate -database foo
In brief, mysqlsla is a liaison allowing other scripts easy access to queries from a MySQL log.
See included INSTALL file.
The following core Perl modules are used which should already be installed on your system:
Time::HiRes
File::Temp
Data::Dumper
DBI
Getopt::Long
Storable
BerkeleyDB
If available, Term::ReadKey
will also be used.
mysqlsla v2 uses an "internalized" version of [MySQL::Log::ParseFilter] 2. You do not need to install this module separately.
Here are benchmark results for a 328Mb size slow log (previous is the version [b54c30f] 6):
Version Memory Time
-----------------------
original 276.5Mb 1:14
previous 91.6Mb 2:30
current 20.4Mb 2:30
The difference between previous and current is in 95% calculations: in the latter one this is done in a small memory buffer, so the memory usage is minimal.
Copyright 2007-2008 Daniel Nichter
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The GNU General Public License is available at: http://www.gnu.org/copyleft/gpl.html