By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,051 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,051 IT Pros & Developers. It's quick & easy.

Protection aganist heavy load on server

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi Hasan,
Win 2K
IIS 5
php How much RAM ? What Processor Speed ?

No Database ?

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! How many Pageimpressions / Pagehits ?
We have come up with a to do list which has two main items on it.
- Upgrade the server
- Create a gate-keeper system.
[...]
Why do you use https ? and not http ?
Buy the way, I did some tests to compare Windows and linux backend
and linux performed about %60 better. Sounds like what i know for a long time ;-)
However, we have to stick to windows since
we use COM till I create a diffrent solution
to that.

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

Jul 17 '05 #2

P: n/a
Hello,

On 03/25/2004 10:27 AM, Hasan Ceylan wrote:
Recently we have started to have performance problems on our server
which has the following configuration:

Win 2K
IIS 5
php


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
http://www.meta-language.net/metastorage.html
Jul 17 '05 #3

P: n/a
Uzytkownik "Hasan Ceylan" <ce*******@hotmail.com> napisal w wiadomosci
news:e0**************************@posting.google.c om...
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?


Here lies the problem: COM support in PHP4 leaks memory like crazy. See
http://bugs.php.net/bug.php?id=21269

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

P: n/a
Karl Heinz Marbaise <kh********@gmx.de> wrote in message news:<c3*************@ID-68093.news.uni-berlin.de>...

Hi Karl,
Hi Hasan,
Win 2K
IIS 5
php How much RAM ? What Processor Speed ?


I've got 1.256 GB RAM. Dual P III 1MHz
No Database ?

There is several different connections to MSSQL and MYSQL databases.
DB Servers are running on different boxes.

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!

How many Pageimpressions / Pagehits ?


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
We have come up with a to do list which has two main items on it.
- Upgrade the server
- Create a gate-keeper system.
[...]
Why do you use https ? and not http ?


Because Credit cards and password exchanged between browser and
server.
Buy the way, I did some tests to compare Windows and linux backend
and linux performed about %60 better. Sounds like what i know for a long time ;-)
> However, we have to stick to windows since
we use COM till I create a diffrent solution
to that.

Why do you use COM and for what? Can it be replaced ?


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.
Is this a PHP Application which can be multiplied on
many servers ? (Load-Balancing ?)

Kind regards.
Karl Heinz


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
Jul 17 '05 #5

P: n/a
Hi Hasan,
I've got 1.256 GB RAM. Dual P III 1MHz 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 ....
How many Pageimpressions / Pagehits ?

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

That's very much....about 500 million per month....
Because Credit cards and password exchanged between browser and
server. Ok. I see you have to use https....
I do not want to create a server farm for just a few days in a year.

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

Jul 17 '05 #6

P: n/a
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_default.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 <kh********@gmx.de> wrote in message news:<c4*************@ID-68093.news.uni-berlin.de>...
Hi Hasan,
I've got 1.256 GB RAM. Dual P III 1MHz

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 ....
How many Pageimpressions / Pagehits ?

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

That's very much....about 500 million per month....
Because Credit cards and password exchanged between browser and
server.

Ok. I see you have to use https....
I do not want to create a server farm for just a few days in a year.

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

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.