468,512 Members | 1,551 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

How can we maintain the counters for each process of apache without using getmypid()

Suppose I have a php script. Now i am benchmarking that script using apache benchmark tool. Let us say with the command. ab -n 10 -c 4 filename.php Many different apache processes will be created so as to fulfill the requests.

Suppose total 4 processes are created to fulfill this request. Now, Let us say that the processes have ids p1,p2,p3,p4 and requests are r1,r2,.....r10.

As an example assume how requests are completed.

p1 p2 p3 p4 r1 r2 r3 r4

Suppose r2 got completed. So, r5 assigned to p2.

p1 p2 p3 p4 r1 r5 r3 r4

Suppose r4 got completed. So, r6 assigned to p4.

p1 p2 p3 p4 r1 r5 r3 r6

Suppose r3 got completed. So, r7 assigned to p3.

p1 p2 p3 p4 r1 r5 r7 r6

Suppose r1 got completed. So, r8 assigned to p1.

p1 p2 p3 p4 r8 r5 r7 r6

Suppose r7 got completed. So, r9 assigned to p3.

p1 p2 p3 p4 r8 r5 r9 r6

Suppose r5 got completed. So, r10 assigned to p2.

p1 p2 p3 p4 r8 r10 r9 r6

Now, at some point r6,r9,r8,10 also got completed.

Now we can see that which process has completed which requests.

process p1 p2 p3 p4 requests r1,r8 r2,r5,r10 r3,r7,r9 r4,r6 counter 2 3 3 2

p1,p2,p3,p4 exists the pids of the process. Also, the counter that which process has fulfilled which request exists. Now, in php i can get the pid of which process has called it by getmypid() function and maintain a counter to store how many requests are fulfilled by the process. So, i can know for all the requests fulfilled.

Please provide me some good way where i can get the same knowledge but without relying on the getmypid function.

Thanks a lot.
Feb 5 '13 #1
1 1739
1,043 Expert 1GB
I dont know if its a good way,
But you can add '%P' to your LogFormat
see: http://httpd.apache.org/docs/2.0/mod...og_config.html

The information about pids will be added to your logfile, and can be counted....
Feb 9 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Gregor Wind | last post: by
9 posts views Thread by Pygmalion | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.