# NPTL experiences?

## Lucho[FLCL]

Hello everyone again!

I just wanted to know your experiences with NPTL. Is it worth the change? Are there any significant performance gains? What things do you need to recompile? Etc.

Thanks in advance for all you that answer   :Smile: 

----------

## Bowyakka

On an SMP computer with a new java it rocks, applications are running faster

Most applications feel a bit snappier, and a lot of developers havn't even to begin nptl optimising yet  :Smile: 

Go for it !

----------

## Lucho[FLCL]

Hehehe I don't have a SMP machine, just a PIII 550 Mhz...  :Cool: 

----------

## asimon

My expieriences:

* It breaks many things (like glibc doesn't pass all threading tests when doing make check)

* It has zero impact on my desktop performance

----------

## Bowyakka

On my Uni-processor laptop the gains did not feel so greate , I didn't notice it breaking glibc checks though

----------

## teutzz

for hardening a bit your system is great (randomizing pids) also for java, either you a have an uniprocessor or dual-processor system.

----------

## RotoCoto

 *Lucho[FLCL] wrote:*   

> Hello everyone again!
> 
> I just wanted to know your experiences with NPTL. Is it worth the change? Are there any significant performance gains? What things do you need to recompile? Etc.
> 
> Thanks in advance for all you that answer  

 

Using LD_ASSUME_KERNEL I tested with and without NPTL. Application

is a Java based server. Tried JDK 1.4.2 and 1.5.0. With NPTL on

my server thruput jumped ~ 2X. I was able to create > 5000 threads

in the server without much degradation due to context switching so

many threads.

With old linux threads  my Java server was unable to go beyond 1000 threads. NPTL make huge number of threads very scalable. In another

article on this site I will post some performance numbers with NPTL, epoll, NIO and Java.

-Rahul Bhargava

----------

## bk0

 *Lucho[FLCL] wrote:*   

> Hello everyone again!
> 
> I just wanted to know your experiences with NPTL. Is it worth the change? Are there any significant performance gains? What things do you need to recompile? Etc.
> 
> Thanks in advance for all you that answer  

 

Switching to NPTL is simple and painless if you already use a 2.6 kernel. Simply add "nptl" to your USE flags, install 2.6 headers and re-emerge glibc. So far I've had nothing break, not even the Sun JRE (though I switched to 1.5.0b2 just in case). Haven't noticed much of a performance difference but I haven't done any benchmarking either.

I'm using 2.6.3-r1 headers, 2.6.6 kernel and the latest unmasked glibc.

----------

## Suicidal

The only thing I have seen nptl and 2.6 headers break recently is sash on amd64. I had to reinstall this machine yesterday because I accidently did a mkfs.reiserfs to my XP part and it didnt want to boot off of the XP CD to reinstall. When I did reinstall I used 2.6.6 headers and nptl and I havent had any problems. Apache, mysql gnome mplayer, xmms are all working perfectly.

----------

## ryceck

I have 2.6 headers and nptl running @ my laptop for 2 weeks now...

Everything feels faster (openoffice, firefox) but that can also be caused by the strict CFLAGS and the prelinking. It didn't break anything at all so I wouldn't know why u shouldnt do it.

Just one tip.... If u switch to nptl and 2.6 headers... Install 2.6 headers, set ur use-flags in /etc/make.conf to USE="nptl" and re-emerge glibc and gcc. This is what I did and have never had any problems  :Smile: 

----------

## teutzz

and then recompile everything that is written in C or C++ (dependency on glibc)

for those who don't want a master headache 

```
emerge -e world
```

as if you don't do this some programs might break

----------

## bk0

 *teutzz wrote:*   

> and then recompile everything that is written in C or C++ (dependency on glibc)
> 
> for those who don't want a master headache 
> 
> ```
> ...

 

In my experience this isn't necessary. The vast majority of programs don't even use threads. YMMV.

----------

## R. Bosch

Compiled nptl with 2.6 headers and I find my machine much more responsive under loads like compiling...

Note:

I used to run 2.6 kernels before the nptl switch..

So I'd say pretty good   :Wink: 

----------

## zeek

It makes me feel better than I'm using 2.6 and NPTL but for any advantages well I didn't notice any.

btw you don't need to emerge 2.6 headers or recompile any apps after building a NPTL glibc either.  You do need to be running a 2.6 kernel though.

Also the LD_ASSUME_KERNEL=2.4.1 (or other old kernel version) trick doesn't work in Gentoo because a linuxthreads compatible glibc is not built and installed beside the NPTL one.  This is a shortcoming because if it worked you could point any incompatible apps at the linuxthreads glibc and continue on your merry way.  This is the biggest problem with switching to NPTL in Gentoo -- the escape hatch that other distros support via LD_ASSUME_KERNEL=2.4.1 doesn't work in Gentoo.

The command /lib/libc.so.6 will tell you what thread package you have installed (linuxthreads or NPTL). ie NPTL below:

```
char root # /lib/libc.so.6

GNU C Library stable release version 2.3.3, by Roland McGrath et al.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7).

Compiled on a Linux 2.6.6 system on 2004-06-12.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        NPTL 0.61 by Ulrich Drepper

        BIND-8.2.3-T5B

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Thread-local storage support included.

