freebsd-dev/module/zfs
Etienne Dechamps dde9380a1b Use 32 as the default number of zvol threads.
Currently, the `zvol_threads` variable, which controls the number of worker
threads which process items from the ZVOL queues, is set to the number of
available CPUs.

This choice seems to be based on the assumption that ZVOL threads are
CPU-bound. This is not necessarily true, especially for synchronous writes.
Consider the situation described in the comments for `zil_commit()`, which is
called inside `zvol_write()` for synchronous writes:

> itxs are committed in batches. In a heavily stressed zil there will be a
> commit writer thread who is writing out a bunch of itxs to the log for a
> set of committing threads (cthreads) in the same batch as the writer.
> Those cthreads are all waiting on the same cv for that batch.
>
> There will also be a different and growing batch of threads that are
> waiting to commit (qthreads). When the committing batch completes a
> transition occurs such that the cthreads exit and the qthreads become
> cthreads. One of the new cthreads becomes he writer thread for the batch.
> Any new threads arriving become new qthreads.

We can easily deduce that, in the case of ZVOLs, there can be a maximum of
`zvol_threads` cthreads and qthreads. The default value for `zvol_threads` is
typically between 1 and 8, which is way too low in this case. This means
there will be a lot of small commits to the ZIL, which is very inefficient
compared to a few big commits, especially since we have to wait for the data
to be on stable storage. Increasing the number of threads will increase the
amount of data waiting to be commited and thus the size of the individual
commits.

On my system, in the context of VM disk image storage (lots of small
synchronous writes), increasing `zvol_threads` from 8 to 32 results in a 50%
increase in sequential synchronous write performance.

