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.

Every time an httpd process is started it will access all PHP and Apache modules. Is there any way to change this behavior?

share|improve this question
    
What do you want it to do? –  Michael Hampton Dec 30 '12 at 21:00
    
Only process the request without loading all modules again. Thanks –  Super Mario Dec 30 '12 at 21:01
    
Apache process is mapped to all modules which were loaded at run-time. If you see the output of /proc/pid-apache-child/maps you will have the idea. This is due to so module to link the dynamic library at run time. These modules are loaded once in the memory and shared across all the child process. However I would like to know what made you to think of changing this behavior? Cause that might drive us to rethink on this behavior. Were you worried cause loaded module per child usage extra memory? Each module are mapped to child process as it is not aware which will be required in the excutin –  PratapSingh Dec 31 '12 at 11:21
    
Actually my server is suffering from an I/O problem caused by httpd. I checked dmseg and It seems that Apache loads all module for every instance and maybe changing this behavior would lower the I/O usage. I use MPM Prefrok. –  Super Mario Dec 31 '12 at 11:55
add comment

2 Answers

up vote 1 down vote accepted

Well, you might want to use the threading module in apache if you want to do that. Means worker module, not prefork.

Though that have it's own disadvantages, but as it uses the shared memory, and uses threads, it will be faster and lighter.

You can read a lot more about threads and forking at this URL.

share|improve this answer
    
Just FYI, it's not everything you are asking for, but it's something which you are asking for. –  GeekRide Dec 31 '12 at 10:52
add comment

Each process is in effect its own service. When a process is started it cannot know what modules it may require. It therefore loads all of them in order to be able to properly process the request. It's a fundamental design decision that cannot be altered without rewriting Apache.

share|improve this answer
add comment

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.