|
List Info
Thread: understanding ns_pools behaviour on 4.5
|
|
| understanding ns_pools behaviour on 4.5 |

|
2007-09-14 03:11:50 |
|
I have a pool defined in config.tcl as:
ns_pools set procmsgmgr -maxconns 5 -maxthreads 200 -minthreads 50 -timeout 120
when i start the server ns_pools get procmsgmgr command returns:
nspools=minthreads 50 maxthreads 200 idle 50 current 50 maxconns 5 queued 0 timeout 120
after the server starts to service some 48 requests the stats shows:
nspools=minthreads 50 maxthreads 200 idle 50 current 50 maxconns 5 queued 48 timeout 120
As the server receives the first connection queued value is also incremented.
After serving about 255 request the ns_pools get returns the following:
nspools=minthreads 50 maxthreads 200 idle 25 current 25 maxconns 5 queued 225 timeout 120
When i observe the ns_pools number the queued value increases as new requests arrives.
idle counts keep dropping until it reaches 1, does it mean there's nothing and all threads that were started at server startup are dead?
In above case what does queued value means, why its keep going up. Am i making some mistake in my tcl code.
regards, shedis
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <listserv listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
|
| Re: understanding ns_pools behaviour on
4.5 |

|
2007-09-14 09:36:11 |
On 2007.09.14, Tom Jackson <tom RMADILO.COM> wrote:
> On Friday 14 September 2007 06:58, Shedi Shedi wrote:
> > I check the docs and previous posts regarding
maxconns, that it is the
> > number of connections that will be served by a
single thread before it
> > dies.
>
> Yeah, I think this is right. maxthreads indicates how
many you can
> service at once. I thought there would be a number
indicating when to
> stop queueing new conns, maybe it is ns_limits.
Yeah, oops--maxconns is the number of requests a thread
should service
before it exits. ns_limits should control request
processing limits,
oops.
So, the question is ... what ns_limits does Shedi have
configured?
-- Dossy
--
Dossy Shiobara | dossy panoptic.com | http://dossy.org/
Panoptic Computer Network | http://panoptic.com/
"He realized the fastest way to change is to laugh at
your own
folly -- then you can let go and quickly move on."
(p. 70)
--
AOLserver - http://www.aolserver.com/
a>
To Remove yourself from this list, simply send an email to
<listserv listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message.
You can leave the Subject: field of your email blank.
|
|
| Re: understanding ns_pools behaviour on
4.5 |

|
2007-09-14 09:12:42 |
On Friday 14 September 2007 05:02, Dossy Shiobara wrote:
> queued show show many pending connections are waiting
in queue to be
> handed off to a worker thread.
I noticed this number just goes up also. I think, at least
as it works right
now that queued means how many total connections have come
through the queue.
Also, if you set the number of conns to 0, the driver still
hands off the
connections to the queue, but they just sit there. Probably
maxconns should
be > 0. If maxthreads is lowered during operation, the
extra threads will not
exit until after they service another conn.
And I think John Buckman found a bug in this same section of
code, which maybe
he fixed. Finally there is a small change I made to name the
connection
threads after the threadpool which handles them. Maybe we
(John and I) should
create a small update for this section of code, probably a
two line change.
tom jackson
--
AOLserver - http://www.aolserver.com/
a>
To Remove yourself from this list, simply send an email to
<listserv listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message.
You can leave the Subject: field of your email blank.
|
|
| Re: understanding ns_pools behaviour on
4.5 |

|
2007-09-21 02:19:15 |
|
Thanks for the explanations but i'm still confused by the numbers shown by my ns_pools:
ns pool config: ns_pools set procmsgmgr -maxconns 150 -maxthreads 500 -minthreads 300 -timeout 60
At peak times when i look at the pools it shows that idle=1 and current=1
nspools=minthreads 300 maxthreads 500 idle 1 current 1 maxconns 150 queued 57036 timeout 60
Does this mean all threads are busy except 1? Also the values for idle and current remains the same even under non-peak hours.?
Answering Dossy question: >>So, the question is ... what ns_limits does Shedi have configured? I didn't know about this parameter. and currently not used in my config.tcl.
>>How are you closing the socket?
Following code block uses ns_conn write and ns_conn close command to terminate the connection:
# Sent response quickly set retstring "HTTP/1.0 201 CreatednContent-Type: application/x-tcl-listnConnection: closennSUCCESS"
set sockwrite [ns_write $retstring]; ns_conn close if {!$sockwrite} { incrstat recd_error; ns_log warning "$proc Client connection: ABNORMAL-TERMINATION"
return -code ok; } incrstat recd_success; ns_log debug "$proc Client connection: NORMAL-TERMINATION"; set msgbytes [ns_conn contentlength]; incrstat msgin_bytes $msgbytes;
....... ......... Further processing of client';s data continues. .......... Typically client data is validated and written to a text file here.
Perhaps i shall start a new thread to process the client';s data. This way i can return the connection thread back to connection pool much faster. Any suggestions?
kind regards, Shedis
On 9/15/07, Dossy Shiobara < dossy panoptic.com">
dossy panoptic.com> wrote:On 2007.09.14, Shedi Shedi < shedis gmail.com">
shedis gmail.com> wrote: > I check the docs and previous posts regarding maxconns, that it is the > number of connections that will be served by a single thread before > it dies.
Yes, I was incorrect about this. Thanks for the correction.
> also the queued value always increases, when a new request arrives the > queue value is incremented. But it never goes downwards.
Based on a quick scan of the source, this appears to be correct: the
queued counter is only incremented.
> Does this mean the queue contains that many number of request or the > number of request which have been served?
It appears to count the number of requests queued to the pool.
> Both current and idle, when server is started their value is set from config > file. e.g. if i set min to 100 then the current and ilde has 100. But at > that point there's no request why does current returns 100?
current indicates the current number of threads in the pool. Current should never drop below min and never exceed max. If current == idle, then all threads are idle. If idle == 0, then all current threads are
busy servicing a request.
> Note: I have a proc that handles the incoming message and as soon as the > message is received, client is sent a success code followed by socket > closure. Next the proc performs the rest of the work and return.
How are you closing the socket?
Until the thread is returned to the pool, it's considered "active" even if there's no client connected on the other end. Until the thread';s processing is complete, it isn't returned back to the pool, and
therefore cannot handle another request.
-- Dossy
-- Dossy Shiobara | dossy panoptic.com">dossy panoptic.com | http://dossy.org/ Panoptic Computer Network |
http://panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)
-- AOLserver -
http://www.aolserver.com/
To Remove yourself from this list, simply send an email to < listserv listserv.aol.com">listserv listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <listserv listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
|
| Re: understanding ns_pools behaviour on
4.5 |

|
2007-10-01 09:45:42 |
|
Hi Dossy,
You said that current should never drop below min. But in my case after threads have serviced configured number of requests they start to die. idle and current keeps dropping until 0 and never comes up again.
The server logs shows lines like: [01/Oct/2007:16:41:43][20634.3027639200][-conn:335-] Notice: exiting: exceeded max connections per thread [01/Oct/2007:16:42:19][20634.3027499936][-conn:336-] Notice: exiting: exceeded max connections per thread
[01/Oct/2007:16:42:37][20634.3027360672][-conn:337-] Notice: exiting: exceeded max connections per thread
It looks like as threads begin to die after servicing 150 requests no new threads are created.
nspool output at the start of the server:
nspools=minthreads 400 maxthreads 500 idle 400 current 400 maxconns 150 queued 11 timeout 60
nspools output showing when idle and current are at 1: nspools=minthreads 400 maxthreads 500 idle 1 current 1 maxconns 150 queued 56,679 timeout 60
Can anyone point out what i'm going wrong here. Why the new threads are not being created in the pool?
kind regards,
On 9/15/07, Dossy Shiobara
< dossy panoptic.com">dossy panoptic.com> wrote:> Both current and idle, when server is started their value is set from config
> file. e.g. if i set min to 100 then the current and ilde has 100. But at > that point there's no request why does current returns 100?
current indicates the current number of threads in the pool. Current
should never drop below min and never exceed max. If current == idle, then all threads are idle. If idle == 0, then all current threads are busy servicing a request.
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <listserv listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
|
| Re: understanding ns_pools behaviour on
4.5 |

|
2007-10-01 11:50:57 |
You're not doing anything wrong. You have a thread timeout.
So after 60
seconds, the idle thread exits. Maybe there is a bug in
pools.c, but what is
happening is that at startup, minthreads are created. If you
go in and
increase minthreads after starup of the pool, the minthreads
will not
increase, ever. But if new requests come in, new threads
will be created.
They are probably being serviced so fast that you never get
too many at once
showing up. If this isn't the case, then it could be a
problem.
So maybe play around with the timeout value, maybe if it is
zero they don't
timeout. If you want threads to exit at some point, use
maxconnections to
make them exit.
So the problem is very likely that as maxconns is reached,
threads are
deleted, but there is never any check that numthreads have
fallent below a
minimum value. Hopefully you will reach a number of threads
necessary to
service the requests without going over maxthreads, but
minthreads appears to
be only a hint for startup, after that the threadpools
regulates itself to
minimum resources. However...does it ever reach zero,
because if it does, I
have noticed that the threadpool no longer responds to
requests. This would
be a definite bug.
tom jackson
On Monday 01 October 2007 07:45, Shedi Shedi wrote:
> You said that current should never drop below min. But
in my case after
> threads have serviced configured number of requests
they start to die. idle
> and current keeps dropping until 0 and never comes up
again.
>
> The server logs shows lines like:
> [01/Oct/2007:16:41:43][20634.3027639200][-conn:335-]
Notice: exiting:
> exceeded max connections per thread
> [01/Oct/2007:16:42:19][20634.3027499936][-conn:336-]
Notice: exiting:
> exceeded max connections per thread
> [01/Oct/2007:16:42:37][20634.3027360672][-conn:337-]
Notice: exiting:
> exceeded max connections per thread
>
> It looks like as threads begin to die after servicing
150 requests no new
> threads are created.
>
> nspool output at the start of the server:
>
> nspools=minthreads 400 maxthreads 500 idle 400 current
400 maxconns 150
> queued 11 timeout 60
>
> nspools output showing when idle and current are at 1:
> nspools=minthreads 400 maxthreads 500 idle 1 current 1
maxconns 150 queued
> 56,679 timeout 60
>
> Can anyone point out what i'm going wrong here. Why the
new threads are not
> being created in the pool?
>
> kind regards,
>
> On 9/15/07, Dossy Shiobara <dossy panoptic.com> wrote:
> > > Both current and idle, when server is started
their value is set from
> >
> > config
> >
> > > file. e.g. if i set min to 100 then the
current and ilde has 100. But
> > > at that point there's no request why does
current returns 100?
> >
> > current indicates the current number of threads in
the pool. Current
> > should never drop below min and never exceed max.
If current == idle,
> > then all threads are idle. If idle == 0, then all
current threads are
> > busy servicing a request.
>
> --
> AOLserver - http://www.aolserver.com/
a>
>
> To Remove yourself from this list, simply send an email
to
> <listserv listserv.aol.com> with the body of
"SIGNOFF AOLSERVER" in the
> email message. You can leave the Subject: field of your
email blank.
--
AOLserver - http://www.aolserver.com/
a>
To Remove yourself from this list, simply send an email to
<listserv listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message.
You can leave the Subject: field of your email blank.
|
|
[1-6]
|
|