原文:https://www.flamingspork.com/projects/libeatmydata/

libeatmydata is a small LD_PRELOAD library designed to (transparently) disable fsync (and friends, like open(O_SYNC)). This has two side-effects: making software that writes data safely to disk a lot quicker and making this software no longer crash safe.

DO NOT use libeatmydata on software where you care about what it stores. It's called libEAT-MY-DATA for a reason.

Source

I've recently been migrating things over to git from the old BZR repository.

Git repositories are on launchpad and github

Grab the latest by just doing git clone https://github.com/stewartsmith/libeatmydata.git - although most Linux distros package libeatmydata as eatmydata

Download: The launchpad download page has all the latest libeatmydata downloads.

You can also download the source tarball from here: libeatmydata-105.tar.gz and GPG signature: libeatmydata-105.tar.gz.asc.

Install

If installing from source, do the following:

  1. git clone https://github.com/stewartsmith/libeatmydata.git (or extract from source tarball)
  2. cd libeatmydata
  3. autoreconf -i (if building from git only)
  4. ./configure
  5. make
  6. make check
  7. sudo make install

Using

Once libeatmydata is installed (either from a package or from source like above, simply run the eatmydata wrapper script:

  • eatmydata foo

Platform Support

I use it primarily on Linux. Others have reported success on MacOS X, OpenSolaris, Solaris, Debian GNU/kFreeBSD. Patches welcome!

Contributing

You can email me directly with patches. Development is hosted on launchpad and has been transitioning to github.

Performance Improvements

Running mysql-test-run --do-test=innodb without/with libeatmydata:

TEST                           RESULT         TIME (ms)   TIME (with libeatmydata)
-------------------------------------------------------------------------------+++

main.innodb-lock               [ pass ]           4523     4323
main.innodb-replace            [ pass ]            102       56
main.innodb-ucs2               [ pass ]           5786     1084
main.innodb                    [ pass ]          78306    24900
main.innodb_gis                [ pass ]           2647     1544
main.innodb_mysql              [ pass ]          86810    68579
main.innodb_notembedded        [ pass ]            198      150
main.innodb_timeout_rollback   [ pass ]           2990     2750
main.innodb_trx_weight         [ pass ]           1608      841
------------------------------------------------------------+++
Stopping All Servers
All 9 tests were successful.
The servers were restarted 7 times

WITHOUT: Spent 182.97 seconds actually executing testcases
WITH   : Spent 104.227 seconds actually executing testcases

WITHOUT:               WITH:
real    3m36.053s      real    2m10.610s
user    0m42.323s      user    0m41.939s
sys     0m2.844s       sys     0m2.356s

This saves us about a third of the total runtime!