alluoshi Posted November 24, 2008 Share Posted November 24, 2008 Hello, when I restarted my Linux server where Apache 2 webserver is installed, I saw that there were only 5 processes under http://localhost/server-status. When one end user sent a request to Apache, I saw 8 processes. When a second user sent a request to Apache, I saw 9 processes. When the third user sent a request to Apache, I saw 10 processes. I can't test more than 3 users. I was just wondering if this is the case the Apache deals with requests. I mean does Apache always creates a process for a new user? Quote Link to comment Share on other sites More sharing options...
corbin Posted November 24, 2008 Share Posted November 24, 2008 No. Apache has a thread pool (some from each processor/core), and when ever a user requests something, Apache delegates the request to an idle thread. The processes/threads you see being spawned are likely being spawned because no free threads exist, and the thread limit has not been reached. Quote Link to comment Share on other sites More sharing options...
alluoshi Posted November 25, 2008 Author Share Posted November 25, 2008 Thank you. This makes sense. I would like to learn how Apache2 communicates with php. I mean, I have a web application where users make requests through Apache2 and php. As explained, Apache has a pool of threads and will create new threads/processes to support more users. When the user sends a request, Apache will assign some threads/processes to this request. After that, it will communicate with php and php will perform an action (say create an Mysql database) and here some threads/processes will be spawned (Mysql processes). How can I know the result when Apache first assigns these threads/processes to end users? (which Apache threads/processes caused the creation of Mysql processes?) Quote Link to comment Share on other sites More sharing options...
corbin Posted November 25, 2008 Share Posted November 25, 2008 Hrmmm as far as I know, you'll have to get deeeeeepppp into some debugging stuff to figure out which threads are doing what at any given time. Or is that not what you were asking? If I may ask, why do you care what a thread is doing? Quote Link to comment Share on other sites More sharing options...
alluoshi Posted November 25, 2008 Author Share Posted November 25, 2008 I care because ultimately I want to measure the CPU usage for all users who are using my web application (through Apache2 and php). Ultimately, if I know all the processes/threads that will be spawned for a user's request, I might be able to measure the summation of the CPU usages of these processes. That's why I thought if I can trace each Apache's thread and if I can map all Apache's threads that are related to a given user, I might solve my problem. I appreciate any other solutions to solve my problem. By the way, can Apache APR solve my problem? Quote Link to comment Share on other sites More sharing options...
corbin Posted November 25, 2008 Share Posted November 25, 2008 Apache APR probably won't help, but it might. When you say users, do you mean the users as in the people viewing the web page, or do you mean the people whose files you host? Quote Link to comment Share on other sites More sharing options...
alluoshi Posted November 25, 2008 Author Share Posted November 25, 2008 I mean by users the end users who are using their browsers to access the web application. In my case, end users are using phpmyadmin to access Mysql (I am working on Mysql as an example of multi-user application but I would like my project to be implemented on any multi-user web application). So in my case, the end users are the users that are created in Mysql. I am not stuck to this situation if other solutions are easier.(currently, there is no client side or server side application, but I would write one if this helps) I really appreciate your help since this is my university project and I couldn't find anyone to help me out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.