Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We run Apache on a FreeBSD system, it has multple web apps on it (Wordpress, Magento, custom PHP). As the traffic increases, we see more and more httpd processes in status "lockf" (using 'top'). The server load increases until we have to restart Apache.

As I understand this state Apache waits for a file lock. But how can we find out which file(s) are to be locked / cause the bottleneck? Without that information, it seems very hard to tackle the problem.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It's an old question, but I'll give it a try ;)

This situation sounds like 'you have a slow drive' - but it's just a feeling without knowing more.

To answer the direct question (finding the used files), do the following: Check if you have lsof installed which lsof, if not installed install it by pkg(_install) (dunno which FreeBSD Version you have).

Then search for your http processes by top or ps and use lsof to see which files are used with lsof -p PROCNUMBER This gives you a table of ALL files/dirs/pipes etc. used by this process.

This can now be examined. Have a look at man lsof, it's very long and has much power.

Without knowing the result of what you find, try to reduce or even disable logging and see if this helps. Using the wrong logging setup and much traffic could kill even big machines. And a last note: If you have a good machine running such setup you described, the BIGGEST problem is drive I/O in many cases. Dual Xeon Superbig-CPU has no meaning if you still have an IDE drive ;)

One final resource which might be interesting: http://httpd.apache.org/docs/2.2/caching.html

share|improve this answer
    
The issue was solved somehow a long time ago, but your approach sounds very reasonable - thx! –  Bachi Dec 23 '13 at 9:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.