Thursday, March 29, 2012

MaxConnections

I've written an HTTPHandler that implements IHttpAsyncHandler. This handler
makes a call to a webservice that will send back a byte[] to be sent back to
the webrowser as an image.
I've set the maxconnections setting on the web.config for the handler and
the webservice to:
<system.net>
<connectionManagement>
<add address="*" maxconnection="20"/>
</connectionManagement>
</system.net>
But when debugging I can see that it is still only making 2 requests at a
time. How can I make a handler that will allow for more than 2 requests at
a time.
TIASomeone correct me if I'm wrong, but there is a limit at the TCP/IP layer
that means you can only have two TCP/IP connections to the same machine on
the same port at a time. Point IE at a graphic-heavy site and you'll see it
downloads images 2 at a time. As this limit is at the TCP/IP layer you
can't control it from IIS or ASP.
"MattC" <m@.m.com> wrote in message
news:e38S7XhlHHA.3736@.TK2MSFTNGP03.phx.gbl...
> I've written an HTTPHandler that implements IHttpAsyncHandler. This
> handler makes a call to a webservice that will send back a byte[] to be
> sent back to the webrowser as an image.
> I've set the maxconnections setting on the web.config for the handler and
> the webservice to:
> <system.net>
> <connectionManagement>
> <add address="*" maxconnection="20"/>
> </connectionManagement>
> </system.net>
> But when debugging I can see that it is still only making 2 requests at a
> time. How can I make a handler that will allow for more than 2 requests
> at a time.
> TIA
>
>
>
Windows Server 2003 SP1 removed the need to set a higher limit for maxconnec
tions.
The number of simultaneous connections in W2K3 SP1 is now limited
only by available system resources or the MaxConnections registry entry.
You *can* set a higher number of connections in an unpatched Windows Server
2003:
Registry path
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\HTTP\Parameters
Registry entry
MaxConnections
Value Type
DWORD
Valid data value ranges for this entry are 0 to 4294967295.
Matt, you seem to have a typo :
<add address="*" maxconnection="20"/>
That should be :
<add address="*" maxconnections="20"/>
In any case, if you're running an unpatched W2K3, try setting the registry e
ntry, per the above.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Aidy" <aidy@.noemail.xxxa.com> wrote in message news:tOmdnZdpgPVu2tXbnZ2dnUVZ8taknZ2d@.bt
.co
m...
> Someone correct me if I'm wrong, but there is a limit at the TCP/IP layer
that means you can only
> have two TCP/IP connections to the same machine on the same port at a time
. Point IE at a
> graphic-heavy site and you'll see it downloads images 2 at a time. As thi
s limit is at the TCP/IP
> layer you can't control it from IIS or ASP.
> "MattC" <m@.m.com> wrote in message news:e38S7XhlHHA.3736@.TK2MSFTNGP03.phx.
gbl...
Juan,
Thanks but the limit is impossed by the web browsers request queue in this
case. So IE only ever makes 2 concurrent requests and will block until each
requests returns before sending the next.
I did find that altering:
HKEY_CURRENT_USER\Software\Microsoft\Win
dows\CurrentVersion\Internet
Settings\MaxConnectionsPerServer
and setting to 20 odd really helps, but that isn't somethign I can tell
users to do :s
Also I'm using .NET2.0 so the system.net entry is maxconnection, it
complains of unknown attribute with maxconnectionS.
regards
Matt
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:eHYlTCilHHA.5048@.TK2MSFTNGP04.phx.gbl...
> Windows Server 2003 SP1 removed the need to set a higher limit for
> maxconnections.
> The number of simultaneous connections in W2K3 SP1 is now limited
> only by available system resources or the MaxConnections registry entry.
> You *can* set a higher number of connections in an unpatched Windows
> Server 2003:
> Registry path
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\HTTP\Parameters
> Registry entry
> MaxConnections
> Value Type
> DWORD
> Valid data value ranges for this entry are 0 to 4294967295.
> Matt, you seem to have a typo :
> <add address="*" maxconnection="20"/>
> That should be :
> <add address="*" maxconnections="20"/>
> In any case, if you're running an unpatched W2K3, try setting the registry
> entry, per the above.
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaol : http://asp.net.do/foros/
> ======================================
> "Aidy" <aidy@.noemail.xxxa.com> wrote in message
> news:tOmdnZdpgPVu2tXbnZ2dnUVZ8taknZ2d@.bt
.com...
>
>
>
If I am undestanding correctly, you are talking about client connections,
and not server connections?
If so, this is an IE thing and can be altered only through the registry with
the Internet Settings\MaxConnectionsPerServer key.
I see Juan has jumped in as well. If it is server side, and you are using
Windows Server 2003, I would go there first.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
****************************************
*****
Think outside the box!
****************************************
*****
"MattC" <m@.m.com> wrote in message
news:e38S7XhlHHA.3736@.TK2MSFTNGP03.phx.gbl...
> I've written an HTTPHandler that implements IHttpAsyncHandler. This
> handler makes a call to a webservice that will send back a byte[] to be
> sent back to the webrowser as an image.
> I've set the maxconnections setting on the web.config for the handler and
> the webservice to:
> <system.net>
> <connectionManagement>
> <add address="*" maxconnection="20"/>
> </connectionManagement>
> </system.net>
> But when debugging I can see that it is still only making 2 requests at a
> time. How can I make a handler that will allow for more than 2 requests
> at a time.
> TIA
>
>
>

No comments:

Post a Comment