We should choose a more sensible default for `zvol_threads`. Unfortunately
the optimal value is difficult to determine automatically, since it depends
on the synchronous write latency of the underlying storage devices. In any
case, a hardcoded value of 32 would probably be better than the current
situation. Having a lot of ZVOL threads doesn't seem to have any real
downside anyway.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Fixes #392
2012-02-08 13:58:10 -08:00
..
arc.c Cleanup ZFS debug infrastructure 2012-02-02 11:24:30 -08:00
bplist.c Fix gcc missing parenthesis warnings 2010-08-31 08:38:35 -07:00
bpobj.c Update to onnv_147 2010-08-26 14:24:34 -07:00
dbuf.c Illumos #764: panic in zfs:dbuf_sync_list 2011-08-01 12:09:11 -07:00
ddt_zap.c Fix stack ddt_zap_lookup() 2011-05-31 12:17:27 -07:00
ddt.c Fix stack ddt_class_contains() 2011-05-31 12:17:27 -07:00
dmu_diff.c Update to onnv_147 2010-08-26 14:24:34 -07:00
dmu_object.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
dmu_objset.c Merge branch 'zpl' 2011-02-18 09:31:25 -08:00
dmu_send.c Illumos #755: dmu_recv_stream builds incomplete guid_to_ds_map 2011-10-18 11:18:14 -07:00
dmu_traverse.c Revert "Fix stack traverse_visitbp()" 2011-05-31 12:17:27 -07:00
dmu_tx.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
dmu_zfetch.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
dmu.c Suppress large kmem_alloc() warning 2011-02-10 09:27:22 -08:00
dnode_sync.c Fix dbuf eviction assertion 2010-08-31 08:38:45 -07:00
dnode.c Improve meta data performance 2011-11-03 10:19:21 -07:00
dsl_dataset.c Illumos #1092: zfs refratio property 2011-08-01 12:09:11 -07:00
dsl_deadlist.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
dsl_deleg.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
dsl_dir.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
dsl_pool.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
dsl_prop.c Fix enum compiler warning 2011-02-23 12:52:51 -08:00
dsl_scan.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
dsl_synctask.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
fm.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
gzip.c Fix zmod.h usage in userspace 2010-08-31 08:38:46 -07:00
lzjb.c Fix stack lzjb 2010-08-31 08:38:49 -07:00
Makefile.in Implemented NFS export_operations. 2011-04-29 12:36:13 -07:00
metaslab.c Illumos #1051: zfs should handle imbalanced luns 2011-08-01 12:09:11 -07:00
refcount.c Fix gcc uninitialized variable warnings 2010-08-31 08:38:43 -07:00
rrwlock.c Enable rrwlock.c compilation 2010-12-07 16:05:25 -08:00
sa.c Implement SA based xattrs 2011-11-28 15:45:51 -08:00
sha256.c Add linux sha2 support 2010-08-31 13:41:59 -07:00
spa_boot.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
spa_config.c Prototype/structure update for Linux 2011-02-10 09:27:21 -08:00
spa_errlog.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
spa_history.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
spa_misc.c Cleanup ZFS debug infrastructure 2012-02-02 11:24:30 -08:00
spa.c Reduce number of zio free threads 2012-01-17 08:54:00 -08:00
space_map.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
txg.c Illumos #1313: Integer overflow in txg_delay() 2011-08-01 12:09:43 -07:00
uberblock.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
unique.c Fix gcc ident pragma warnings 2010-08-27 15:34:02 -07:00
vdev_cache.c Illumos #175: zfs vdev cache consumes excessive memory 2011-08-01 12:09:11 -07:00
vdev_disk.c Linux 2.6.37 compat, WRITE_FLUSH_FUA 2011-06-17 14:37:26 -07:00
vdev_file.c Prototype/structure update for Linux 2011-02-10 09:27:21 -08:00
vdev_label.c Fix gcc uninitialized variable warnings 2010-08-31 08:38:43 -07:00
vdev_mirror.c Fix gcc c90 compliance warnings 2010-08-27 15:28:32 -07:00
vdev_missing.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
vdev_queue.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
vdev_raidz.c Fix variables named current 2010-08-31 08:38:44 -07:00
vdev_root.c Fix gcc c90 compliance warnings 2010-08-27 15:28:32 -07:00
vdev.c Allow setting bootfs on any pool 2012-01-17 13:49:07 -08:00
zap_leaf.c Fix gcc uninitialized variable warnings 2010-08-31 08:38:43 -07:00
zap_micro.c Export symbols for the full ZAP API 2011-09-27 16:12:36 -07:00
zap.c Fix rw_init() usage 2010-08-31 08:38:46 -07:00
zfs_acl.c Linux compat 2.6.39: mount_nodev() 2011-07-01 13:36:39 -07:00
zfs_byteswap.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
zfs_debug.c Cleanup ZFS debug infrastructure 2012-02-02 11:24:30 -08:00
zfs_dir.c Allow multiple values per directory entry 2012-02-02 11:22:08 -08:00
zfs_fm.c Initial zio delay timing 2010-10-12 14:55:02 -07:00
zfs_fuid.c Drop HAVE_XVATTR macros 2011-03-02 11:44:34 -08:00
zfs_ioctl.c Cleanup ZFS debug infrastructure 2012-02-02 11:24:30 -08:00
zfs_log.c Drop HAVE_XVATTR macros 2011-03-02 11:44:34 -08:00
zfs_onexit.c Add linux kernel device support 2010-08-31 13:41:50 -07:00
zfs_replay.c Use Linux ATTR_ versions 2011-03-03 11:29:15 -08:00
zfs_rlock.c Range lock performance improvements 2011-03-08 12:44:06 -08:00
zfs_sa.c Export symbol zfs_attr_table 2012-01-27 09:23:36 -08:00
zfs_vfsops.c Linux 3.1 compat, super_block->s_shrink 2012-01-11 11:46:02 -08:00
zfs_vnops.c Allow multiple values per directory entry 2012-02-02 11:22:08 -08:00
zfs_znode.c Linux 3.1 compat, super_block->s_shrink 2012-01-11 11:46:02 -08:00
zil.c Illumos #883: ZIL reuse during remount corruption 2011-08-01 12:09:11 -07:00
zio_checksum.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
zio_compress.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
zio_inject.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
zio.c Illumos #734: Use taskq_dispatch_ent() interface 2011-12-14 09:19:30 -08:00
zle.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
zpl_export.c Linux compat 2.6.39: mount_nodev() 2011-07-01 13:36:39 -07:00
zpl_file.c Linux 3.1 compat, fops->fsync() 2011-11-10 10:03:08 -08:00
zpl_inode.c Allow xattrs on symlinks 2011-11-29 10:24:24 -08:00
zpl_super.c Linux 3.3 compat, sops->show_options() 2012-02-03 10:02:01 -08:00
zpl_xattr.c Apply the ZoL coding standard to zpl_xattr.c 2012-01-12 15:12:03 -08:00
zrlock.c Export ZFS symbols needed by Lustre. 2010-09-17 16:24:15 -07:00
zvol.c Use 32 as the default number of zvol threads. 2012-02-08 13:58:10 -08:00