Synchronous web request performance

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TomR

    #1

    Synchronous web request performance

    We are having problems with synchronus web request calls
    blocking our ASP.NET performance. Here is the setup: We
    have a php script running on Apache at Site A on the
    internet. This script does nothing more than wait 15
    seconds before serving a page. (You can try it if you
    want. www.337skymaster.com/mypost.php) Using this page,
    we can open four IE browsers on the same machine and start
    each browser at the same time, and have all four complete
    in less than 20 seconds.

    If we use an aspx script on Site B with a synchronus
    HttpWebRequest call to access Site A (simulating accessing
    a bank credit card payyment gateway) and open four
    browsers, only two pages get served at a time. The first
    two take 15 seconds, the second two take 30 seconds. We
    thought maybe this was due to make the reqests from the
    same IP address, but we tried the same thing on four
    machines with four different IP addresses as clients, and
    got the same results (first two transactions take 15
    seconds, second two take 30 seconds).

    We are trying to build an e-commerce site that might be
    processing 50 of these transactions simultaneously. What
    might we be doing wrong in our code to cause this behavior?

  • James J. Foster

    #2
    Re: Synchronous web request performance

    Matt Powell wrote a great article on the topic on MSDN. Here's the URL:

    http://msdn.microsoft.com/library/de...ce07222003.asp

    --
    James J. Foster, DotNetCoders


    "TomR" <tomr1313@yahoo .com> wrote in message
    news:0ded01c361 a1$f27971a0$a50 1280a@phx.gbl.. .[color=blue]
    > We are having problems with synchronus web request calls
    > blocking our ASP.NET performance. Here is the setup: We
    > have a php script running on Apache at Site A on the
    > internet. This script does nothing more than wait 15
    > seconds before serving a page. (You can try it if you
    > want. www.337skymaster.com/mypost.php) Using this page,
    > we can open four IE browsers on the same machine and start
    > each browser at the same time, and have all four complete
    > in less than 20 seconds.
    >
    > If we use an aspx script on Site B with a synchronus
    > HttpWebRequest call to access Site A (simulating accessing
    > a bank credit card payyment gateway) and open four
    > browsers, only two pages get served at a time. The first
    > two take 15 seconds, the second two take 30 seconds. We
    > thought maybe this was due to make the reqests from the
    > same IP address, but we tried the same thing on four
    > machines with four different IP addresses as clients, and
    > got the same results (first two transactions take 15
    > seconds, second two take 30 seconds).
    >
    > We are trying to build an e-commerce site that might be
    > processing 50 of these transactions simultaneously. What
    > might we be doing wrong in our code to cause this behavior?
    >[/color]


    Comment

    • James J. Foster

      #3
      Re: Synchronous web request performance

      Sorry, I should have noted that this article was written for ASPX pages, but
      some of the concepts and configurations may also be enlightening for PHP and
      Apache.

      James


      "James J. Foster" <james@dotnetco ders.com> wrote in message
      news:uzFInPaYDH A.2344@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Matt Powell wrote a great article on the topic on MSDN. Here's the URL:
      >
      >[/color]
      http://msdn.microsoft.com/library/de...ce07222003.asp[color=blue]
      >
      > --
      > James J. Foster, DotNetCoders
      > http://www.dotnetcoders.com
      >
      > "TomR" <tomr1313@yahoo .com> wrote in message
      > news:0ded01c361 a1$f27971a0$a50 1280a@phx.gbl.. .[color=green]
      > > We are having problems with synchronus web request calls
      > > blocking our ASP.NET performance. Here is the setup: We
      > > have a php script running on Apache at Site A on the
      > > internet. This script does nothing more than wait 15
      > > seconds before serving a page. (You can try it if you
      > > want. www.337skymaster.com/mypost.php) Using this page,
      > > we can open four IE browsers on the same machine and start
      > > each browser at the same time, and have all four complete
      > > in less than 20 seconds.
      > >
      > > If we use an aspx script on Site B with a synchronus
      > > HttpWebRequest call to access Site A (simulating accessing
      > > a bank credit card payyment gateway) and open four
      > > browsers, only two pages get served at a time. The first
      > > two take 15 seconds, the second two take 30 seconds. We
      > > thought maybe this was due to make the reqests from the
      > > same IP address, but we tried the same thing on four
      > > machines with four different IP addresses as clients, and
      > > got the same results (first two transactions take 15
      > > seconds, second two take 30 seconds).
      > >
      > > We are trying to build an e-commerce site that might be
      > > processing 50 of these transactions simultaneously. What
      > > might we be doing wrong in our code to cause this behavior?
      > >[/color]
      >
      >[/color]


      Comment

      • TomR

        #4
        Re: Synchronous web request performance

        In reply to your second message, our problem is with an
        ASPX page, not with Apache or PHP. The test site we are
        using to simulate the bank is PHP, but the site that is
        hanging up is IIS with ASP.NET.

        As I said, we tried our best to use the methods in Matt
        Powells article, but did not use HttpHandler. Is
        necessary to use an HttpHandler just to do a garden
        variety HTTP POST transaction from within a script? That
        seems strange to me.

        HELP!

        Tom
        [color=blue]
        >-----Original Message-----
        >Thanks for the reference. We tried the asynchronous call
        >as suggested in the article and saw the same behavior.
        >We have not tried the HttpHandler technique yet, however.
        >Are people using the HttpHandler and does it help with
        >performance?
        >
        >Thanks,
        >TomR
        >[color=green]
        >>-----Original Message-----
        >>Sorry, I should have noted that this article was[/color][/color]
        written[color=blue]
        >for ASPX pages, but[color=green]
        >>some of the concepts and configurations may also be[/color]
        >enlightening for PHP and[color=green]
        >>Apache.
        >>
        >>James
        >>
        >>
        >>"James J. Foster" <james@dotnetco ders.com> wrote in[/color]
        >message[color=green]
        >>news:uzFInPaY DHA.2344@TK2MSF TNGP09.phx.gbl. ..[color=darkred]
        >>> Matt Powell wrote a great article on the topic on[/color][/color][/color]
        MSDN.[color=blue]
        >Here's the URL:[color=green][color=darkred]
        >>>
        >>>[/color]
        >>http://msdn.microsoft.com/library/default.asp?[/color]
        >url=/library/en-us/dnservice/html/service07222003 .asp[color=green][color=darkred]
        >>>
        >>> --
        >>> James J. Foster, DotNetCoders
        >>> http://www.dotnetcoders.com
        >>>
        >>> "TomR" <tomr1313@yahoo .com> wrote in message
        >>> news:0ded01c361 a1$f27971a0$a50 1280a@phx.gbl.. .
        >>> > We are having problems with synchronus web request[/color][/color]
        >calls[color=green][color=darkred]
        >>> > blocking our ASP.NET performance. Here is the[/color][/color]
        >setup: We[color=green][color=darkred]
        >>> > have a php script running on Apache at Site A on the
        >>> > internet. This script does nothing more than wait[/color][/color][/color]
        15[color=blue][color=green][color=darkred]
        >>> > seconds before serving a page. (You can try it if[/color][/color][/color]
        you[color=blue][color=green][color=darkred]
        >>> > want. www.337skymaster.com/mypost.php) Using this[/color][/color]
        >page,[color=green][color=darkred]
        >>> > we can open four IE browsers on the same machine[/color][/color][/color]
        and[color=blue]
        >start[color=green][color=darkred]
        >>> > each browser at the same time, and have all four[/color][/color]
        >complete[color=green][color=darkred]
        >>> > in less than 20 seconds.
        >>> >
        >>> > If we use an aspx script on Site B with a synchronus
        >>> > HttpWebRequest call to access Site A (simulating[/color][/color]
        >accessing[color=green][color=darkred]
        >>> > a bank credit card payyment gateway) and open four
        >>> > browsers, only two pages get served at a time. The[/color][/color]
        >first[color=green][color=darkred]
        >>> > two take 15 seconds, the second two take 30[/color][/color][/color]
        seconds.[color=blue]
        >We[color=green][color=darkred]
        >>> > thought maybe this was due to make the reqests from[/color][/color]
        >the[color=green][color=darkred]
        >>> > same IP address, but we tried the same thing on four
        >>> > machines with four different IP addresses as[/color][/color][/color]
        clients,[color=blue]
        >and[color=green][color=darkred]
        >>> > got the same results (first two transactions take 15
        >>> > seconds, second two take 30 seconds).
        >>> >
        >>> > We are trying to build an e-commerce site that[/color][/color][/color]
        might[color=blue]
        >be[color=green][color=darkred]
        >>> > processing 50 of these transactions[/color][/color][/color]
        simultaneously.[color=blue]
        >What[color=green][color=darkred]
        >>> > might we be doing wrong in our code to cause this[/color][/color]
        >behavior?[color=green][color=darkred]
        >>> >
        >>>
        >>>[/color]
        >>
        >>
        >>.
        >>[/color]
        >.
        >[/color]

        Comment

        • James J. Foster

          #5
          Re: Synchronous web request performance

          Maybe you fixed something by now, but here's some notes from my tests.

          If I do 4 winform apps with the same code, they all come back within 20
          seconds. Four ASPX pages on one machine though show blocking of some of the
          requests. However, I did two ASPX requests on two machines (that's all I had
          available) and all came back within 20 seconds. I did add timing code to
          measure the length of the actual request to the server, and it's around 15
          seconds.

          I ran NetMon, and here's some notes from that capture (running 4 Winform
          apps and 4 Webpages on the same machine)

          1. As a WinForm app, all 4 requests go out at the same time. Responses come
          back within 20 seconds for all requests.
          2. As a Web app, only 2 requests go out at a time. The other 2 block until
          one of the first requests completes, and then uses the connection to make
          it's initial request. So, although it takes 30s from start to finish, it's
          only doing work from the 15s to the 30s mark.

          James

          "TomR" <tomr1313@yahoo .com> wrote in message
          news:0ded01c361 a1$f27971a0$a50 1280a@phx.gbl.. .[color=blue]
          > We are having problems with synchronus web request calls
          > blocking our ASP.NET performance. Here is the setup: We
          > have a php script running on Apache at Site A on the
          > internet. This script does nothing more than wait 15
          > seconds before serving a page. (You can try it if you
          > want. www.337skymaster.com/mypost.php) Using this page,
          > we can open four IE browsers on the same machine and start
          > each browser at the same time, and have all four complete
          > in less than 20 seconds.
          >
          > If we use an aspx script on Site B with a synchronus
          > HttpWebRequest call to access Site A (simulating accessing
          > a bank credit card payyment gateway) and open four
          > browsers, only two pages get served at a time. The first
          > two take 15 seconds, the second two take 30 seconds. We
          > thought maybe this was due to make the reqests from the
          > same IP address, but we tried the same thing on four
          > machines with four different IP addresses as clients, and
          > got the same results (first two transactions take 15
          > seconds, second two take 30 seconds).
          >
          > We are trying to build an e-commerce site that might be
          > processing 50 of these transactions simultaneously. What
          > might we be doing wrong in our code to cause this behavior?
          >[/color]


          Comment

          • James J. Foster

            #6
            Re: Synchronous web request performance

            Ok, another observation. I changed the value for the maxconnection to 20 in
            the web.config, per the article's recommendation:

            <connectionMana gement>
            <add address="*" maxconnection=" 20" />
            </connectionManag ement>

            I noticed though that if you have 4 separate Internet Explorer browser
            *processes* (IExplore.exe in Task Manager), and not separate
            windows/instances, then 4 connections will go out at once, and you can have
            all 4 requests come back in 20 seconds. However, with one process and
            separate windows (pulled up via Ctrl-N), the maxconnection seems irrelevant
            for the application, and only 2 requests go out at a time. Perhaps IE is
            acting according to the HTTP spec on a per process level.

            --
            James J. Foster, DotNetCoders



            "TomR" <tomr1313@yahoo .com> wrote in message
            news:0ded01c361 a1$f27971a0$a50 1280a@phx.gbl.. .[color=blue]
            > We are having problems with synchronus web request calls
            > blocking our ASP.NET performance. Here is the setup: We
            > have a php script running on Apache at Site A on the
            > internet. This script does nothing more than wait 15
            > seconds before serving a page. (You can try it if you
            > want. www.337skymaster.com/mypost.php) Using this page,
            > we can open four IE browsers on the same machine and start
            > each browser at the same time, and have all four complete
            > in less than 20 seconds.
            >
            > If we use an aspx script on Site B with a synchronus
            > HttpWebRequest call to access Site A (simulating accessing
            > a bank credit card payyment gateway) and open four
            > browsers, only two pages get served at a time. The first
            > two take 15 seconds, the second two take 30 seconds. We
            > thought maybe this was due to make the reqests from the
            > same IP address, but we tried the same thing on four
            > machines with four different IP addresses as clients, and
            > got the same results (first two transactions take 15
            > seconds, second two take 30 seconds).
            >
            > We are trying to build an e-commerce site that might be
            > processing 50 of these transactions simultaneously. What
            > might we be doing wrong in our code to cause this behavior?
            >[/color]


            Comment

            Working...