Protection aganist heavy load on server

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

    #1

    Protection aganist heavy load on server

    Hi Everyone,

    Recently we have started to have performance problems on our server
    which has the following configuration:

    Win 2K
    IIS 5
    php

    The traffic to our web site is on normal time 300 - 400 concurrent
    users.
    On a very busy day it can go up to 5000 concurrent users. In these
    days we simply crash!

    We have come up with a to do list which has two main items on it.
    - Upgrade the server
    - Create a gate-keeper system.

    What I mean by that is, some other server or a front line application
    will allow only say 2500 people into
    the site and unless one session is expired it won't let in the new one
    in.
    Our site uses SSL. Because of this I can not use the IIS's
    user limitation feature. Beacuse users on the site start with http,
    you need your chance to
    get into the site first. Then when you are logged in then again need
    the
    same chance, only this time for each request since AFAIK https doesn't
    let
    persistent connections.


    I appreciate links to related resources and solutions and sorry for
    bad English.

    Buy the way, I did some tests to compare Windows and linux backend
    and linux performed about %60 better. However, we have to
    stick to windows since we use COM till I create a diffrent solution
    to that. Do you think this is expected?

    H.Ceylan
  • Karl Heinz Marbaise

    #2
    Re: Protection aganist heavy load on server

    Hi Hasan,
    [color=blue]
    > Win 2K
    > IIS 5
    > php[/color]
    How much RAM ? What Processor Speed ?

    No Database ?
    [color=blue]
    >
    > The traffic to our web site is on normal time 300 - 400 concurrent
    > users.
    > On a very busy day it can go up to 5000 concurrent users. In these
    > days we simply crash![/color]
    How many Pageimpressions / Pagehits ?
    [color=blue]
    > We have come up with a to do list which has two main items on it.
    > - Upgrade the server
    > - Create a gate-keeper system.
    >[/color]
    [...]
    Why do you use https ? and not http ?
    [color=blue]
    > Buy the way, I did some tests to compare Windows and linux backend
    > and linux performed about %60 better.[/color]
    Sounds like what i know for a long time ;-)
    [color=blue]
    > However, we have to stick to windows since
    > we use COM till I create a diffrent solution
    > to that.[/color]
    Why do you use COM and for what? Can it be replaced ?

    Is this a PHP Application which can be multiplied on
    many servers ? (Load-Balancing ?)

    Kind regards.
    Karl Heinz
    --
    Dipl.Ing.(FH) Karl Heinz Marbaise | www.marbaise.org
    Jabba Dabba Dooh ;-) | ICQ# 135949029

    Comment

    • Manuel Lemos

      #3
      Re: Protection aganist heavy load on server

      Hello,

      On 03/25/2004 10:27 AM, Hasan Ceylan wrote:[color=blue]
      > Recently we have started to have performance problems on our server
      > which has the following configuration:
      >
      > Win 2K
      > IIS 5
      > php[/color]

      Multi-threaded servers like IIS or Apache 2 are not an ideal enviroment
      for PHP with certain extensions that have non-reentrant code. You would
      need to use PHP with Fast-CGI or drop the non-reentrant extensions if
      you can.

      Anyway, the reason most servers crash is due to the excess of
      simultaneous database connections that are created by an equal number of
      simultaneous Web server processes that are running.

      One very efficient solution, in my experience must better than using any
      connection pooling middleware, is to make static content like images be
      served by a separate dedicated HTTP server like thttpd running probably
      in a separate IP address or on the same IP address but on a different port.

      This way, the main Web server will only run processes that serve PHP
      scripts that use database connections. No process will be wasted on
      non-database based content request. So, it will use much less processes
      and simultaneous database connections during a peaks.

      If you configure the Web server properly, it will kill excessive
      processes after the peaks have happened and so any excessive database
      persistent connections are so closed.

      To implement this, you can use Apache 1.x but make sure KeepAlive is off.

      --

      Regards,
      Manuel Lemos

      PHP Classes - Free ready to use OOP components written in PHP
      http://www.phpclasses.org/

      PHP Reviews - Reviews of PHP books and other products
      http://www.phpclasses.org/reviews/

      Metastorage - Data object relational mapping layer generator

      Comment

      • Chung Leong

        #4
        Re: Protection aganist heavy load on server

        Uzytkownik "Hasan Ceylan" <ceylanh74@hotm ail.com> napisal w wiadomosci
        news:e0036b7a.0 403250527.30261 a70@posting.goo gle.com...[color=blue]
        > Buy the way, I did some tests to compare Windows and linux backend
        > and linux performed about %60 better. However, we have to
        > stick to windows since we use COM till I create a diffrent solution
        > to that. Do you think this is expected?[/color]

        Here lies the problem: COM support in PHP4 leaks memory like crazy. See


        Try setting the application protectopn in IIS to highest. If that doesn't
        work, run PHP as CGI.


        Comment

        • Hasan Ceylan

          #5
          Re: Protection aganist heavy load on server

          Karl Heinz Marbaise <khmarbaise@gmx .de> wrote in message news:<c3up29$2a 6n5u$1@ID-68093.news.uni-berlin.de>...

          Hi Karl,
          [color=blue]
          > Hi Hasan,
          >[color=green]
          > > Win 2K
          > > IIS 5
          > > php[/color]
          > How much RAM ? What Processor Speed ?
          >[/color]

          I've got 1.256 GB RAM. Dual P III 1MHz
          [color=blue]
          > No Database ?
          >[/color]

          There is several different connections to MSSQL and MYSQL databases.
          DB Servers are running on different boxes.[color=blue][color=green]
          > >
          > > The traffic to our web site is on normal time 300 - 400 concurrent
          > > users.
          > > On a very busy day it can go up to 5000 concurrent users. In these
          > > days we simply crash![/color]
          > How many Pageimpressions / Pagehits ?[/color]

          As it extra extra anourmously peaks on some times, normal hit rate
          wouldn't
          be a mesure. But in busy times it is over 200 hits/sec[color=blue]
          >[color=green]
          > > We have come up with a to do list which has two main items on it.
          > > - Upgrade the server
          > > - Create a gate-keeper system.
          > >[/color]
          > [...]
          > Why do you use https ? and not http ?[/color]

          Because Credit cards and password exchanged between browser and
          server.
          [color=blue]
          >[color=green]
          > > Buy the way, I did some tests to compare Windows and linux backend
          > > and linux performed about %60 better.[/color]
          > Sounds like what i know for a long time ;-)
          >[color=green]
          > > However, we have to stick to windows since
          > > we use COM till I create a diffrent solution
          > > to that.[/color]
          > Why do you use COM and for what? Can it be replaced ?
          >[/color]

          Yes. Our site previously ran on IIS and ASP. For purchase steps we
          created some COM objects that create and maintain shoppingcarts and
          talk to backend servers using client sockets. This has been in my task
          list for a long time there is alot of rewriting needs to be done for
          that.
          [color=blue]
          > Is this a PHP Application which can be multiplied on
          > many servers ? (Load-Balancing ?)
          >
          > Kind regards.
          > Karl Heinz[/color]

          Not without rewriting several parts of the application.

          But also I do not want to server all the clients. I would like to
          target
          a number of sessions (like a thousand) and reject the rest till one
          session
          is expired and gracefully tell the others to wait. And the idea is
          once
          someone is in the site I should keep serving him.

          I do not want to create a server farm for just a few days in a year.

          Thanks for your response Karl,
          Have nice day for everyone,
          H.Ceylan

          Comment

          • Karl Heinz Marbaise

            #6
            Re: Protection aganist heavy load on server

            Hi Hasan,
            [color=blue]
            > I've got 1.256 GB RAM. Dual P III 1MHz[/color]
            I think you mean "1 GHz" instead of "1 MHz" ? ;-)

            Ok. But it seemed to me that this is not enough for the
            Hits / Seconds (200) you given ....
            [color=blue][color=green]
            >>How many Pageimpressions / Pagehits ?[/color]
            > As it extra extra anourmously peaks on some times, normal hit rate
            > wouldn't
            > be a mesure. But in busy times it is over 200 hits/sec[/color]
            That's very much....about 500 million per month....
            [color=blue]
            > Because Credit cards and password exchanged between browser and
            > server.[/color]
            Ok. I see you have to use https....
            [color=blue]
            > I do not want to create a server farm for just a few days in a year.[/color]
            Ok.

            I think this would be a classical way to use load balanced systems e.g.
            minimum two servers ....and you will fit the needth....

            But you've decided against ....and others have explained
            other solutions....


            Kind regards.
            Karl Heinz
            --
            Dipl.Ing.(FH) Karl Heinz Marbaise | www.marbaise.org
            Jabba Dabba Dooh ;-) | ICQ# 135949029

            Comment

            • Hasan Ceylan

              #7
              Re: Protection aganist heavy load on server

              Hi Karl and All other fellows replied,

              I did some tests and I have come to a solution and wanted to share and
              have you guy's ideas on whether what I think is a resonable solution.

              on my test box(linux, apache, php (I know I know ;) )), with MS Web
              stress tool being the client
              with a only one-print-statement-php I get 2000 req/sec.
              <?
              print "Hello World"';
              ?>

              if I ran the code below, I get 1700 req/sec, which makes me think
              this is not a heavy code.
              <?
              if (!($_REQUEST["PHPSESSID"])) {
              $d = dir("/www/sess/");
              $no=0;
              while (false !== ($entry = $d->read() ))
              $no++;
              if (($no) > 500) {echo "too busy";exit;}
              session_start() ;
              }
              ?>


              Then I include this into each page as the very first line.
              To eliminate the overhead of parsing the whole page file before
              execution, I iclude the main page's html-php scripts as well.

              default.php:
              <?
              include("s.php" );
              include("main_d efault.php");
              ?>

              Then I get 1600 req/sec.

              This basically allows 500 people to go into the site while holding
              others
              with "too busy" error message.

              The ideal number of sessions will be determined based on real world
              testings I guess.

              Regards,
              Ceylan

              Karl Heinz Marbaise <khmarbaise@gmx .de> wrote in message news:<c40v9m$2d 35do$3@ID-68093.news.uni-berlin.de>...[color=blue]
              > Hi Hasan,
              >[color=green]
              > > I've got 1.256 GB RAM. Dual P III 1MHz[/color]
              > I think you mean "1 GHz" instead of "1 MHz" ? ;-)
              >
              > Ok. But it seemed to me that this is not enough for the
              > Hits / Seconds (200) you given ....
              >[color=green][color=darkred]
              > >>How many Pageimpressions / Pagehits ?[/color]
              > > As it extra extra anourmously peaks on some times, normal hit rate
              > > wouldn't
              > > be a mesure. But in busy times it is over 200 hits/sec[/color]
              > That's very much....about 500 million per month....
              >[color=green]
              > > Because Credit cards and password exchanged between browser and
              > > server.[/color]
              > Ok. I see you have to use https....
              >[color=green]
              > > I do not want to create a server farm for just a few days in a year.[/color]
              > Ok.
              >
              > I think this would be a classical way to use load balanced systems e.g.
              > minimum two servers ....and you will fit the needth....
              >
              > But you've decided against ....and others have explained
              > other solutions....
              >
              >
              > Kind regards.
              > Karl Heinz[/color]

              Comment

              Working...