1

I am running a webserver currently on a single CPU on a windows 2003 machine. I'm thinking of adding another processor to increase performance, as some of the web apps on the server are slowing down. Will Apache be able to even the load across the two cpus?

Imran Azad
  • 145
  • 4

2 Answers2

1

Unless you've really screwed with the configuration, Apache takes advantage of multiple processors itself. Apache uses something it calls a MPM to start and supervise its various worker threads/processes/etc; there are different MPMs that work in different ways.

If there is any scripting or database access going on, it may be constrained to a single CPU, it really depends on how it was written. For instance, if there's DB access and the query locks the one-and-only table while it's doing anything, then the webserver will be effectively limited to one CPU. This is not usually the case, but fair warning.

Chris S
  • 77,337
  • 11
  • 120
  • 212
  • 2
    You're *partially* correct. Any new-ish versions of apache2 do include the mpm_winnt worker... but it was only available in 2.0.49 and later. With that in mind, if you're using any of the many programming frameworks (php, rails, etc...), many of those are not truly multi-processing... due to issues with thread-safety. They do a fairly good job of faking it though. http://httpd.apache.org/docs/2.2/mod/mpm_winnt.html – TheCompWiz Sep 27 '12 at 13:22
  • @TheCompWiz Correct, the lack of details in the question makes it impossible to say "yes" or "no"; the website slowness might have nothing to do with the CPU too... – Chris S Sep 27 '12 at 13:24
0

In fact most of time Apache is able to open only threads for one processor for an http request.

You must be aware that when you are quickly flushing data to the client with external references or local (you server) you can earn a lot of time.

The navigator tries immediately to revolve the external references, so if the http request is for your servers you get a second http request (or more) the Apache will launch thread on others free processors (the first http and secondarily are parallel processes). This is the job of the navigator to assembly the got component of each http request.

So you can make test since XP with your system monitor.

The way to get reduce treatment time is : - List item

*1- don't hesitate in your php to use flush() when all external references have been defined (external js, image, media etc...) and send a loading

*2- try to group images and send all references

*3- at the end send how to build (showimages using js all load first -functions)

You will see you multiprocessor CPU solicited at good levels.

Note too that if on same script there are several user at same time your multi processor will be very useful.

Best regards

Trebly