How thread-friendly is kevent?

Adrian Chadd adrian at freebsd.org
Thu Nov 13 01:23:16 UTC 2014


On 12 November 2014 15:54, J David <j.david.lists at gmail.com> wrote:
> On Wed, Nov 12, 2014 at 5:31 PM, K. Macy <kmacy at freebsd.org> wrote:
>> Well, this was 8 cores with 45 or so processes.
>
> Here's the bench test on a 16 (physical) core machine with 24 threads:
>
> Server thread ends after 853093 events.
> Server thread ends after 834169 events.
> Server thread ends after 826117 events.
> Server thread ends after 824130 events.
> Server thread ends after 826998 events.
> Server thread ends after 838043 events.
> Server thread ends after 859163 events.
> Server thread ends after 844742 events.
> Server thread ends after 821916 events.
> Server thread ends after 807776 events.
> Server thread ends after 805819 events.
> Server thread ends after 840685 events.
> Server thread ends after 847173 events.
> Server thread ends after 834560 events.
> Server thread ends after 833862 events.
> Server thread ends after 842143 events.
> Server thread ends after 866425 events.
> Server thread ends after 813094 events.
> Server thread ends after 833364 events.
> Server thread ends after 805277 events.
> Server thread ends after 816654 events.
> Server thread ends after 834174 events.
> Server thread ends after 851322 events.
> Server thread ends after 839701 events.
>
> This particular test is CPU bound, so more threads don't make much
> sense, but they also don't make much difference as far as balance.
> The results are equally even with 128 threads, though the time wasted
> in kqflxw and context switching is *enormously* larger, aptly
> demonstrating what John-Mark was talking about.
>
> So it seems fairly scalable, at least as of 9.3-STABLE.  Good work,
> whoever it was!

Have you done any profiling of the system? At that many CPUs I'd
expect you'd see the shared kqueue fileops lock causing some
contending.

Hopefully the RSS stuff is mature enough in -11 for you to consider
using. I'm trying to address both work load balancing / steering as
well as CPU affinity scaling issues.

I'd love to see this stuff presented at a BSD conference. Are you at
all interested in talking some more about it?



-adrian


More information about the freebsd-questions mailing list