Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Making 10 POST requests from ASP.NET asynchronously

Reply
Thread Tools

Making 10 POST requests from ASP.NET asynchronously

 
 
Mike C#
Guest
Posts: n/a
 
      11-14-2006
Hi all,

Is it possible to make 10 POST requests from ASP.NET asynchronously? I have
been working on this problem for a few days now, and I seem to keep running
up against IIS limitations. Basically here's the process as it works now
(synchronously):

Person visits mywebsite.com and fills out a form
mywebsite.com POSTs one request to providerwebsite.com
mywebsite.com receives response
mywebsite.com POSTs a second request to providerwebsite.com
mywebsite.com receives response
....
mywebsite.com POSTs a tenth request to providerwebsite.com
mywebsite.com receives response

What I would like to happen is (asynchronously):

Person visits mywebsite.com and fills out a form
mywebsite.com POSTs one request to providerwebsite.com
mywebsite.com POSTs a second request to providerwebsite.com
mywebsite.com receives a response to first request
....
mywebsite.com POSTs a tenth request to providerwebsite.com
mywebsite.com receives a response to ninth request
mywebsite.com receives a response to tenth request

The above is just an example - the responses should be able to arrive in any
order asynchronously. The problem is that each request can take up to 800
ms to respond, times 10 synchronous requests = 8 seconds... way too long...
The idea is that if I can send all ten requests asynchronously, the results
should start being returned much faster.

Is this even possible with ASP.NET and IIS?


 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      11-14-2006
If 2.0 you could also try the Async methods of the WebClient object...

AFAIK if those requests are not seen by the external server as belonging to
the same session (which is likely the case unless you do something special),
it should work. I don't think you'll have this limitation on your own server
(as your server act as a client to the external web site).

--
Patrice

"Mike C#" <(E-Mail Removed)> a écrit dans le message de news:
y6c6h.235$(E-Mail Removed)...
> Hi all,
>
> Is it possible to make 10 POST requests from ASP.NET asynchronously? I
> have been working on this problem for a few days now, and I seem to keep
> running up against IIS limitations. Basically here's the process as it
> works now (synchronously):
>
> Person visits mywebsite.com and fills out a form
> mywebsite.com POSTs one request to providerwebsite.com
> mywebsite.com receives response
> mywebsite.com POSTs a second request to providerwebsite.com
> mywebsite.com receives response
> ...
> mywebsite.com POSTs a tenth request to providerwebsite.com
> mywebsite.com receives response
>
> What I would like to happen is (asynchronously):
>
> Person visits mywebsite.com and fills out a form
> mywebsite.com POSTs one request to providerwebsite.com
> mywebsite.com POSTs a second request to providerwebsite.com
> mywebsite.com receives a response to first request
> ...
> mywebsite.com POSTs a tenth request to providerwebsite.com
> mywebsite.com receives a response to ninth request
> mywebsite.com receives a response to tenth request
>
> The above is just an example - the responses should be able to arrive in
> any order asynchronously. The problem is that each request can take up to
> 800 ms to respond, times 10 synchronous requests = 8 seconds... way too
> long... The idea is that if I can send all ten requests asynchronously,
> the results should start being returned much faster.
>
> Is this even possible with ASP.NET and IIS?
>



 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      11-14-2006
"Mike C#" <(E-Mail Removed)> wrote in message
news:y6c6h.235$(E-Mail Removed)...
> Hi all,
>
> Is it possible to make 10 POST requests from ASP.NET asynchronously? I
> have been working on this problem for a few days now, and I seem to keep
> running up against IIS limitations. Basically here's the process as it
> works now (synchronously):


It is an IIS limit, as you say. It has nothing to do with ASP.NET.

The only ASP.NET relation is that you probably aren't calling Dispose on
your proxy objects, so you're not closing the connections.

John


 
Reply With Quote
 
Joerg Jooss
Guest
Posts: n/a
 
      11-14-2006
Thus wrote Mike C#,

