Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-36610

Investigate using eventfd() for inter-thread notification

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 7.1.0
    • 6.5.0
    • memcached
    • None

    Description

      Currently we use a pair of sockets to notify a memcached frontend thread when there's an event to handle (notify_IO_complete).

      We should investigate using the more modern eventfd functionality which is more lightweight. A patch was briefly merged to switch to eventfd (via libevent's higher-level abstraction - see http://review.couchbase.org/#/c/116587/) however this resulted in a performance regression in very write-heavy workloads: numbers from daily performance runs (KV : Pillowfight, 20/80 R/W, 256B
      binary items) shows that this actually reduces performance by ~2%
      (see build 4631 vs 4632).

      A brief look at the libevent code suggests this is due to event_active() needing to acquire the per-event base mutex, which wasn't the case with the previous implementation which just wrote to an FD.

      We could either implement eventfd() support "manually" - i.e. create an eventfd file descriptor instead of socketpair when supported, and write the correct type of write; or use folly::EventBase which is a C++ OO wrapper around libevent and already supports eventfd via NotificationQueue.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              trond Trond Norbye
              drigby Dave Rigby (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty