# Apache Sucks, AlternativeS?

## Hellzone

Basically i need a Webserver application which will allow for PHP, has virtual hosts, strong security, allows for .htaccess or similar and doesn't take much cpu load.

I've just stress tested my server from locallan (basically the fastest it's going to get) with 5 threads running 7 similtanious requests at different pages all the pages being accessed 1ms between request (bit extreeme i know but...) and it's made the DUAL processor computer i have, running at about 3.7ghz die down to 92% load!!!

apache can't handle pressure!

----------

## timmfin

I've never used apache (or any websever myself) but I find it funny since over 50% of all webservers are apache, it can't be that bad can it?

----------

## ARC2300

Hmmm. . .I haven't had problems with Apache slowing down like that. . .

Mind giving us some more specs other than just the CPU??  It might be something else that could cause the high load.

I mean, there are tonnes of busy servers out there that use Apache, so it can't be that bad.

And as for alternatives, I believe there is a webserver called Zeus, but I could be incorrect.

[edit]I just realized something. . .

So you're saying Apache was starting to shit at serving up 35 different pages in the timespan of 1ms or so??  If that's the case, I'm not surprised CPU usage was so high.  Even REALLY busy sites usually don't get hits like that.Last edited by ARC2300 on Fri Jun 06, 2003 5:32 pm; edited 1 time in total

----------

## paranode

Is it actually Apache that is using the 92%?  Sounds like a configuration problem to me because some pretty hardcore websites that get millions of hits a day run Apache just fine.

----------

## Hellzone

Apache is actually getting that, without the stress tester running i idle at 99.9% when im checking the stress over lan from another comp it gets as low as 4.2% idle it does flux but even then it's a concern that each apache process is using 14.0% of my processor!?

10746 apache    15   0 18796  18m  16m R 15.6  7.4   1:56.07 apache2

10832 apache    15   0 18656  18m  16m S 15.6  7.3   1:56.29 apache2

25682 apache    16   0 18764  18m  16m S 14.9  7.4   0:27.66 apache2

10834 apache    15   0 18472  18m  16m S 13.3  7.2   1:56.76 apache2

It shows a flaw in the server as if i get more hits than this and it takes the complete load apache will die and usually open up security holes!

----------

## paranode

How many total hits within a one minute interval would you say this stress-tester is doing?

It may just be a foolish benchmark that has no real-world significance.

----------

## Hellzone

It's doing on average 4000 hits a minute, just because it isn't realistic for my website (when it's up) to get anywhere near those hits i do know and have known of people who go out of their way just to crash the webservers.

I know this is a bit paranoid as well, but it's better to be safe than sorry and again why is apache2 using 14% on each process!?

thanks

-james

----------

## Jimbow

 *Hellzone wrote:*   

> I've just stress tested my server from locallan (basically the fastest it's going to get) with5 threads running 7 similtanious requests at different pages all the pages being accessed 1ms between request (bit extreeme i know but...)

 

It is not clear how you are counting but it looks like you are at least asking for 1,000 pages per second, perhaps 7,000 pages per second, perhaps even more. 

Assuming  7,000 pages per second (7 pages, each page with 1000 reqs per second), this is equivalent to:

420,000 pages per minute

25,200,000 pages per hour

604,800,000 pages per day

I think the only problem is that your test is way too extreme.   If your system can actually handle this request rate, you should thank your lucky stars for Apache and send them a donation.   At those rates you could host 3 virtual sites with the top 3 stories on Slashdot and still not get slashdotted.

----------

## Hellzone

In 1 minute it's transferring 15mb of text!, i have to admit that is pretty impressive, is there anyway i can make apache shutdown  and restart after a certain amount of hits!?  or if it gets excessivly hit shutdown for 5 minutes close every port on the machine and then start itself up again.

Once again i know this extreeme and highly paranoid but thats the way i am....

thanks

-James

----------

## paranode

 *Hellzone wrote:*   

> In 1 minute it's transferring 15mb of text!, i have to admit that is pretty impressive, is there anyway i can make apache shutdown  and restart after a certain amount of hits!?  or if it gets excessivly hit shutdown for 5 minutes close every port on the machine and then start itself up again.
> 
> Once again i know this extreeme and highly paranoid but thats the way i am....
> 
> thanks
> ...

 

I don't know for sure but I don't think it will service requests after some limit.  The limit should be set in some configuration file but I'm not sure where.  I don't think it will crash because of too many hits, but rather ignore the excessive ones.

----------

## raptor

u seem to use PHP, if u use whatever dynamic page generation u can expect slowdown..

Apache2 is still beta.

How much RAM do u have, is it enought for the load u do on the server.(swapping will kill the performence)

How u tuned the PHP ?

What type of pages u test ? with/without Database access?, do u use sessions?

Did u try other variants i.e. forking-apache ? etc.etc..

----------

## Hellzone

