Using Multiple HttpWebRequests

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jperezvazquez@gmail.com

    #1

    Using Multiple HttpWebRequests

    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

  • Mr. Arnold

    #2
    Re: Using Multiple HttpWebRequests


    <jperezvazquez@ gmail.comwrote in message
    news:1193486871 .773490.145730@ o80g2000hse.goo glegroups.com.. .
    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.



    Comment

    • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

      #3
      RE: Using Multiple HttpWebRequests

      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 "Smartthreadpoo l" at codeproject.com ).
      Peter
      --
      Recursion: see Recursion
      site: http://www.eggheadcafe.com
      unBlog: http://petesbloggerama.blogspot.com
      BlogMetaFinder: http://www.blogmetafinder.com



      "jperezvazquez@ gmail.com" wrote:
      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
      >
      >

      Comment

      • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

        #4
        Re: Using Multiple HttpWebRequests

        jperezvazquez@g mail.com wrote:
        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)WebReques t 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

        Comment

        • jperezvazquez@gmail.com

          #5
          Re: Using Multiple HttpWebRequests

          On 27 Oct, 20:38, Arne Vajhøj <a...@vajhoej.d kwrote:
          jperezvazq...@g mail.com wrote:
          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:
          >>
          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)WebReques t 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

          Comment

          Working...