JMeter currently supports file-based listeners. This is a patch that configures a Listener to log to MySQL: JMeter_MysqlCollector.patch

The patch is thoroughly untested, most likely highly-buggy and not very efficient with resources, so take some time to go over and make changes where you see fit before using it (I am not a developer, just able to throw together a bit of code). Hope it helps though.

It was primarily designed to save HTTPSample responses to a database for reporting purposes.

Some areas that require attention:

  • Database connection - expensive to create and break down connection after each sample is received. This should be configured as a persistent connection
  • Schema - unoptimized (no keys) and a very lazy way of loading. A lot of "text" or unvalidated varchar lengths.
  • Checking of data - if sampler returns null data, it may causing NPE's. No escaping of contents. the responseData has been commented, as theres a lot of work to be done with HTML responses.
  • GUI / Driver initialization - Can add a driver drop down list to use more than just mysql connector J, but JDBC is all there is for now.
  • Resources - no resources for mysql_collector means unfriendly names in context menu's (in gui)
  • Packaging - currently has to be patched into (2.3.4 RC3) JMeter. I built it off this tag from SVN. Would be nice if it could be packaged in a tarball consisting of 1 or 2 jars that can be extracted to JMeter/lib directory so no re-compiling is needed. I've seen this with other plugings, but not sure how to go about it.

Usage / Notes:

  1. Check out JMeter 2. Apply patch 3. Add mysql-connector-jdbc to project/lib directory 4. Update classpath (if running from Eclipse) to include this library. 5. Run GUI. The listener should be there and configurable. 6. Make improvements and send patches / edit here (wink)
  • No labels