Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2005 11:31:10 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        David Xu <davidxu@freebsd.org>
Cc:        Marc Olzheim <marcolz@stack.nl>, Daniel Eischen <deischen@freebsd.org>, arch@freebsd.org
Subject:   Re: libc_r is deprecated
Message-ID:  <20051027112622.O32255@fledge.watson.org>
In-Reply-To: <436027E6.8080604@freebsd.org>
References:  <Pine.GSO.4.43.0510241948130.17636-100000@sea.ntplx.net> <20051025120538.K52058@fledge.watson.org> <435E2DCF.6080809@freebsd.org> <20051025134834.GB62148@stack.nl> <435EBD49.7090207@freebsd.org> <20051026120219.V32255@fledge.watson.org> <436027E6.8080604@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, 27 Oct 2005, David Xu wrote:

> You sample program is nothing to do with libpthread or libthr, you never 
> have userland locking code, in kernel they should be same, in fact. I 
> have done a simple test, on my dual PIII machine, libthr is faster than 
> libpthread, if I use ULE, libpthread is far behind than libthr, I 
> recommend you to try different file sizes, I have got very different 
> result, for small file size, e.g /usr/src/sys/sys/umtx.h, libthr beats 
> libpthread, I can not test big file, because my 100M network is very 
> easy to be saturated.
>
> If you suspect fd locking overhead, try to use fork() model, though it 
> will introduce more context switch overhead, but it still worthy to do.

Well, I think the significant difference is the scheduling of when work is 
requested: specifically, that libthr with our current scheduler 
necessarily results with a process competing more with itself for locks 
associated with the process than libpthread, which tries not to run 
additional threads unless there's a gap in current execution by a current 
thread.  The question, I suppose, is whether the answer to this problem 
lies in:

- Helping the scheduler do a better job of discouraging that scenario.

- Working to change the file descriptor model to reduce the
   impact of contention.

- Accepting that it's inevitable in the threading model and looking for
   other things to improve.

I would like to run the following additional tests:

- Create a forked httpd microbenchmark to see what impact that has.  I
   suspect a performance improvement.

- Experiment with reducing contention on the file descriptor lock through
   hacking a bit on how file descriptor arrays work -- nothing
   production-worthy, but something that changes the potential contention
   enough to see if it helps.  I.e., break the array into two parts locked
   using different locks.

- Use ktrace, mutex profiling, or pmc to try and evaluate whether
   contention on the lock really is the cause.  Alternatively, to roughly
   attempt to profile wait times for that lock.

Robert N M Watson



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051027112622.O32255>