i have a question regarding the impact of the amount of enabled Drupal modules on the开发者_JAVA技巧 size of the apache processes. We are running a big drupal site with around 200 custom modules.
i see the average size of the apache process is 48MB, now i was wondering, if reducing the amount of modules would reduce that process' size. And by reducing the amount of modules i mean i would merge some of them together, so the amount of functions and callbacks, etc. would be the same, just less modules as instead of splitting them in different modules (i did that to make code maintenance easier) i would have many modules merged into just a few.
would that help? i would like to know what you have to say about this before refactoring my code.. ;)
I suspect that combining multiple modules together would make some difference, but not much. One thing that might make more of a difference is separating out the /admin menu options into separate .admin.inc files. It's my understanding that they will then only get loaded when a user visits the administrative side of the site.
Also, look over the modules you have installed on the site and disable and uninstall anything you don't actually need. For example, disable the core Color and Comment modules (enabled by default in Drupal 6), if you're not using them. If you have module like Views UI, Beautytips UI, ImageCache UI, or Rules Administration UI intalled, disable them once you're done configuring everything.
Assuming you have it installed, looking at the APC stats (copy apc.php from where it is installed to a protected place in your DOCROOT) will probably give you a general idea or at least a starting of what is really a memory hog.
I will leave it to others to comment on whether combining files will have any real effect. I have never really profiled this, but I doubt it would do much. My gut tells me that disabling the unused core and contrib modules will be the biggest memory savings.
You may also want to play the apache MaxMemFree
configuration option to see if your 48MB is a constant thing, or if your apache processes are that big because of periodic memory swells (like processing large uploads).
Some modules are more memory-eater than others. Try to disable some of them and check the result (even with a broken website, just to check).
If you use Views (chances are that you use it) try to set the visibility settings of each block in a very restrictive manner, Views eats a lot of memory for each "visible" block, so don't rely only on the module code to empty the block, save your life by handling visibility settings.
精彩评论