Project

General

Profile

Bug #7968

multi-threaded spa_sync()

Added by Matthew Ahrens over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
zfs - Zettabyte File System
Start date:
2017-03-14
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

spa_sync() iterates over all the dirty dnodes and processes each of them by calling dnode_sync(). If there are many dirty dnodes (e.g. because we created or removed a lot of files), the single thread of spa_sync() calling dnode_sync() can become a bottleneck. Additionally, if many dnodes are dirtied concurrently in open context (e.g. due to concurrent file creation), the os_lock will experience lock contention via dnode_setdirty().

The solution is to track dirty dnodes on a multilist_t, and for spa_sync() to use separate threads to process each of the sublists in the multilist.

On the concurrent file creation microbenchmark, the performance improvement from dnode_setdirty() is up to 7%. Additionally, the wall clock time spent in spa_sync() is reduced to 15%-40% of the single-threaded case. In terms of cost/reward, once the other bottlenecks are addressed, fixing this bug will provide a medium-large performance gain and require a medium amount of effort to implement.

History

#1

Updated by Electric Monk over 2 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit 94c2d0eb22e9624151ee84a7edbf7178e1bf4087

commit  94c2d0eb22e9624151ee84a7edbf7178e1bf4087
Author: Matthew Ahrens <mahrens@delphix.com>
Date:   2017-03-16T12:09:34.000Z

    7968 multi-threaded spa_sync()
    Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
    Reviewed by: Brad Lewis <brad.lewis@delphix.com>
    Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF