Comet connections exhaust threads in the thread pool

79 views
Skip to first unread message

Andrey Osipov

unread,
Mar 17, 2011, 1:46:55 PM3/17/11
to aspComet
I'm testing aspComet on a small chat application.

Everything works correctly when number of connected users below 8.

When 8 or more clients open the chat page application stops working
correctly.

Each next request to the server doesn't receive a response from the
server before long-polling connections are
refreshed.

I monitored connections to the server using Fiddler:
1. Eight clients open 8 long-polling connections to comet.axd/connect.
2. I submit a new text message in the chat window and client send the
message to comet.axd.
3. Server doesn't receive text message and I don't catch a break point
in BeginProcessRequest.
4. Long-polling connections are closed by the server (every 10
seconds).
5. After long-polling connections are closed - server receives our
text message (sent on step 2).

Looks like ASP.NET can' get a thread from the thread pool to process
new requests.

I had a suspicious it can be caused by the timer (in Cilent.cs) and
replaced standard timer by a custom timer which uses custom thread
pool from DevelopMentor. That didn't help.

Neil Mosafi

unread,
Mar 17, 2011, 3:15:49 PM3/17/11
to aspc...@googlegroups.com

Hi
That is interesting. Are you running under IIS or another web server?

Andrey Osipov

unread,
Mar 17, 2011, 3:23:29 PM3/17/11
to aspComet
IIS 7.5

I'm checking on a SharePoint application page (I don't think
SharePoint make something with thread pool but I can check it tomorrow
on a clear ASP.NET page)

On 17 мар, 22:15, Neil Mosafi <nmos...@gmail.com> wrote:
> Hi
> That is interesting. Are you running under IIS or another web server?
> > pool from DevelopMentor. That didn't help.- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -

Neil Mosafi

unread,
Mar 17, 2011, 4:51:39 PM3/17/11
to aspc...@googlegroups.com
Can you check the IIS performance counters they will tell you if any requests are being queued up?

I can't see how this happening because nothing is blocking any threads in the framework (this is the point of aspComet!).  What happens if you try changing the threadpool size ThreadPool.SetMaxThreads out of interest?  Is there anything else in the app pool which might be using up threads?



2011/3/17 Andrey Osipov <kubu...@gmail.com>

Andrey Osipov

unread,
Mar 18, 2011, 6:05:27 AM3/18/11
to aspComet
I tried to check the issue on the chat example from the aspComet
library - the same situation.
When I'm checking, I'm connecting to the server from different
computers using different browsers.

I can connect about 8 users and it works correctly, but if I try to
connect more users - server doesn't handle requests. Looks like
requests are queued.
I can't even open a static html file, server just doesn't respond.

But it's not the ThreadPool. I changed number of threads in the pool
to 150, it didn't help.
I tried to run chat on the ASP.NET Development Server - it works
better (more simultaneous connections, but problem still appears with
15 connections).

I'm using Visual Studio 2010, Window 7 x64, IIS 7.5.7600.16385.

Also I tested it on Windows 2008 R2 - same results.

Probably the problem is in the server configuration. I tried to run
PokeIn IIS Tuner to create an optimezed Application Pool - nothing
changed.


On 17 мар, 23:51, Neil Mosafi <nmos...@gmail.com> wrote:
> Can you check the IIS performance counters they will tell you if any
> requests are being queued up?
>
> I can't see how this happening because nothing is blocking any threads in
> the framework (this is the point of aspComet!).  What happens if you try
> changing the threadpool size ThreadPool.SetMaxThreads out of interest?  Is
> there anything else in the app pool which might be using up threads?
>
> 2011/3/17 Andrey Osipov <kubuz...@gmail.com>
> > > - Показать цитируемый текст -- Скрыть цитируемый текст -

Symon Rottem

unread,
Mar 18, 2011, 7:50:18 AM3/18/11
to aspc...@googlegroups.com
Is there any chance that the limitation on browser threads is the problem here (often limited to two concurrent)?  If you use multiple windows of the same browser I'm not sure whether or not each one gets another two threads or not.  

The best way to be sure is to use multiple different hosts to be sure. You could certainly try using more browsers by different manufacturers, but installing Chrome, IE, Firefox, Opera, (others) just so you can have one open for each test might be bit a pain by comparison.

Just a thought.

Cheers,

Symon.
 
Symon Rottem
http://blog.symbiotic-development.com


2011/3/18 Andrey Osipov <kubu...@gmail.com>

Neil Mosafi

unread,
Mar 18, 2011, 8:05:26 AM3/18/11
to aspc...@googlegroups.com

You sure it's not iis express you are using. It any concurrent request limits in there?

On Mar 18, 2011 10:05 AM, "Andrey Osipov" <kubu...@gmail.com> wrote:

Andrey Osipov

unread,
Mar 18, 2011, 8:16:15 AM3/18/11
to aspComet
Thanks for reply, Symon.

I installed Chrome, FF, IE and Opera on 4 client computers and tried
to connect to the chat page. Only one connection per a browser. The
problem is here, only about 8 connections works correctly.

On 18 мар, 14:50, Symon Rottem <s.rot...@gmail.com> wrote:
> Is there any chance that the limitation on browser threads is the problem
> here (often limited to two concurrent)?  If you use multiple windows of the
> same browser I'm not sure whether or not each one gets another two threads
> or not.
>
> The best way to be sure is to use multiple different hosts to be sure. You
> could certainly try using more browsers by different manufacturers, but
> installing Chrome, IE, Firefox, Opera, (others) just so you can have one
> open for each test might be bit a pain by comparison.
>
> Just a thought.
>
> Cheers,
>
> Symon.
>
> Symon Rottemhttp://blog.symbiotic-development.com
>
> 2011/3/18 Andrey Osipov <kubuz...@gmail.com>

Andrey Osipov

unread,
Mar 18, 2011, 8:19:32 AM3/18/11
to aspComet
My main computer for testing is running under Windows 7, IIS
7.5.7600.16385.
Also I tried on Windows 2008 R2, IIS 7.5.7600.16385.

On 18 мар, 15:05, Neil Mosafi <nmos...@gmail.com> wrote:
> You sure it's not iis express you are using. It any concurrent request
> limits in there?
> On Mar 18, 2011 10:05 AM, "Andrey Osipov" <kubuz...@gmail.com> wrote:

Andrey Osipov

unread,
Mar 18, 2011, 8:22:09 AM3/18/11
to aspComet
Strange thing the chat can handle more than 10 users when I run it on
ASP.NET Development Server. It starts to crack when I connect 15
users, but evidently it works better.

Andrey Osipov

unread,
Mar 18, 2011, 9:17:31 AM3/18/11
to aspComet
Good news, chat is working on Windows 2008 R2.
Probably Windows 7 as a client OS has any limitations...
Did anyone run the chat application successfully with more than 10
users on Windows 7?

Symon Rottem

unread,
Mar 18, 2011, 10:59:50 AM3/18/11
to aspc...@googlegroups.com
Yup - you nailed it: http://www.jpelectron.com/sample/WWW%20and%20HTML/IIS-%20OS%20Version%20Limits.htm

Cheers,

Symon.

Symon Rottem
http://blog.symbiotic-development.com


2011/3/18 Andrey Osipov <kubu...@gmail.com>
Good news, chat is working on Windows 2008 R2.
Reply all
Reply to author
Forward
0 new messages