Seekmark Update – 0.9

Version 0.9 gains some functionality that allows it to be used as a quick and dirty random I/O generator. Seekmark does a good job of pounding your disk as hard as possible in all-or-nothing fashion, but now you can specify a delay to insert between seeks to reduce the load, in order to simulate some scenario. For example you may want to test performance of some other application while the system is semi-busy doing random I/O on a database file, or you may want to test shared storage between multiple hosts where one host has 4 processes doing 64k random reads every 20ms and another host has 2 processes, one doing busy 4k random writes as fast as possible and the other doing 128k reads every 50ms.

With this, is a new -e option, that runs seekmark in endless mode. That is, it will simply run until it’s killed.

As usual, see the seekmark page, linked at the top of the blog.


  1. linbloke

    It’s not compiling for me on Ubuntu Server 11.10 i686:

    root@hcff0002:~# gcc -o seekmark -lpthread seekmark-0.9.c
    seekmark-0.9.c: In function ‘getargs’:
    seekmark-0.9.c:321:6: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat]
    /tmp/cck48cFj.o: In function `main':
    seekmark-0.9.c:(.text+0x486): undefined reference to `pthread_create’
    seekmark-0.9.c:(.text+0x4b6): undefined reference to `pthread_join’
    collect2: ld returned 1 exit status
    root@hcff0002:~# dpkg -l | grep pthread
    ii libevent-pthreads-2.0-5 2.0.12-stable-1 Asynchronous event notification library (pthreads)
    ii libpthread-stubs0 0.3-2.1 pthread stubs not provided by native libc
    ii libpthread-stubs0-dev 0.3-2.1 pthread stubs not provided by native libc, development files
    ii libpthread-workqueue-dev 0.8.2-1 thread pool library (development files)
    ii libpthread-workqueue0 0.8.2-1 thread pool library
    root@hcff0002:~# dpkg -l | grep libc
    ii klibc-utils 1.5.22-1ubuntu2 small utilities built with klibc for early boot
    ii libc-bin 2.13-20ubuntu5 Embedded GNU C Library: Binaries
    ii libc-dev-bin 2.13-20ubuntu5 Embedded GNU C Library: Development binaries
    ii libc6 2.13-20ubuntu5 Embedded GNU C Library: Shared libraries
    ii libc6-dev 2.13-20ubuntu5 Embedded GNU C Library: Development Libraries and Header Files
    ii libcairo2 1.10.2-6ubuntu3 The Cairo 2D vector graphics library
    ii libcanberra0 0.28-0ubuntu11 a simple abstract interface for playing event sounds
    ii libcap-ng0 0.6.6-1 An alternate POSIX capabilities library
    ii libck-connector0 0.4.5-1 ConsoleKit libraries
    ii libclass-accessor-perl 0.34-1 Perl module that automatically generates accessors
    ii libclass-isa-perl 0.36-1 report the search path for a class’s ISA tree
    ii libcomerr2 1.41.14-1ubuntu3 common error description library
    ii libconfig-inifiles-perl 2.68-1 Read .ini-style configuration files
    ii libcroco3 0.6.2-1 a generic Cascading Style Sheet (CSS) parsing and manipulation toolkit
    ii libcups2 1.5.0-8ubuntu6 Common UNIX Printing System(tm) – Core library
    ii libcurl3-gnutls 7.21.6-3ubuntu3.2 Multi-protocol file transfer library (GnuTLS)
    ii libcwidget3 0.5.16-3.1ubuntu1 high-level terminal interface library for C++ (runtime files)
    ii libklibc 1.5.22-1ubuntu2 minimal libc subset for use with initramfs
    ii liblocale-gettext-perl 1.05-6build1 Using libc functions for internationalization in Perl
    ii libpthread-stubs0 0.3-2.1 pthread stubs not provided by native libc
    ii libpthread-stubs0-dev 0.3-2.1 pthread stubs not provided by native libc, development files
    ii linux-libc-dev 3.0.0-15.26 Linux Kernel Headers for development
    ii python-pycurl 7.19.0-4ubuntu2 Python bindings to libcurl
    root@hcff0002:~# uname -a
    Linux hcff0002 3.0.0-15-generic-pae #26-Ubuntu SMP Fri Jan 20 17:07:31 UTC 2012 i686 i686 i386 GNU/Linux

    root@hcff0002:~# lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 11.10
    Release: 11.10
    Codename: oneiric

  2. marcusadmin Post author

    It looks like it’s not finding and linking properly. The following should work:

    gcc -pthread -o seekmark seemark-0.9.c

    The warning about long unsigned can be ignored, it has to do with the 32 bit machine. I’ll just cast that variable to a long so that it disappears in future releases.

  3. CFS

    This is quite useful :-) A couple of suggestions though

    a) Even if the seek is “random” from the point of view of the disk, it should be the same (ie not random mathematically) for each device of the same size (so it’s possible to compare two identical disks and get really meaningful results).

    b) Why the limit of 1 MB for the read size?

  4. marcusadmin Post author

    1) I see where you’re coming from on that. Perhaps I could add a predictable, repeatable algorithm. Regardless, I’ve not had much trouble getting meaningful, repeatable results from mathematically random seeks. Several runs over the same disk generally report results within 1%

    2) I suppose the 1MB limit is arbitrary, but even at 1MB the workload shows signs of becoming so sequential that the results cease to be seek bound. Luckily it can be easily changed in the code if you’ve got something specific you want to test.

  5. Stefan


    I use seekmark a lot to benchmark disks and SSD, it’s just a great little program. I have added an alignment option, which allows better testing of SSDs, and I’ve simplified the endless mode code. Here’s the diff, if you’re interested:
    — seekmark-0.9.c.orig 2012-02-07 16:53:46.000000000 +0100
    +++ seekmark-0.9.c 2012-06-27 11:09:06.729116609 +0200
    @@ -68,6 +68,7 @@
    int writerandomdata = 1;
    int delay = 0;
    int endless = 0;
    +int align = 0;

    /* prototypes */
    void seekthenreadwrite(int fd, off_t offset);
    @@ -145,6 +146,7 @@
    printf(“threads to spawn: %d\n”,numthreads);
    printf(“seeks per thread: %d\n”,seeks);
    printf(“io size in bytes: %d\n”,block);
    + printf(“io aligned bytes: %d\n”,1 < (size – block)) {
    – position = (size – block);
    – }
    – seekthenreadwrite(tfd,position);
    – }

    – }
    – else{
    – for(i=0;i (size – block)) {
    – position = (size – block);
    – }
    – seekthenreadwrite(tfd,position);
    + for(i=0;i (size – block)) {
    + position = (size – block);
    + seekthenreadwrite(tfd,position&~0< (sizeof(file)/sizeof(*file))){
    @@ -331,6 +321,13 @@
    numthreads = atoi(optarg);
    + case ‘a':
    + if(atoi(optarg) < 1) {
    + fprintf(stderr,"\nalignment should be a positive integer\n\n");
    + exit(1);
    + }
    + align = atoi(optarg);
    + break;
    case 's':
    if(atoi(optarg) 512, 12=>4096\n”);
    fprintf(stderr,” -w destroy-data Do a write iops test (destructive to file specified)\n”);
    fprintf(stderr,” -R Disable use of random data for write test\n”);
    fprintf(stderr,” -i INTEGER io size (in bytes) to use for iops\n”);


  6. marcusadmin Post author

    Thanks for the info. Unfortunately that also breaks the accuracy of the test by allowing writeback cache. I’m glad that distros still using kernels older than 2.6.32 are on their way out.

  7. marcusadmin Post author

    I’ll take a look. I’ve tested it on Ubuntu 12.04 before, so my guess is that it’s not finding your pthread library. The github issue states that the problem is the mismatched types, but those are just warnings. The real issue is “undefined reference to `pthread_create'”, meaning that the pthread library was not loaded.

  8. Jonathan Stanley

    My bad, had a serious brain-fart… thought the compile actually failed with -pthread when it’s just the warnings, nothing fatal… there is a usable binary in the end. Sorry about that! :o

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>