BTREPLAY(8)

πŸ’– BTREPLAY β€” bestie edition πŸ’–

okay so you wanna know about btreplay?? it's a section 8 manual page (that's the sysadmin / maintenance commands section, iykyk) and it is literally the glow-up machine for your IO workload. let's get into it ✨


✨ NAME ✨

btreplay β€” recreate IO loads recorded by blktrace. that's the whole vibe, no cap πŸŽ€


🌸 SYNOPSIS 🌸

btreplay [ options ] <dev...>

yeah bestie, you hand it some devices and some options and it does its thing πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so btrecord and btreplay are a duo, a little iconic pair 🫢 they give you the ability to record and replay IOs that were captured by the blktrace utility. and the way they do it? they genuinely try to maintain ordering, CPU mappings, and the time-separation of IOs. maintaining the vibe, fr fr.

here's the lore: blktrace gives you the ability to collect detailed traces from the kernel for each and every IO processed by the block IO layer. these traces hand you a complete timeline for every IO processed, including all the detailed info about when an IO was first received by the block IO layer β€” meaning: the device, CPU number, time stamp, IO direction, sector number, and IO size (that's the number of sectors, not bytes, don't get it twisted). and with all that info? you can replay the IO again on the same machine, or on a totally different machine set up entirely. slay 🌈

the basic operating work-flow to replay IOs is like, something like this:

  • Run blktrace to collect traces. here you specify the device or devices you wish to trace and later replay IOs upon.
Note: the only traces you're actually interested in are QUEUE requests β€” so to save system resources (including storage for traces), one could specify the -a queue command line option to blktrace. saving resources is self-care πŸ’…
  • While blktrace is running, you run the workload that you're interested in.
  • When the work load has completed, you stop the blktrace utility (thus saving all traces over the complete workload).
  • You extract the pertinent IO information from the traces saved by blktrace using the btrecord utility. this will parse each trace file created by blktrace, and crafty IO descriptions to be used in the next phase of the workload processing.
  • Once btrecord has successfully created a series of data files to be processed, you can run the btreplay utility, which attempts to generate the same IOs seen during the sample workload phase. and then it's giving... the same IOs. iconic πŸ‘‘

πŸ’… OPTIONS πŸ’…

  • -c <num>, --cpus=<num> β€” set number of CPUs to use.
  • -d <dir>, --input-directory=<dir> β€” set input directory. this option requires a single parameter providing the directory name for where input files are to be found. the default directory is the current directory (.). yes bestie, it just looks right where you're standing by default πŸŽ€
  • -F, --find-records β€” find record files automatically. this option instructs btreplay to go find all the record files in the directory specified (either via the -d option, or in the default directory (.).
  • -h, --help β€” show help and exit. the classic.
  • -i <basename>, --input-base=<basename> β€” set base name for input files. every input file has 3 fields:
    1. Device identifier (taken directly from the device name of the blktrace output file).
    2. btrecord base name β€” by default replay.
    3. The CPU number (again, taken directly from the blktrace output file name).

this option requires a single parameter that will override the default name (replay), and replace it with the specified value.

  • -I <num>, --iterations=<num> β€” set number of iterations to run. this option requires a single parameter which specifies the number of times to run through the input files. the default value is 1.
  • -M <filename>, --map-devs=<filename> β€” specify device mappings. this option requires a single parameter which specifies the name of a file contain device mappings. the file must be very simply managed, with just two pieces of data per line:
    • The device name on the recorded system (with the /dev/ removed). Example: /dev/sda would just be sda.
    • The device name on the replay system to use (again, without the /dev/ path prepended).

an example file for when one would map devices /dev/sda and /dev/sdb on the recorded system to dev/sdg and sdh on the replay system would be:

sda sdg
sdb sdh
the only entries in the file that are allowed are these two element lines β€” we do not (yet?) support the notion of blank lines, or comment lines, or the like. so no little # diary entries in there, sorry bestie 😭

the utility allows for multiple -M options to be supplied on the command line.

  • -N, --no-stalls β€” disable pre-bunch stalls. when specified on the command line, all pre-bunch stall indicators will be ignored. IOs will be replayed without inter-bunch delays. no waiting around, we're booked and busy πŸ’…
  • -x <factor>, --acc-factor=<factor> β€” specify acceleration factor. default value is 1 (no acceleration).
  • -v, --verbose β€” enable verbose output. when specified on the command line, this option instructs btreplay to store information concerning each stall and IO operation performed by btreplay. the name of each file so created will be the input file name used with an extension of .rep appended onto it. thus, an input file of the name sdab.replay.3 would generate a verbose output file with the name sdab.replay.3.rep in the directory specified for input files. πŸ“

in addition, btreplay will also output to stderr the names of the input files being processed.

  • -V, --version β€” show version number and exit.
  • -W, --write-enable β€” enable writing during replay. as a precautionary measure, by default btreplay will not process write requests. in order to enable btreplay to actually write to devices one must explicitly specify the -W option.
bestie. listen. this one writes to your devices for real. it's off by default for a reason β€” don't just sprinkle -W on a command because it looked cute. ⚠️

🫢 AUTHORS 🫢

btreplay was written by Alan D. Brunelle. this man page was created from the btreplay documentation by Bas Zoetekouw. legends, both of them πŸ‘‘


πŸ’€ REPORTING BUGS πŸ’€

found a bug? report it to <linux-btrace@vger.kernel.org>. tell them everything, they'll handle it πŸ™ˆ


Copyright Β© 2007 Alan D. Brunelle, Alan D. Brunelle and Nathan Scott.

this is free software. you may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. there is NO WARRANTY, to the extent permitted by law.

this manual page was created for Debian by Bas Zoetekouw. it was derived from the documentation provided by the authors and it may be used, distributed and modified under the terms of the GNU General Public License, version 2.

on Debian systems, the text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2.


🌈 SEE ALSO 🌈

the full documentation for btreplay can be found in /usr/share/doc/blktrace on Debian systems.

  • blktrace (8)
  • blkparse (1)
  • btrecord (8)

okay that's the whole page, bestie, you're fully caught up πŸ’–βœ¨

this lil masterpiece comes from blktrace git-20071207142532, dated December 8, 2007 β€” vintage but still eating, no cap πŸŽ€πŸ¦‹πŸ’