Board index » kylix » Some questions about threads and sockets.

Some questions about threads and sockets.


2005-04-16 01:13:06 PM
kylix1
Hi all.
I am working on various services, all involving threads and sockets.
My first question is about NPTL threads.
I've been googling around, and it seems that it is /creation/
and /destroying/ threads, that are improved.
Is that correct?
Since i use thread pooling, it (allmost) doesn't matter about the speed of
creation/destroying threads.
For now, i have tested my application on Kernel 2.6.8 - glibc 2.3.4, and i
works.
Given the Kylix situation, does anybody have a clue on how long the 'old'
thread model will be maintained/supported in glibc?
For now, i use 1:1 model with threads and sockets. It works, and works fast,
so maybe it's ok. But i would like to know if there is some
statistics/experience about the optimal number of sockets/thread.
Does anybody have input on this?
--
Best regards
Stig Johansen
 
 

Re:Some questions about threads and sockets.

Stig,
Quote
I am working on various services, all involving threads and sockets.
My first question is about NPTL threads.
I've been googling around, and it seems that it is /creation/
and /destroying/ threads, that are improved.
Is that correct?
This is one of the areas where most speedups are gained. But that's not all.
In real-life scenarios, NPTL threads are up to 3 times faster than the
old 2.4 LinuxThreads.
Quote
For now, i have tested my application on Kernel 2.6.8 - glibc 2.3.4, and i
works.
Given the Kylix situation, does anybody have a clue on how long the 'old'
thread model will be maintained/supported in glibc?
Well, "forever". libphtread, which is used by Kylix, binds to LinuxThreads on
Kernel 2.4 and to NPTL on Kernel 2.6. If you are running your application
under a 2.6.8 kernel, you probably already are using NPTL without knowing it.
From Kylix' perspective, there is nothing to change and nothing to worry about
- as long as you don't use TThread.suspend on a already running thread.
Quote
For now, i use 1:1 model with threads and sockets. It works, and works fast,
so maybe it's ok. But i would like to know if there is some
statistics/experience about the optimal number of sockets/thread.
Does anybody have input on this?
With NPTL it doesn't really matter anymore. Running 100.000 concurrent threads
no longer is an issue.
All in all: This is one of the areas regarding Kylix where there is no need
to be worried about the future.
Simon
 

Re:Some questions about threads and sockets.

Simon Kissel wrote:
Thanks Simon,
Quote
>I am working on various services, all involving threads and sockets.
>My first question is about NPTL threads.
>I've been googling around, and it seems that it is /creation/
>and /destroying/ threads, that are improved.
>Is that correct?

This is one of the areas where most speedups are gained. But that's not
all. In real-life scenarios, NPTL threads are up to 3 times faster than
the old 2.4 LinuxThreads.
Do you have any info/link about (optimized?) memory usages?
Espcially regarding Kylix & threads. I have been googling around for NPTL
info, and i think i saw somewhere, that in order to reach the high number
of threads (200K), the stack was limited to 4K.
Quote

>For now, i have tested my application on Kernel 2.6.8 - glibc 2.3.4, and
>i works.
>Given the Kylix situation, does anybody have a clue on how long the 'old'
>thread model will be maintained/supported in glibc?

Well, "forever". libphtread, which is used by Kylix, binds to LinuxThreads
on Kernel 2.4 and to NPTL on Kernel 2.6. If you are running your
application under a 2.6.8 kernel, you probably already are using NPTL
without knowing it.
Actually, the 'dist'[1] uses the old linuxthreads, according to
# getconf GNU_LIBPTHREAD_VERSION
linuxthreads-0.10
Quote
From Kylix' perspective, there is nothing to change and nothing to worry
about - as long as you don't use TThread.suspend on a already running
thread.
The problem is that i *do* use suspend/resume. I know there
was some talk about this some time ago. (I've tried googling, but i can't
find it).
I guess, that my question should be:
When is it time to redesign my applications - or the TThread class?
Quote

>For now, i use 1:1 model with threads and sockets. It works, and works
>fast, so maybe it's ok. But i would like to know if there is some
>statistics/experience about the optimal number of sockets/thread.
>Does anybody have input on this?

With NPTL it doesn't really matter anymore. Running 100.000 concurrent
threads no longer is an issue.
Maybe it /is/ time to consider NPTL?
Quote
All in all: This is one of the areas regarding Kylix where there is no
need to be worried about the future.
Basically, i'm not worried about Kylix. I do however have a problem with the
xerces stuff. In order to have it running on my SuSE 8.2 - boxe's, i had to
do some hex edit in the (Borland-)libraries. I'm no way {*word*155} Linux, so
it took me a loong time to find a solution. So for the time being, i don't
dare upgrading my working machines.
[1] In order to avoid upgrade, i use a bootable mini system to test.
--
Best regards
Stig Johansen
 

{smallsort}

Re:Some questions about threads and sockets.

Are you saying that NPTL threads don't have the context swap issue that
shows it's ugly head under win32?
100,000 threads would kill a windows server.
Quote

With NPTL it doesn't really matter anymore. Running 100.000 concurrent threads
no longer is an issue.

All in all: This is one of the areas regarding Kylix where there is no need
to be worried about the future.

Simon
 

Re:Some questions about threads and sockets.

Tony Caduto < XXXX@XXXXX.COM >wrote in
Quote
Are you saying that NPTL threads don't have the context swap issue that
shows it's ugly head under win32?
100,000 threads would kill a windows server.
But 100,000 fibers wont....
Blog: blogs.atozed.com/kudzu
 

Re:Some questions about threads and sockets.

Chad,
Is the super core stuff working reliably yet?
Quote


But 100,000 fibers wont....


--
Chad Z. Hower (a.k.a. Kudzu) - www.hower.org/Kudzu/
"Programming is an art form that fights back"

Blog: blogs.atozed.com/kudzu
--
Tony Caduto
AM Software Design
Home of PG Lightning Admin for Postgresql 8.x
www.amsoftwaredesign.com
 

Re:Some questions about threads and sockets.

tony < XXXX@XXXXX.COM >wrote in
Quote
Chad,
Is the super core stuff working reliably yet?
Not yet. But we plan to use it in IntraWeb 8 - so I guess I'll have to get
working on it. :)
Blog: blogs.atozed.com/kudzu