> Hi all,
>
> Is it possible to make 10 POST requests from ASP.NET asynchronously?
> I have been working on this problem for a few days now, and I seem to
> keep running up against IIS limitations. Basically here's the process
> as it works now (synchronously):
>
> Person visits mywebsite.com and fills out a form
> mywebsite.com POSTs one request to providerwebsite.com
> mywebsite.com receives response
> mywebsite.com POSTs a second request to providerwebsite.com
> mywebsite.com receives response
> ...
> mywebsite.com POSTs a tenth request to providerwebsite.com
> mywebsite.com receives response
> What I would like to happen is (asynchronously):
>
> Person visits mywebsite.com and fills out a form
> mywebsite.com POSTs one request to providerwebsite.com
> mywebsite.com POSTs a second request to providerwebsite.com
> mywebsite.com receives a response to first request
> ...
> mywebsite.com POSTs a tenth request to providerwebsite.com
> mywebsite.com receives a response to ninth request
> mywebsite.com receives a response to tenth request
> The above is just an example - the responses should be able to arrive
> in any order asynchronously. The problem is that each request can
> take up to 800 ms to respond, times 10 synchronous requests = 8
> seconds... way too long... The idea is that if I can send all ten
> requests asynchronously, the results should start being returned much
> faster.


That is not likely -- the processing time for an individual request does
not improve by a client-side optimization. If resource contention comes into
play, it may even get worse. Yet, the overall processing time for the page
that kicks off those 10 requests should be reduced unless you have a severe
bottleneck in your system (such as a deadlock).

> Is this even possible with ASP.NET and IIS?


The 10 connections limitation only applies for non-server Windows versions.
It is not an IIS issue per se.

For an asynchronous implementation of your web requests, look at asynchronous
pages, a feature introduced in ASP.NET 2.0: http://msdn.microsoft.com/msdnmag/is...10/WickedCode/

Cheers,
--
Joerg Jooss
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
Mike C#
Guest
Posts: n/a
 
      11-16-2006

"John Timney (MVP)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Have you looked up threading yet?


Not only did I look it up, I implemented it two different ways and both
times it crapped out with an error code 403, subcode 9.



 
Reply With Quote
 
Mike C#
Guest
Posts: n/a
 
      11-16-2006

"Patrice" <(E-Mail Removed)> wrote in message
news:emtNmn%(E-Mail Removed)...
> If 2.0 you could also try the Async methods of the WebClient object...
>
> AFAIK if those requests are not seen by the external server as belonging
> to the same session (which is likely the case unless you do something
> special), it should work. I don't think you'll have this limitation on
> your own server (as your server act as a client to the external web site).


1.1. Error 403.9 after 4 async requests. Thanks.


 
Reply With Quote
 
Mike C#
Guest
Posts: n/a
 
      11-16-2006
Thus sayeth Joerg Jooss,

> That is not likely -- the processing time for an individual request does
> not improve by a client-side optimization. If resource contention comes
> into play, it may even get worse. Yet, the overall processing time for the
> page that kicks off those 10 requests should be reduced unless you have a
> severe bottleneck in your system (such as a deadlock).


I'm not trying to reduce the processing time for individual requests. That
is a constant I have no control over, like the speed of light. I am trying
to reduce the load time of my page by making 10 requests asynchronously
instead of 1 request...wait...1 response...1 request...wait...etc.
synchronously.

>> Is this even possible with ASP.NET and IIS?

>
> The 10 connections limitation only applies for non-server Windows
> versions. It is not an IIS issue per se.


I ran into this particular problem on Windows Server 2003. I'm told by a
co-worker that there are some limitations built into the HTTP standard which
may be the root of my problem. He also suggested there is some registry
setting to get around it, but he couldn't tell me where he found this
information, so I'll keep Googling it.

> For an asynchronous implementation of your web requests, look at
> asynchronous pages, a feature introduced in ASP.NET 2.0:
> http://msdn.microsoft.com/msdnmag/is...10/WickedCode/


2.0 is not an option right now. Thanks.


 
Reply With Quote
 
Mike C#
Guest
Posts: n/a
 
      11-16-2006

