Skip to content
Snippets Groups Projects
README.md 19 KiB
Newer Older
Jana Berušková's avatar
Jana Berušková committed
# What's DiskSim?

[DiskSim](http://www.pdl.cmu.edu/DiskSim/index.shtml) is an efficient, accurate, highly-configurable disk system simulator originally developed at the University of Michigan and enhanced at CMU to support research into various aspects of storage subsystem architecture. It is written in C and requires no special system software (just basic POSIX interfaces). DiskSim includes modules for most secondary storage components of interest, including device drivers, buses, controllers, adapters, and disk drives. DiskSim also includes support for a number of externally-provided trace formats and internally-generated synthetic workloads, and includes hooks for inclusion in a larger scale system-level simulator.

# Why to use DiskSim?
Because it's unprecedented accuracy:

![Results](img/results.png)

# DiskSim builder and scripts

This tool helps with building DiskSim v4.0 in these ways:
* base sources or these with [DIXtrac] ) tool were downloaded from: http://www.pdl.cmu.edu/Dixtrac/index.shtml
Jana Berušková's avatar
Jana Berušková committed
* patch sources by Microsoft [SSD extension] were downloaded from: https://www.microsoft.com/en-us/download/details.aspx?id=52332
* patch sources by Oliver Liu [64bit patch] were downloaded from: https://github.com/myidpt/PFSsim/tree/master/disksim/64bit-ssd-patch-files
Jana Berušková's avatar
Jana Berušková committed
* use additional patches in `patches/`
Jana Berušková's avatar
Jana Berušková committed
* enforce C standard and optimization, so `disksim` can be compiled by f.e. `gcc` v5.4.0 and can run faster
Jana Berušková's avatar
Jana Berušková committed
* run validation tests coming with sources

Folder `scripts/` holds other useful tools including a generator of **JBOD|RAID{0|1|3|4|5}** _parv_ files.

Jana Berušková's avatar
Jana Berušková committed
## Build DiskSim
Jana Berušková's avatar
Jana Berušková committed

### Clone this repo
```
$ git clone git@gitlab.fit.cvut.cz:berusjan/disksim-4.0.git
$ cd disksim-4.0
```

### Install requirements
It requires installed C development tools, `bison` (YACC-compatible parser generator) and `flex` (fast lexical analyzer generator).

The example of installation command for Ubuntu distribution:
```
sudo apt-get install build-essential bison flex
```

### Help for make
```
$ make help
```
```
Make patched DiskSim

Usage:
Jana Berušková's avatar
Jana Berušková committed
  make [target ...]
Jana Berušková's avatar
Jana Berušková committed

Targets:
Jana Berušková's avatar
Jana Berušková committed
          all ......... make compile, install and test
Jana Berušková's avatar
Jana Berušková committed
          compile ..... compile disksim in build/disksim-4.0/
          install ..... install binaries to bin/
          test ........ run valadation tests
Jana Berušková's avatar
Jana Berušková committed
          clean ....... delete bin/
Jana Berušková's avatar
Jana Berušková committed
          help ........ print this help screen
```

