Using Multiple HttpWebRequests

  • Thread starter Thread starter jperezvazquez
  • Start date Start date
J

jperezvazquez

Hello All,

I am implementing some functionality within my application where I
need to use the HttpWebRequest to call a 3rd party service
(messaging). The URLs that I use have the form of:

https://www.foo.com/Service?name=BOB&.....

Each URL will differ by the parameters - the above example has BOB as
the name. Now I would like to be able to send up to 1000 messages in
one block. Does this imply that I would need to create 1000 web
requests or is there a way of reusing a single connection? (The create
method takes a URL so I doubt it.) I am slightly concious of the
scalibility of creating all these requests and the impact it would
have on my application.

Any help would be appreciated.

Thanks,

Jose
 
Hello All,

I am implementing some functionality within my application where I
need to use the HttpWebRequest to call a 3rd party service
(messaging). The URLs that I use have the form of:

https://www.foo.com/Service?name=BOB&.....

Each URL will differ by the parameters - the above example has BOB as
the name. Now I would like to be able to send up to 1000 messages in
one block. Does this imply that I would need to create 1000 web
requests or is there a way of reusing a single connection? (The create
method takes a URL so I doubt it.) I am slightly concious of the
scalibility of creating all these requests and the impact it would
have on my application.

Any help would be appreciated.

So, why can you not put the messages in one stream of messages and send them
all on one request?

Don't you have some requirements from the 3rd party vendor as to what you
can, cannot do, and how you can do it or made contact with the 3rd party
vendor about this?

If you have not done this, then that's where you need to start is with the
service vendor.
 
Each message would need to be sent on a separate request. The most efficient
way to do this is to use the ThreadPool (or a custom threadpool such as Ami
Bar's "Smartthreadpool" at codeproject.com).
Peter
 
I am implementing some functionality within my application where I
need to use the HttpWebRequest to call a 3rd party service
(messaging). The URLs that I use have the form of:

https://www.foo.com/Service?name=BOB&.....

Each URL will differ by the parameters - the above example has BOB as
the name. Now I would like to be able to send up to 1000 messages in
one block. Does this imply that I would need to create 1000 web
requests or is there a way of reusing a single connection? (The create
method takes a URL so I doubt it.) I am slightly concious of the
scalibility of creating all these requests and the impact it would
have on my application.

One (Http)WebRequest per call.

It has a KeepAlive property that you can use to reuse the TCP/IP
connection.

Scalability is probably more a problem for the guy in the other
end.

You just need to decide on whether you want:
1 thread making 1000 requests
10 threads making 100 requests
100 thread making 10 requests
1000 thread making 1 request

I would go for a reasonable small number of threads, because
more threads will decrease not increase performance after a
certain number of threads is reached.

Arne
 
One (Http)WebRequest per call.

It has a KeepAlive property that you can use to reuse the TCP/IP
connection.

Scalability is probably more a problem for the guy in the other
end.

You just need to decide on whether you want:
1 thread making 1000 requests
10 threads making 100 requests
100 thread making 10 requests
1000 thread making 1 request

I would go for a reasonable small number of threads, because
more threads will decrease not increase performance after a
certain number of threads is reached.

Arne

Thanks for your help Arne and Peter. I will begin with the
Smartthreadpool.

Saludos,

Jose
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top