Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-04-2004, 04:28 PM
|
#1
|
Senior Member
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334
Rep:
|
apache tuning question: prefork.c vs worker.c
in my httpd.conf, I have the following sections:
Code:
<IfModule prefork.c>
StartServers 20
MinSpareServers 50
MaxSpareServers 100
MaxClients 200
MaxRequestsPerChild 20000
</IfModule>
<IfModule worker.c>
StartServers 35
MaxClients 256
MinSpareThreads 30
MaxSpareThreads 305
ThreadsPerChild 255
MaxRequestsPerChild 0
</IfModule>
What is the difference between the prefork.c and worker.c? Is it bad to have the values the same? Is it bad to have them different? Do the values of the above prefork.c pass your sanity test (I changed those values, but wanted to get confirmation before changing the others).
This server is getting hit really hard - I have mysql max_connections at 200, and don't want to allow the number of web users to go beyond that, but I want to get as high as safely possible. It was higher than that earlier today, but was causing obvious problems as there weren't enough mysql connections to handle all the web requests. It's locked down now, but really slow (that's what I'm trying to fix).
Thanks!
Last edited by BrianK; 05-04-2004 at 04:29 PM.
|
|
|
05-04-2004, 04:31 PM
|
#2
|
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552
Rep:
|
Prefork and worker are mutually exclusive modules. How did you compile Apache? Check the output of "httpd -l".
|
|
|
05-04-2004, 04:35 PM
|
#3
|
Senior Member
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334
Original Poster
Rep:
|
Quote:
Originally posted by stickman
Prefork and worker are mutually exclusive modules. How did you compile Apache? Check the output of "httpd -l".
|
# httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
# httpd -V
Server version: Apache/2.0.40
Server built: Nov 27 2003 11:04:06
Server's Module Magic Number: 20020628:0
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
|
|
|
11-11-2004, 06:39 AM
|
#4
|
LQ Newbie
Registered: Jul 2004
Location: Hamburg, Germany
Posts: 2
Rep:
|
Hello,
returning to the original question, what is the difference between those two?
I found out that my apache was compiled with prefork.c , seems to be default by
RedHat.
But when there is more than one possibilitie, then there is a reason for them
to exist.
I haven't found anything about this yet.
Something like prefork is faster, worker uses less memory..
I think I should/could trust RedHat compiling the server with a somewhat
ideal solution, but Im not sure and additionally I'd like to understand the
differences between prefork.c and worker.c
Marcus
|
|
|
11-11-2004, 07:59 AM
|
#5
|
LQ Guru
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796
Rep:
|
Have you checked the Apache documentation? there is a dedicated section on this
http://httpd.apache.org/docs-2.0/mpm.html
|
|
|
11-11-2004, 08:40 AM
|
#6
|
LQ Newbie
Registered: Jul 2004
Location: Hamburg, Germany
Posts: 2
Rep:
|
yes,
shortly after posting the message to the board
I searched google about the topic but it did not show any
pages on the apache site. One of the first topics on google
was this thread.
Marcus
|
|
|
03-10-2010, 05:20 AM
|
#7
|
LQ Newbie
Registered: Mar 2010
Posts: 1
Rep:
|
Better late than never
I know this reply is a little late (six years!!??), but I thought it might be useful to add this information for anyone else who may stumble onto this thread via google like I did.
I have done a little digging and it looks like the basic difference between worker.c and prefork.c is that the worker.c module allows multiple threads from mulitple processes whereas the prefork.c is a non threaded module similar to the earlier apache 1.3.
Hope this helps any other Googlers
|
|
|
05-05-2010, 12:47 AM
|
#8
|
LQ Newbie
Registered: May 2010
Posts: 1
Rep:
|
Google is how I found this thread!
Thanks for providing me with the answer to question:
"difference between worker.c and prefork.c?"
|
|
|
11-17-2010, 04:32 PM
|
#9
|
LQ Newbie
Registered: Nov 2010
Posts: 5
Rep:
|
Out of some Google-specific reason this thread still comes up at the top of the search results on Google. In order help others I want to shed a bit more light on this topic. The difference between both MPMs has been made clear in this thread, but I still don't know which one is considered to be faster. I found this blog entry ( http://www.camelrichard.org/apache-prefork-vs-worker) and it says that even with single core CPUs the Worker Thread is faster.
Apache Bench results for prefork:
Requests per second: 20.91 [#/sec] (mean)
Apache Bench results for prefork:
Requests per second: 40.94 [#/sec] (mean)
It has also been noted that PHP must be compiled after apache's compilation in order to work. Alternatively you could use CGI or fast CGI instead of the PHP apache module. There is also another alternative called mod_fcgid.
Last edited by gattler; 11-17-2010 at 05:59 PM.
|
|
|
09-27-2011, 09:43 AM
|
#10
|
Member
Registered: May 2002
Location: NY, USA
Distribution: FreeBSD, Fedora, RHEL, Ubuntu; OS X, Win; have used Slackware, Mandrake, SuSE, Xandros
Posts: 448
Rep:
|
Yup: this thread still comes up highly ranked in searches.
So, if the worker MPM is that much faster than the prefork (by almost a factor of two), why is prefork still shipped as the default MPM in modern distributions (RHEL6)? For compatability reasons, or something else?
|
|
|
02-09-2012, 01:42 PM
|
#11
|
Member
Registered: Jun 2001
Location: Los Angeles, CA USA
Distribution: RedHat
Posts: 53
Rep:
|
Quote:
Originally Posted by deesto
Yup: this thread still comes up highly ranked in searches.
So, if the worker MPM is that much faster than the prefork (by almost a factor of two), why is prefork still shipped as the default MPM in modern distributions (RHEL6)? For compatability reasons, or something else?
|
The concern is that php has so many external libraries that are commonly used via the extension system, which are not guaranteed to be reentrant. With the Worker MPM, apache is threaded, and if an individual library isn't reentrant, this can cause the dreaded apache internal error. Many people feel it's better to trade off performance for stability, and knowing that visitors are not going to regularly receive blank pages.
|
|
|
All times are GMT -5. The time now is 01:40 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|