• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
XNU write throttle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XNU write throttle?


  • Subject: XNU write throttle?
  • From: Jorgen Lundman <email@hidden>
  • Date: Wed, 28 Mar 2018 09:20:18 +0900
  • Dkim-filter: OpenDKIM Filter v2.10.3 mail.lundman.net 94CAA13F3CC

Hello list,

So things are pretty stable and I thought I would look at the bad write
performance (finally). As a quick and dirty test:

# time mkfile 512m speedtest

hfs: real       0m5.564s
zfs: real       0m21.247s

Ouch!

mkfile simply calls write(), which calls VNOP_WRITE(), which calls
zfs_vnop_write() or hfs_vnop_write(). Some IO size difference of course;
zfs uses 128KB transfer chunks, but interestingly, changing recordsize
makes no impact.


So I spent two days taking apart our vnops, the dmu, the txg, zio, vdev and
vdev_disk (even condvar, in case the signalling was wrong) looking for
where it might be slow. No real progress.

Then I thought I would simply things by cutting out half the problem
(userland and syscall entry), so I could focus on the ZFS internals. I
cooked up a simple write-from-kernel-thread:

https://gist.github.com/lundman/3d7d952b77b31e9bb45afcd69ef42b26

Just vn_open() and call vn_rdwr() in a loop, until 512MB in size.

Only to have this outcome:


2018-03-27 08:44:20.695647+0000 <zfs`write_test> write_test start 16315
2018-03-27 08:44:20.695963+0000 <zfs`write_test> vn_open(): 0
2018-03-27 08:44:22.591186+0000 <zfs`write_test> write_test done 16504
2018-03-27 08:44:22.591188+0000 <zfs`write_test> write_test delta 189

-rw-r--r--  1 root  wheel   512M Mar 28 09:01 speedtest


Which is about 3 seconds. That's nice and fast. vn_rdwr() calls
VNOP_WRITE(), which calls zfs_vnop_write(), so everything below, dmu, txg,
zio, vdev and vdev_disk (and condvars!) are just fine, and pretty fast.

So the calls to VNOP_WRITE() is being slowed down?


* Does XNU then have a write throttle?


'grep'ping for throttle in both XNU and HFS shows many hits, so it would
seem so, I just assumed they were thread throttles (from the name).

We understand we will always be second class citizens in XNU, but surely we
can do something to integrate better with the XNU ecosystem? Some sort of
animal (or beverage) sacrifice?


* Are there documentation/examples on the write throttle?


We clearly must be doing something WRONG after all, throw us a bone people!

Cheers,

Lund

--
Jorgen Lundman       | <email@hidden>
Unix Administrator   | +81 (0)90-5578-8500
Shibuya-ku, Tokyo    | Japan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: XNU write throttle?
      • From: Jorgen Lundman <email@hidden>
  • Prev by Date: Re: APFS root filesystem. All files' inode id have offset of 0x200000000
  • Next by Date: Re: How to use mandatory file locking on afpfs volumes
  • Previous by thread: Re: APFS root filesystem. All files' inode id have offset of 0x200000000
  • Next by thread: Re: XNU write throttle?
  • Index(es):
    • Date
    • Thread