我正在尝试诊断为什么magento网站全天达到99%的CPU并使网站爬行时有一些乐趣。
使用top命令& strace我会在几秒钟内看到这样的页面和页面:
close(19) = 0
lstat("/var/www/magento/app/code/local/Mage/Core/Controller/Front/Action.php", 0x7fffdc41c250) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/community/Mage/Core/Controller/Front/Action.php", 0x7fffdc41c250) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/core/Mage/Core/Controller/Front/Action.php", {st_mode=S_IFREG|0755, st_size=5198, ...}) = 0
lstat("/var/www/magento/app/code/core/Mage/Core/Controller/Front", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/magento/app/code/core/Mage/Core/Controller/Front/Action.php", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0755, st_size=5198, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=5198, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=5198, ...}) = 0
mmap(NULL, 5198, PROT_READ, MAP_SHARED, 19, 0) = 0x7fe4d81ed000
munmap(0x7fe4d81ed000, 5198) = 0
close(19) = 0
lstat("/var/www/magento/app/code/local/Mage/Core/Controller/Varien/Action.php", 0x7fffdc41b940) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/community/Mage/Core/Controller/Varien/Action.php", 0x7fffdc41b940) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php", {st_mode=S_IFREG|0755, st_size=34910, ...}) = 0
lstat("/var/www/magento/app/code/core/Mage/Core/Controller/Varien", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0755, st_size=34910, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=34910, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=34910, ...}) = 0
mmap(NULL, 34910, PROT_READ, MAP_SHARED, 19, 0) = 0x7fe4d8158000
munmap(0x7fe4d8158000, 34910) = 0
close(19) = 0
lstat("/var/www/magento/app/code/local/Mage/Core/Controller/Response/Http.php", 0x7fffdc41cd20) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/community/Mage/Core/Controller/Response/Http.php", 0x7fffdc41cd20) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/core/Mage/Core/Controller/Response/Http.php", {st_mode=S_IFREG|0755, st_size=3484, ...}) = 0
lstat("/var/www/magento/app/code/core/Mage/Core/Controller/Response", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/magento/app/code/core/Mage/Core/Controller/Response/Http.php", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0755, st_size=3484, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=3484, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=3484, ...}) = 0
mmap(NULL, 3484, PROT_READ, MAP_SHARED, 19, 0) = 0x7fe4d81ee000
munmap(0x7fe4d81ee000, 3484) = 0
close(19) = 0
lstat("/var/www/magento/app/code/local/Zend/Controller/Response/Http.php", 0x7fffdc41c410) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/community/Zend/Controller/Response/Http.php", 0x7fffdc41c410) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/app/code/core/Zend/Controller/Response/Http.php", 0x7fffdc41c410) = -1 ENOENT (No such file or directory)
lstat("/var/www/magento/lib/Zend/Controller/Response/Http.php", {st_mode=S_IFREG|0755, st_size=1106, ...}) = 0
lstat("/var/www/magento/lib/Zend/Controller/Response", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/magento/lib/Zend/Controller/Response/Http.php", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0755, st_size=1106, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=1106, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=1106, ...}) = 0
mmap(NULL, 1106, PROT_READ, MAP_SHARED, 19, 0) = 0x7fe4d81ee000
munmap(0x7fe4d81ee000, 1106) = 0
close(19)
在上面的示例中,它引用了一些magento文件,但通常是图像。无论是产品图片,博客第40页上的随机图片等等。我都没有资格知道apache在做什么,但我真的很想解决它!
我们正在使用apache,mysql(在另一台服务器上)和redis运行Magento。
任何想法或潜在的探索途径?