|
| 1 | +.. _mongoperf: |
| 2 | + |
| 3 | +============= |
| 4 | +``mongoperf`` |
| 5 | +============= |
| 6 | + |
| 7 | +.. http://www.mongodb.org/display/DOCS/mongoperf |
| 8 | + |
| 9 | +.. default-domain:: mongodb |
| 10 | + |
| 11 | +Synopsis |
| 12 | +-------- |
| 13 | + |
| 14 | +:program:`mongoperf` is a utility to check disk I/O performance independent of MongoDB. |
| 15 | +It times tests of random disk I/O and presents the results. |
| 16 | +:program:`mongoperf` can be used to check disk subsystem performance even when MongoDB |
| 17 | +will not be used at all: the :samp:`mmf:false` mode is completely generic. |
| 18 | +In that mode is it somewhat analogous to tools such as |
| 19 | +`bonnie++ <http://sourceforge.net/projects/bonnie/>`_ |
| 20 | +(albeit mongoperf is simpler). |
| 21 | + |
| 22 | +Specify options to :program:`mongoperf` using a JavaScript document. |
| 23 | + |
| 24 | +.. seealso:: |
| 25 | + |
| 26 | + * `bonnie <http://www.textuality.com/bonnie/>`_ |
| 27 | + * `bonnie++ <http://sourceforge.net/projects/bonnie/>`_ |
| 28 | + * `Output from an example run <https://gist.github.com/1694664>`_ |
| 29 | + * `Checking Disk Performance with the mongoperf Utility <http://blog.mongodb.org/post/40769806981/checking-disk-performance-with-the-mongoperf-utility>`_ |
| 30 | + |
| 31 | +.. _mongoperf-options: |
| 32 | + |
| 33 | +Options |
| 34 | +------- |
| 35 | + |
| 36 | +.. binary:: mongoperf |
| 37 | + |
| 38 | +.. program:: mongoperf |
| 39 | + |
| 40 | +.. option:: --help |
| 41 | + |
| 42 | + Displays the options to :program:`mongoperf`. |
| 43 | + Options are specified using a JavaScript document. |
| 44 | + |
| 45 | +.. _mongoperf-fields: |
| 46 | + |
| 47 | +Fields |
| 48 | +------ |
| 49 | + |
| 50 | + :samp:`nThreads: {integer}` |
| 51 | + |
| 52 | + number of threads, defaults to 1. You will need several threads to |
| 53 | + test a disk subsystem to saturation. For example, try |
| 54 | + :samp:`nThreads:16` |
| 55 | + |
| 56 | + :samp:`fileSizeMB: {integer}` |
| 57 | + |
| 58 | + test file size, default is 1Mb (1024^2 bytes) |
| 59 | + |
| 60 | + :samp:`sleepMicros: {integer}` |
| 61 | + |
| 62 | + pause for *sleepMicros* / *nThreads* between each operation |
| 63 | + (default 0). |
| 64 | + |
| 65 | + :samp:`mmf: {Boolean}` |
| 66 | + |
| 67 | + Set to *true* to use memory mapped files (default: false) |
| 68 | + |
| 69 | + :samp:`r: {Boolean}` |
| 70 | + |
| 71 | + Set to *true* to perform reads (default: false) |
| 72 | + |
| 73 | + :samp:`w: {Boolean}` |
| 74 | + |
| 75 | + Set to *true* to perform writes (default: false) |
| 76 | + |
| 77 | + :samp:`recSizeKB: {integer}` |
| 78 | + |
| 79 | + Size of each write in KB |
| 80 | + |
| 81 | + :samp:`syncDelay: {integer}` |
| 82 | + |
| 83 | + Seconds between fsyncs, like |
| 84 | + :mongodb:option:`--syncdelay <mongod --syncdelay>` in mongod. |
| 85 | + For use with :samp:`mmf:true` mode only. The :samp:`syncDelay:{secs}` |
| 86 | + option instructs :program:`mongoperf` to |
| 87 | + perform an asynchronous fsync of the test mmap file at the |
| 88 | + specified interval. |
| 89 | + :program:`mongod` does something similar |
| 90 | + every 60 seconds, thus this can be useful to test basic system |
| 91 | + behavior in a simpler setting. This option is applicable only |
| 92 | + when using :samp:`mmf:true` mode. |
| 93 | + Currently in :program:`mongoperf` this defaults to zero, which |
| 94 | + means off. |
| 95 | + |
| 96 | + |
| 97 | +Use |
| 98 | +--- |
| 99 | + |
| 100 | +Building |
| 101 | +~~~~~~~~ |
| 102 | + |
| 103 | +Run ``scons mongoperf`` or ``scons mongoperf.exe`` to build. |
| 104 | + |
| 105 | +.. note:: |
| 106 | + |
| 107 | + .. version-added: 2.0.2 |
| 108 | + :program:`mongoperf` is new, so will need a recent version of the |
| 109 | + MongoDB source code. |
| 110 | + |
| 111 | +Running |
| 112 | +~~~~~~~ |
| 113 | + |
| 114 | +.. code-block:: javascript |
| 115 | + |
| 116 | + mongoperf |
| 117 | + |
| 118 | + usage: |
| 119 | + |
| 120 | + mongoperf < myjsonconfigfile |
| 121 | + |
| 122 | + { |
| 123 | + nThreads:<n>, // number of threads (default 1) |
| 124 | + fileSizeMB:<n>, // test file size (default 1MB) |
| 125 | + sleepMicros:<n>, // pause for sleepMicros/nThreads between each operation (default 0) |
| 126 | + mmf:<bool>, // if true do i/o's via memory mapped files (default false) |
| 127 | + r:<bool>, // do reads (default false) |
| 128 | + w:<bool>, // do writes (default false) |
| 129 | + recSizeKB:<n>, // size of each write (default 4KB) |
| 130 | + syncDelay:<n> // secs between fsyncs, like --syncdelay in mongod. (default 0/never) |
| 131 | + } |
| 132 | + |
| 133 | + |
| 134 | +* non-mmf io is direct io (no caching). use a large file size to test |
| 135 | + making the heads move significantly and to avoid i/o coalescing |
| 136 | +* mmf io uses caching (the file system cache). |
| 137 | + |
| 138 | + |
| 139 | +.. code-block:: sh |
| 140 | + |
| 141 | + # example invocation: |
| 142 | + # test physical (direct) random read io's, using 16 concurrent reader threads, |
| 143 | + # and a 1GB test file. |
| 144 | + echo "{nThreads:16,fileSizeMB:1000,r:true}" | ./mongoperf | tee out |
| 145 | + |
| 146 | + # we might do this while it runs: |
| 147 | + iostat -xm 2 |
| 148 | + |
| 149 | + |
| 150 | +mmf:false mode (direct i/o test) |
| 151 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 152 | + |
| 153 | +In this default mode, mongoperf performs random 4KB +direct+ (physical) |
| 154 | +disk i/o's (i.e., O_DIRECT is used on Linux). |
| 155 | +Thus this is a physical disk i/o test. |
| 156 | + |
| 157 | +mmf:true mode |
| 158 | +~~~~~~~~~~~~~ |
| 159 | + |
| 160 | +If :samp:`mmf:true` is specified as an option, tests are performed using |
| 161 | +memory-mapped files. |
| 162 | +These files are opened in a `normal` fashion and thus *caching is allowed*. |
| 163 | +This sometimes can be used to test file system cache behavior with |
| 164 | +memory mapped files. |
| 165 | + |
| 166 | + |
| 167 | +.. TODO:: previously had terse link to iostat |
0 commit comments