Report bugs using the `glibcbug' script to <bugs@gnu.org>.

```

----------

## asimon

 *zeek wrote:*   

> 
> 
> The command /lib/libc.so.6 will tell you what thread package you have installed (linuxthreads or NPTL). ie NPTL below:
> 
> 

 

Somehow I have the slight feeling that I should rebuild some things ...

```

# /lib/libc.so.6

Inconsistency detected by ld.so: rtld.c: 1259: dl_main: Assertion `_rtld_local._dl_rtld_map.l_prev->l_next == _rtld_local._dl_rtld_map.l_next' failed!

```

 :Wink: 

----------

## superjaded

NPTL is a VERY YMMV type thing right now. A few months ago I literally could not get into X with an nptl'd glibc. 

It works fine now, but the only real advantage is a slimmer ps aux ATM.  :Wink: 

----------

## Lance

 *Quote:*   

> ust one tip.... If u switch to nptl and 2.6 headers... Install 2.6 headers, set ur use-flags in /etc/make.conf to USE="nptl" and re-emerge glibc and gcc. This is what I did and have never had any problems

 

How to install 2.6 headers?

I am currently using 2.6.5-r1 kernel, but this is what's reported by running /lib/libc.so.6

GNU C Library stable release version 2.3.3, by Roland McGrath et al.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7).

Compiled on a Linux 2.4.21 system on 2004-06-11.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        linuxthreads-0.10 by Xavier Leroy

        BIND-8.2.3-T5B

        libthread_db work sponsored by Alpha Processor Inc

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Report bugs using the `glibcbug' script to <bugs@gnu.org>.

Thanks!

----------

## Lance

I see. Should be something like:

```

ACCEPT_KEYWORDS="~x86" emerge linux-headers
```

But do I need to use 2.6 header to use nptl?

----------

## teutzz

maybe more like ACCEPT_KEYWORDS="-*"

----------

## Lance

I switched to nptl, and I found Azureus became faster and can easily spawn 100s connections.

But mplayer broke and probably so did many other application. Trying to figure them out.

----------

## spb

 *Lance wrote:*   

> I see. Should be something like:
> 
> ```
> 
> ACCEPT_KEYWORDS="~x86" emerge linux-headers
> ...

 Using ACCEPT_KEYWORDS on the command line is a Bad Thing. You don't actually need 2.6 kernel headers to use NPTL, since it can build against sources in /usr/src if need be, but if you want to install them, then this is how:

```
mkdir -p /etc/portage

echo "sys-kernel/linux-headers -*" >>/etc/portage/package.keywords

emerge --oneshot linux-headers
```

----------

## Lance

BTW, I hadn't emerge linux-headers before emerge glibc and gcc. Probably it's not necessary. 

And after that, /lib/libc.so.6 reports:

```

GNU C Library stable release version 2.3.3, by Roland McGrath et al.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

Compiled by GNU CC version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6).

Compiled on a Linux 2.6.5-gentoo-r1 system on 2004-06-20.

Available extensions:

        GNU libio by Per Bothner

        crypt add-on version 2.1 by Michael Glad and others

        NPTL 0.61 by Ulrich Drepper

        BIND-8.2.3-T5B

        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk

Thread-local storage support included.

Report bugs using the `glibcbug' script to <bugs@gnu.org>.

```

----------

## Lance

 *Quote:*   

> 
> 
> Using ACCEPT_KEYWORDS on the command line is a Bad Thing. 
> 
> 

 

Thank you, thebell!

I've read a post by robmoss2k on this issue and have been following the suggested practice ever since. I wrote that way just for simplicity.

Thank you anyway!

----------

## miknight

 *Lance wrote:*   

> But mplayer broke and probably so did many other application. Trying to figure them out.

 

I had the same problem. After emerging glibc with nptl and recompiling mplayer it still didn't work. I solved this by recompiling gcc and THEN recompiling mplayer, and now it works fine.

----------

## ryszardzonk

Hi

There is another app that has "nptl" use flag. This is Wine. I wonder if it is nessesery to reemerge glibc with nptl before reemerging wine with it. It should be or not?  :Wink: 

And another one. Glibc-20040619 just showed up in ~x86. Any experiences with that one? Hope it is ok to upgrade   :Cool: 

----------

## teutzz

you'll have to first emerge glibc using the ntpl flag

----------

## Lance

I found that this is not a problem with nptl. Probably xine_lib_1_rc4 is buggy and when I upgrade to xin_lib_1_rc4_r1, the trouble with mplayer is gone.

----------

## u2mike

My system has always run rock stable. I've been using nptl ever since it was introduced in gentoo.

----------

## dan2003

My parents gone away for the week so i decided to try nptl on their machine along with 2.6.7-ck1 which i've had on mine for a week or so.

I think i found summin that breaks.. The control center in kde.. Click a module such as login manager, click administror mode, put the root passwd in the dialog, press eneter,  the module doesnt load, i assume it has something to do with the pid? dunno tho..

Can anybody verify this?

----------

## u2mike

Works fine here, but I'm using KDE3.3 Alpha so it might be something with the 3.2.x series....

----------