"John Saunders" <john.saunders at trizetto.com> wrote in message
news:u9myfH$(E-Mail Removed)...
> "Mike C#" <(E-Mail Removed)> wrote in message
> news:y6c6h.235$(E-Mail Removed)...
>> Hi all,
>>
>> Is it possible to make 10 POST requests from ASP.NET asynchronously? I
>> have been working on this problem for a few days now, and I seem to keep
>> running up against IIS limitations. Basically here's the process as it
>> works now (synchronously):

>
> It is an IIS limit, as you say. It has nothing to do with ASP.NET.
>
> The only ASP.NET relation is that you probably aren't calling Dispose on
> your proxy objects, so you're not closing the connections.
>
> John


I'm properly disposing of everything, so it falls back to IIS? Thanks.


 
Reply With Quote
 
kferron
Guest
Posts: n/a
 
      11-16-2006
It seems like a few of us are jumping to conclusions without actually
seeing how you are attempting to enqueue the calls for async
invocation.


Mike C# wrote:
> Thus sayeth Joerg Jooss,
>
> > That is not likely -- the processing time for an individual request does
> > not improve by a client-side optimization. If resource contention comes
> > into play, it may even get worse. Yet, the overall processing time for the
> > page that kicks off those 10 requests should be reduced unless you have a
> > severe bottleneck in your system (such as a deadlock).

>
> I'm not trying to reduce the processing time for individual requests. That
> is a constant I have no control over, like the speed of light. I am trying
> to reduce the load time of my page by making 10 requests asynchronously
> instead of 1 request...wait...1 response...1 request...wait...etc.
> synchronously.
>
> >> Is this even possible with ASP.NET and IIS?

> >
> > The 10 connections limitation only applies for non-server Windows
> > versions. It is not an IIS issue per se.

>
> I ran into this particular problem on Windows Server 2003. I'm told by a
> co-worker that there are some limitations built into the HTTP standard which
> may be the root of my problem. He also suggested there is some registry
> setting to get around it, but he couldn't tell me where he found this
> information, so I'll keep Googling it.
>
> > For an asynchronous implementation of your web requests, look at
> > asynchronous pages, a feature introduced in ASP.NET 2.0:
> > http://msdn.microsoft.com/msdnmag/is...10/WickedCode/

>
> 2.0 is not an option right now. Thanks.


 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      11-16-2006
"Mike C#" <(E-Mail Removed)> wrote in message
news:8bO6h.1097$(E-Mail Removed)...
>
> "John Saunders" <john.saunders at trizetto.com> wrote in message
> news:u9myfH$(E-Mail Removed)...
>> "Mike C#" <(E-Mail Removed)> wrote in message
>> news:y6c6h.235$(E-Mail Removed)...
>>> Hi all,
>>>
>>> Is it possible to make 10 POST requests from ASP.NET asynchronously? I
>>> have been working on this problem for a few days now, and I seem to keep
>>> running up against IIS limitations. Basically here's the process as it
>>> works now (synchronously):

>>
>> It is an IIS limit, as you say. It has nothing to do with ASP.NET.
>>
>> The only ASP.NET relation is that you probably aren't calling Dispose on
>> your proxy objects, so you're not closing the connections.
>>
>> John

>
> I'm properly disposing of everything, so it falls back to IIS? Thanks.


It still has nothing to do with IIS, especially not on Windows Server 2003.
IIS is not involved - the network message goes straight from HTTP.SYS into
the ASP.NET worker process (w3wp).


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making 10 POST requests from ASP.NET asynchronously Mike C# ASP .Net 14 11-17-2006 03:59 AM
Making HTTP requests using Twisted rzimerman Python 4 07-11-2006 06:03 PM
POST to URLs asynchronously? webccqinetics@gmail.com Perl Misc 1 11-16-2005 10:45 AM
web requests and mobile requests Fernando Arámburu ASP .Net 1 04-08-2005 07:13 PM
Making multiple HTTP requests using same HttpConnection object in j2me Ravi Ambros Wallau Java 0 10-25-2004 06:50 PM



Advertisments