http://www.cevo.co.uk

try it! i got the cpu down to like 2.2% it's running PHP and im testing MysqlDB based pages and normal pages.

-James

----------

## Jimbow

You can throttle Apache with the following Apache2.conf variables: 

```

MaxKeepAliveRequests 100

MaxSpareServers     10

MaxClients         150

MaxSpareThreads     75

MaxThreadsPerChild  20

MaxRequestsPerChild  0

```

Read apache2.conf for details or if push comes to shove, dig into the Apache documentation.

----------

## mrjohnston

Well I think apache is about the best out there, but seeing as I don't see anyone listing alternatives I'll have a quick go.  

  The only two I routinely hear about are roxen and boa.  I know boa is very satreamlined so may not be full featured enough.  Roxen is supposed to be ok, and I have used it some before, but it was easier to use apache's conf file for me than their gui.  I know there is another open source fork from roxen that might be better for you.  Starts with a C but I have to search for it.  So there you are, a couple alternatives for people who seriously want to try out the diversity in webservers on linux.

And I know there are more I missed...a lot more.

mrjohnston

----------

## pcable

PS-HTTPD!

Haha.

Patrick

----------

## uzik

 *Hellzone wrote:*   

> Basically i need a Webserver application which will allow for PHP, has virtual hosts, strong security, allows for .htaccess or similar and doesn't take much cpu load.
> 
> I've just stress tested my server from locallan (basically the fastest it's going to get) with 5 threads running 7 similtanious requests at different pages all the pages being accessed 1ms between request (bit extreeme i know but...) and it's made the DUAL processor computer i have, running at about 3.7ghz die down to 92% load!!!
> 
> apache can't handle pressure!

 

If you want this kind of speed don't use interpreted code (PHP, Perl, etc).

It's just common sense that if you have to run an interpreter + 'do real

work' it will run slower than just 'do real work'.

Like the other people have posted, this is a LOT more traffic than you

will ever see in real life.  If you really have to do this kind of traffic

see slashdot for their article on how they designed a site that will

survive the slashdot effect.

----------

## mysticalreaper

Hellzone,

You seem to be confused about a couple issues with webserving.  Hopefully i can give you some tips.

A) Apache is the best webserver out there.  It may not be the ultimate fastest, but it's the best.  It supports any feature you want, and it's very high quality

B) Your complaint seems to be "When i work my server really really hard, it seems to use up a lot of my CPU!".  Well of COURSE it does.  How would you expect it to behave?  If you try to get apache to serve you pages as fast as it can, it will use as much of your computer that's free to do that.

C) *Quote:*   

> It shows a flaw in the server as if i get more hits than this and it takes the complete load apache will die and usually open up security holes!

 

You're afraid that if apache get's too loaded down, it will crash and open up security holes?  That's ridiculous.  First, it won't crash.  Really it won't.  The worst that will happen is that it will get really really slow because you're getting way too many hits for your server to handle.  And if it DID crash (which would be a bug) it will just stop running, and your website would stop working.  Where does the security hole come in?

D) You want apache to shutdown, wait 5 mins, then startup again if it gets too many hits?  There is NO way to do this, and frankly, no one besides you thinks that's a good idea.  Can you imagine a business website owner, like eBay, saying, "Well, if we get too many hits, can we just shut down our site for a few minutes?"  They would destroy themselves if they did that.  If your server is overloaded, you should upgrade your server, not shut it off.

E) Apahe2 is fine, and actually scales better than Apache 1.3.  At least, according to Apache Software Foundation, the guys  who wrote it.  http://httpd.apache.org/docs-2.0/new_features_2_0.html

I just did a quick benchmark on apache 2.0.46 on my desktop box here, a meagre P-III 700 with 512 MB of RAM.

10,000 requests, 7 simultaneous.

```
Document Length:        1281 bytes

Concurrency Level:      7

Time taken for tests:   17.465619 seconds

Complete requests:      10000

Failed requests:        0

Write errors:           0

Total transferred:      15960000 bytes

HTML transferred:       12810000 bytes

Requests per second:    572.55 [#/sec] (mean)

Time per request:       12.226 [ms] (mean)

Time per request:       1.747 [ms] (mean, across all concurrent requests)

Transfer rate:          892.32 [Kbytes/sec] received

```

So i can serve 572.55 pages per second to myself, when i'm running the benchmark software.  If that's not good enough for ya, well you must have really big dreams about the kind of hits you will get.

Final note: using CPU cycles that would just go idle is no problem.  Don't worry about it.

----------

## chrysalis

Zeus Web Server (http://www.zeus.com/) is way better than Apache, both for performance (more than twice the speed of Apache for static content) and ease of use. Unfortunately, it's an expensive (but worthy) product.

A way cheaper alternative is Premium Thttpd.

----------

## Hellzone

Ok ok, Point taken..... now for the next stupid question.....

-ponders-

-james

----------

