0

My goal is to run a test against a file system which is intentionally slow, to test performance metrics in chaotic storage scenarios. In the same sense that there are ways to limit memory and cpu with cgroups in containers, i've considered wether or not there is a io limitation i can impose.

  • Is there a way to mount a simple file system to a directory which is intentionally slowed down ?
  • Alternatively, is there a way to make a docker container limit disk operation qoutas on a container, by issuing a command line operation (not that the command line operation part is important here - because if I run this on a docker container, it will be started inside of kubernetes for me).
JJJ
  • 32,902
  • 20
  • 89
  • 102
jayunit100
  • 17,388
  • 22
  • 92
  • 167

1 Answers1

1

FUSE gives one path to this. I cloned the example at https://github.com/fntlnz/fuse-example.git and added a sleep() call to fuse-example.c in a strategic location:

 21   if (strcmp(path, filepath) == 0) {
 22     stbuf->st_mode = S_IFREG | 0777;
 23     stbuf->st_nlink = 1;
 24     stbuf->st_size = strlen(filecontent);
 25     sleep(1); // Right here
 26     return 0;
 27   }

Then I mounted it up:

./bin/fuse-example -d -s -f /tmp/example

And gave it a shot:

% cd /tmp/example
% time cat file
I'm the content of the only file available there
cat file  0.00s user 0.00s system 0% cpu 1.008 total
%

While it takes a little coding, an advantage of this route is that you have full control over nearly all of the salient attributes and qualities of the file system.

Allen Luce
  • 7,859
  • 3
  • 40
  • 53