When examining Apache's error.log
, you'll frequently encounter entries like:
[mpm_prefork:notice] AH00163: Apache configured -- resuming normal operations
[mpm_prefork:notice] AH00169: caught SIGTERM, shutting down
These are normal operational messages rather than actual errors. The MPM (Multi-Processing Module) prefork messages indicate:
- Server startup completion (AH00163)
- Graceful shutdown initiation (AH00169)
- Process management events
The messages appear because:
- Apache uses syslog-level notices for important operational events
- MPM modules log their state transitions
- Default logging configurations capture notices in error.log
To better manage these logs:
# In your apache configuration (httpd.conf or apache2.conf)
LogLevel warn
# Or specifically for MPM:
LogLevel mpm_prefork:warn
This will suppress notices while keeping important warnings. For detailed monitoring:
# Create separate log for MPM events
CustomLog /var/log/apache2/mpm.log "%t [%m:%l] %M"
The prefork MPM maintains a pool of child processes. Key parameters in your config:
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 10000
</IfModule>
While these messages are normal, watch for patterns indicating problems:
- Frequent restarts (more than several per hour)
- Process count constantly at MaxRequestWorkers
- "Server reached MaxRequestWorkers" warnings
Create a simple monitoring script to track MPM events:
#!/bin/bash
# monitor_apache_mpm.sh
LOG_FILE="/var/log/apache2/error.log"
PATTERN="mpm_prefork:notice"
tail -F $LOG_FILE | grep --line-buffered $PATTERN | while read line
do
echo "$(date) - MPM Event: $line" >> /var/log/apache2/mpm_monitor.log
# Add notification logic here if needed
done
For production systems, consider using syslog-ng or rsyslog to properly categorize these messages:
# Example rsyslog configuration for Apache
if $programname == 'apache2' then {
if $msg contains 'mpm_prefork:notice' then {
/var/log/apache2/mpm_notices.log
stop
}
}
These log entries are completely normal operational messages from Apache's Multi-Processing Module (MPM) prefork implementation. Let's break down what each line means:
[Wed Jun 25 18:15:56.295408 2014] [mpm_prefork:notice] [pid 8817] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming normal operations
[Wed Jun 25 18:15:56.295570 2014] [core:notice] [pid 8817] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jun 25 18:26:34.511247 2014] [mpm_prefork:notice] [pid 8817] AH00169: caught SIGTERM, shutting down
These specific messages typically appear during:
- Server startup (AH00163)
- Graceful shutdown (AH00169)
- Configuration reload
The prefork MPM creates multiple child processes that handle requests, with each process containing a single thread. This is different from worker or event MPMs that use multiple threads per process.
Key characteristics of prefork MPM:
- Process-based (not threaded)
- Each request handled by separate process
- Good for stability with non-thread-safe libraries
While these messages are normal, you might want to review your MPM prefork settings in apache2.conf
or mpm_prefork.conf
:
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
These messages only indicate problems if they appear:
- Too frequently (possible process recycling issues)
- Accompanied by error messages
- When server performance degrades
To check your current prefork status, you can use:
apachectl status
# Or for more detailed info:
apachectl fullstatus
For real-time monitoring, consider tools like:
- mod_status
- Apache's server-status handler
- Third-party monitoring solutions
Depending on your use case, you might consider:
# For threaded model (requires thread-safe PHP)
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
# For event-based model (Apache 2.4+)
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
Remember to update your PHP configuration accordingly if switching MPM modules.