Sysbench for Data Performance

When you look at the performance of your databases, it’s good to have an understanding of baseline performance.

Benchmarking will help you here.

For open-source databases, sysbench is a popular tool to use for generic benchmarks.

Let’s see what we can do with it.

The need for baseline performance profile

Why is it a good idea to have a baseline performance profile?

Changes can come from anything.

They can come from a simple application change that modified a query, or introduced new query loads.

They can come from degrading hardware, or database migrations.

And of course, changes can come from upgrading the database software.

Without a baseline performance profile, you wouldn’t be able to tell if the performance of the database was better or worse after the change.

Sysbench for data performance

One tool that can help with database performance testing is sysbench.

Sysbench comes with some generic tests, such as typical transactional read/write, insert-only, and read-only workloads.

This makes it a very useful tool for initial tests of changes to configuration or upgrading the database software or hardware.

So let’s take a look at what we can do with it.

Sysbench demo

I have a wrapper script for sysbench.

Sysbench wrapper script
Sysbench wrapper script

The important options for running the benchmark are:

  • the type of test will be oltp inserts. OLTP means transactional workload.
  • number of threads simulates a concurrent workload. This is 8 for our example.
  • we will run the test for 60 seconds.

These options are then passed to the sysbench command.

Using this script, we can compare the runs of a configuration change before and after.

sysbench results
sysbench results

On the left terminal is the result of a benchmark taken before the change.

There’s a lot of output, but we pay attention to the number of queries per second.

After our config change, we only did 327 queries per second.

As opposed to 488 queries per second before the change.

This highlights how important it is to validate the impact of changes.

What sysbench is not

Now, off the shelf, sysbench should not be used for a baseline for your production database performance.

This is because the prepackaged tests are not specific for your application.

While you can customize sysbench scripts to make it closer to your workload, it will take a lot of effort to maintain.

Sysbench also does not store a historical trend of performance anywhere.

While you could create a system for that, it is far better to ingest your query profile in real-time using an open-source or SaaS-based query visibility tool.

Conclusion

Sysbench is a great tool for quickly testing database performance with changes to configuration, upgrading database software, making modifications to hardware, and even migrations to cloud vendors.

Think of sysbench like an outlet tester to make sure you’ve turned off the electricity before sticking a screwdriver in the outlet.

It’s definitely a handy tool in the Data Guardian’s toolbox.