我在php文件(api.php)中有 webservice API 。 Android / iOS应用程序将从此Web服务获取数据。截至目前, 1000 - 3000个用户。 应用程序将从服务器获取每5秒一次的数据(实时数据)。 我在偷看时遇到高CPU使用率。每个 www-data 消耗2%的CPU。我有8核处理器。它在偷看时达到最大CPU 。对此有何建议?
Apache配置。
<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 20
MaxSpareServers 40
MaxClients 200
MaxRequestsPerChild 4500
</IfModule>
虚拟主机详细信息:
<VirtualHost *:80>
ServerName track.domain.com
Redirect permanent / https://track.domain.com/
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /var/certificate/track.domain.com/track_domain_com.crt
SSLCertificateKeyFile /var/certificate/track.domain.com/track.domain.com.key
SSLCACertificateFile /var/certificate/track.domain.com/track_domain_com.ca-bundle
#SSLCertificateChainFile /var/certificate/track.domain.com/track_domain_com.ca-bundle
# Admin email, Server Name (domain name), and any aliases
ServerAdmin webmaster@track.domain.com
ServerName track.domain.com
ServerAlias www.track.domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/track.domain.com/public_html
#DocumentRoot /var/www/html/track.domain.in/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/html/track.domain.com/log/error.log
CustomLog /var/www/html/track.domain.com/log/access.log combined
<IfModule mod_security2.c>
SecRuleEngine Off
SecAuditEngine Off
SecAuditLog ${APACHE_LOG_DIR}/modsec_audit.log
SecDebugLog ${APACHE_LOG_DIR}/modsec_debug.log
</IfModule>
</VirtualHost>