### Build DiskSim 
```
$ make
```
```
Jana Berušková's avatar
Jana Berušková committed
[DISKSIM] Compile ...
chmod +x 'build/disksim-4.0/libparam/'*.pl
make -C 'build/disksim-4.0'
make[1]: Vstupuje se do adresáře „/home/oem/BP/My_BP/patches_all/patched/build/disksim-4.0“
make -C libddbg
make[2]: Vstupuje se do adresáře „/home/oem/BP/My_BP/patches_all/patched/build/disksim-4.0/libddbg“
cc -O2 -std=gnu90  -g -I../libparam   -c -o ddbg_assert.o ddbg_assert.c
cc -O2 -std=gnu90  -g -I../libparam   -c -o ddbg_trace.o ddbg_trace.c
ar cru libddbg.a ddbg_assert.o ddbg_trace.o
ar: `u' modifier ignored since `D' is the default (see `U')
mkdir -p include/libddbg lib
cp -p libddbg.h include/libddbg
cp -p libddbg.a lib 
make[2]: Opouští se adresář „/home/oem/BP/My_BP/patches_all/patched/build/disksim-4.0/libddbg“
Jana Berušková's avatar
Jana Berušková committed
...

OK, installed binaries:
-rwxrwxr-x 1 jake jake 606424 pro  7 03:18 bin/disksim
-rwxrwxr-x 1 jake jake  51784 pro  7 03:18 bin/dxcachectl
-rwxrwxr-x 1 jake jake  72536 pro  7 03:18 bin/dx_layout
-rwxrwxr-x 1 jake jake 197560 pro  7 03:18 bin/dx_mech
-rwxrwxr-x 1 jake jake  55960 pro  7 03:18 bin/dxreplay
-rwxrwxr-x 1 jake jake 700120 pro  7 03:18 bin/dx_rest
-rwxrwxr-x 1 jake jake 197784 pro  7 03:18 bin/dx_seeks
-rwxrwxr-x 1 jake jake 172888 pro  7 03:18 bin/dx_skew_curve
-rwxrwxr-x 1 jake jake 168696 pro  7 03:18 bin/dx_skews_simple
-rwxrwxr-x 1 jake jake  72376 pro  7 03:18 bin/dx_stat
-rwxrwxr-x 1 jake jake  10528 pro  7 03:18 bin/hplcomb
-rwxrwxr-x 1 jake jake  22792 pro  7 03:18 bin/mems_seektest
-rwxrwxr-x 1 jake jake 610552 pro  7 03:18 bin/physim
-rwxrwxr-x 1 jake jake  10480 pro  7 03:18 bin/rms
Jana Berušková's avatar
Jana Berušková committed

[DISKSIM] Run validation test build/disksim-4.0/valid/runvalid ...
cd 'build/disksim-4.0/valid/' && sh 'runvalid'
These results represent actual drive validation experiments
...

Jana Berušková's avatar
Jana Berušková committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
```

### Run validation tests
```
$ make test
```
```
[DISKSIM] Run validation test build/disksim-4.0/valid/runvalid ...
cd 'build/disksim-4.0/valid/' && sh 'runvalid'
These results represent actual drive validation experiments

QUANTUM_QM39100TD-SW (rms should be about 0.378)
rms = 0.378078

SEAGATE_ST32171W (rms should be about 0.349)
rms = 0.347863
...
```

## Scripts

### Go to script folder
```
$ cd script
```

### `disksim.sh`
```
$ ./disksim.sh 
```
```
DiskSim wrapper

Usage:
  ./disksim.sh [-q] <param_file> [ <output_file> [ <trace_file> [ <trace_type> [ <par_override> ... ] ] ] ]

Options:
  -q ............... Quiet - supress verbose messages

Arguments:
  <param_file> ..... Name of the parameter file
                     Set - for standard input

  <output_file> .... Name of the output file
                     Output can be directed to stdout by specifying 'stdout' as a basename,
                       and it quiet verbose messages. That's a default

  <trace_file> ..... Trace file to be used as input
                     Input is taken from stdin when 'stdin' is specified,
                       of course not together with <param_file> from 'stdin'
                     Synthetic workload generation portion of the simulator is enabled
                       instead of a trace file if it is empty, '-' or '0'

  <trace_type> ..... Format of the trace input, like 'ascii', 'validate', 'raw', 'hpl' ...
                     Set to 'ascii' if it's empty, '-' or '0'

  <par_override> ... Replacement for default parameter values or parameter values from <param_file>

Notes:
  * disksim runs in a folder with diskspecs (diskspecs/) and temporarily copies <param_file> here
  * it prints colored messages and resulted file list
```

### `gen_raid.sh`
```
$ ./gen_raid.sh -h
```
```
Usage:
  ./gen_raid.sh [options] jbod|raid{0|1|3|4|5} [<number_of_disks>]
  ./gen_raid.sh -h

Arguments:
  jbod|raid{0|1|3|4|5}  raid type
  <number_of_disks>     integer number of disks  (by default 3)

Options:
  -h                    show this help screen and exit
  -v                    increase output verbosity
  -m                    print mapping requests
  -o FILE               output parv filename; - for stdout         (by default -)
  -r INT                number of I/O requests to generate         (by default 1000)
  -S FLOAT              probability of sequential access <0.0,1.0> (by default 0.5)
  -R FLOAT              probability of read access       <0.0,1.0> (by default 0.5)
  -p INT                number of processes to genereate load      (by default 1)
  -u INT                stripe unit                                (by default 64)
  -s REQUEST_SIZE       disksim style request size,
                          default: 'exponential, 0.0, 8.0'

                        types of sizes:
                          uniform - requiring two floats - minimum and maximum
                            e.g. -s 'uniform, 1.0, 8.0'

                          normal - requiring two floats - mean and variance values
                                 - (stredni hodnota a hodnota rozptylu)
                                 - second value must be nonnegative
                            e.g. -s 'normal, 5.0, 4,0'

                          exponential - requiring two floats - base and mean values
                            e.g. -s 'exponential, 0.0, 16.0'

  -d DISK_NAME          disksim disk to simulate  (by default QUANTUM_TORNADO_validate)
                          available rotational disks:
                            DEC_RZ26_validate
                            HP_C2247A_validate
                            HP_C2249A
                            HP_C2490A_validate
                            HP_C3323A
                            HP_C3323A_validate
                            IBM_DNES-309170W_validate
                            QUANTUM_QM39100TD-SW
                            QUANTUM_TORNADO_validate
                            SEAGATE_ST32171W
                            SEAGATE_ST34501N_validate
                            SEAGATE_ST39102LW_validate
                            Seagate_ST41601N_validate
                          available mem disks:
                            MEMS_G1
                            MEMS_G2
                            MEMS_G3
                          available ssd disks:
                            SSD_IOZONE
```

### `run_raid_procs.sh`
```
$ ./run_raid_procs.sh
```
```
Collect and represent disksim metrics

Usage for collecting metrics:
  ./run_raid_procs.sh -p <max_num_of_processes> [gen_raid_options] jbod|raid{0|1|3|4|5} [<number_of_disks>]

Usage for get ASCII metrics:
  ./run_raid_procs.sh --ascii <metric> ...

Usage for get gnuplot metrics:
  ./run_raid_procs.sh ---gnuplot <metric> ...

Availaible metrics:
  'Average # requests'
  'Average queue length'
  'Avg # read requests'
  'Avg # write requests'
  'Base SPTF/SDF Different'
  'Batch size average'
  'Batch size maximum'
  'Batch size std.dev.'
  'Completely idle time'
  'Critical Read Response time average'
  'Critical Read Response time maximum'
  'Critical Read Response time std.dev.'
  'Critical Reads'
  'Critical Write Response time average'
  'Critical Write Response time maximum'
  'Critical Write Response time std.dev.'
  'Critical Writes'
  'End # requests'
  'End queued requests'
  'Idle period length average'
  'Idle period length maximum'
  'Idle period length std.dev.'
  'Instantaneous queue length average'
  'Instantaneous queue length maximum'
  'Instantaneous queue length std.dev.'
  'Inter-arrival time average'
  'Inter-arrival time maximum'
  'Inter-arrival time std.dev.'
  'Max # read requests'
  'Max # write requests'
  'Maximum # requests'
  'Maximum queue length'
  'Non-Critical Read Response time average'
  'Non-Critical Read Response time maximum'
  'Non-Critical Read Response time std.dev.'
  'Non-Critical Reads'
  'Non-Critical Write Response time average'
  'Non-Critical Write Response time maximum'
  'Non-Critical Write Response time std.dev.'
  'Non-Critical Writes'
  'Number of batches'
  'Number of idle periods'
  'Number of reads'
  'Number of writes'
  'Overlaps combined'
  'Physical access time average'
  'Physical access time maximum'
  'Physical access time std.dev.'
  'Priority SPTF/SDF Different'
  'Queue time average'
  'Queue time maximum'
  'Queue time std.dev.'
  'Read inter-arrival average'
  'Read inter-arrival maximum'
  'Read inter-arrival std.dev.'
  'Read overlaps combined'
  'Read request size average'
  'Read request size maximum'
  'Read request size std.dev.'
  'Request size average'
  'Request size maximum'
  'Request size std.dev.'
  'Requests per second'
  'Response time average'
  'Response time maximum'
  'Response time std.dev.'
  'runlistlen'
  'runoutstanding'
  'Sequential reads'
  'Sequential writes'
  'setsize'
  'simtime'
  'Sub-optimal mapping penalty average'
  'Sub-optimal mapping penalty maximum'
  'Sub-optimal mapping penalty std.dev.'
  'Timeout SPTF/SDF Different'
  'Total Requests handled'
  'warmuptime'
  'Write inter-arrival average'
  'Write inter-arrival maximum'
  'Write inter-arrival std.dev.'
  'Write request size average'
  'Write request size maximum'
  'Write request size std.dev.'
```


### Examples

#### Print overall I/O stats from RAID5
```
$ ./gen_raid.sh raid5 | ./disksim.sh - | ./filter_overall.pl
```
```
Total Requests handled:                    1000
Requests per second:                       52.113620
Completely idle time:                      75.004636    0.003909
Response time average:                     7.294895
...
```

#### Print IOPS stats from RAID0
```
$ ./gen_raid.sh raid0 | ./disksim.sh - | ./filter_iops.pl
```
```
Average latency  [ms]:         4.18640
RAID   I/O per second:        62.18773
RAID    kB per second:       392.03146
DISK#0 I/O per second:        24.31540
DISK#0  kB per second:       140.43385
```

#### Print mappings for all supported RAIDs
```
$ for raid in jbod raid0 raid1 raid3 raid4 raid5; do
   ./gen_raid.sh -m -r20 -R0.0 -u1 ${raid} 4 | ./disksim.sh - | ./filter_map_requests.pl
  done
```
```
Mapping for logorg jbod:

     block   disk0               
  ---------+--------------------
   1992757   0                   
   1992758   1                   
   1992759   2                   
   1992760   3                   
   1992761   4                   
   1992762   5                   
   1992763   6                   
   1992764   7                   
   1992765   8                   
   1992766   9                   
   1992767   10                  
   1992768   11                  
   1992769   12                  
   1992770   13                  
   1992771   14                  
   1992772   15                  
   1992773   16                  
   1992774   17                  
   1992775   18                  
   1992776   19                  


Mapping for logorg raid0:

     block   disk0                disk1                disk2                disk3               
  ---------+--------------------+--------------------+--------------------+--------------------
    498189                        0                    1                    2                   
    498190   3                    4                    5                    6                   
    498191   7                    8                    9                    10                  
    498192   11                   12                   13                   14                  
    498193   15                   16                   17                   18                  
    498194   19                                                                                 


Mapping for logorg raid1:

     block   disk0                disk1                disk2                disk3               
  ---------+--------------------+--------------------+--------------------+--------------------
   1992757   0                    0                    0                    0                   
   1992758   1                    1                    1                    1                   
   1992759   2                    2                    2                    2                   
   1992760   3                    3                    3                    3                   
   1992761   4                    4                    4                    4                   
   1992762   5                    5                    5                    5                   
   1992763   6                    6                    6                    6                   
   1992764   7                    7                    7                    7                   
   1992765   8                    8                    8                    8                   
   1992766   9                    9                    9                    9                   
   1992767   10                   10                   10                   10                  
   1992768   11                   11                   11                   11                  
   1992769   12                   12                   12                   12                  
   1992770   13                   13                   13                   13                  
   1992771   14                   14                   14                   14                  
   1992772   15                   15                   15                   15                  
   1992773   16                   16                   16                   16                  
   1992774   17                   17                   17                   17                  
   1992775   18                   18                   18                   18                  
   1992776   19                   19                   19                   19                  


Mapping for logorg raid3:

     block   disk0                disk1                disk2                disk3               
  ---------+--------------------+--------------------+--------------------+--------------------
    664252                        0                    1                    0,1                 
    664253   2                    3                    4                    2,3,4               
    664254   5                    6                    7                    5,6,7               
    664255   8                    9                    10                   8,9,10              
    664256   11                   12                   13                   11,12,13            
    664257   14                   15                   16                   14,15,16            
    664258   17                   18                   19                   17,18,19            


Mapping for logorg raid4:

     block   disk0                disk1                disk2                disk3               
  ---------+--------------------+--------------------+--------------------+--------------------
    664252                        0                    1                    0,1                 
    664253   2                    3                    4                    2,3,4               
    664254   5                    6                    7                    5,6,7               
    664255   8                    9                    10                   8,9,10              
    664256   11                   12                   13                   11,12,13            
    664257   14                   15                   16                   14,15,16            
    664258   17                   18                   19                   17,18,19            


Mapping for logorg raid5:

     block   disk0                disk1                disk2                disk3               
  ---------+--------------------+--------------------+--------------------+--------------------
    664252                        0                    1                    0,1                 
    664253   3                    4                    2,3,4                2                   
    664254   7                    5,6,7                5                    6                   
    664255   8,9,10               8                    9                    10                  
    664256   11                   12                   13                   11,12,13            
    664257   15                   16                   14,15,16             14                  
    664258   19                   17,18,19             17                   18                  

```

#### Collect metrics for RAID5 with 10000 requests for 1-100 parallel processes
```
$ ./run_raid_procs.sh -p100 -r10000 raid5
```
```
Collecting metrics for 100 threads ... done (in .work/metrics_*.out)
```

#### Print collected metric for 1-100 parallel processes to a screen
```
./run_raid_procs.sh --ascii 'Response time average'
```
```
00000001 threads: 7.430611
00000002 threads: 11.030188
00000003 threads: 13.360172
00000004 threads: 15.235009
00000005 threads: 16.508526
00000006 threads: 17.762317
...
```

#### Show collected metrics for 1-100 parallel processes as a pictures
```
./run_raid_procs.sh --gnuplot 'Average # requests' 'Response time average' 'Write inter-arrival average' 'Completely idle time'
```
![Example](img/example.png)