Есть некая виртуалка, на ней есть wordpress сайт и форум на phpbb. Все это добро стояло и работало до последних дней. Не понятно с чего сайт стал адски тупить, а то и вообще уходить в даун. Помотрел top, там:
Код: Выделить всё
last pid: 65718; load averages: 0.55, 0.51, 0.75 up 0+11:21:56 06:00:48
78 processes: 1 running, 77 sleeping
CPU: 0.0% user, 0.0% nice, 4.1% system, 9.0% interrupt, 86.8% idle
Mem: 615M Active, 84M Inact, 277M Wired, 2816K Cache, 111M Buf, 2712K Free
Swap: 3072M Total, 978M Used, 2094M Free, 31% Inuse, 4K In, 14M Out
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
65556 mysql 52 20 0 715M 105M select 0:33 0.00% mysqld
62089 user 1 20 0 78644K 932K select 0:08 0.00% sshd
62070 user 1 20 0 78644K 968K select 0:04 0.00% sshd
1500 root 1 20 0 14240K 632K kqread 0:02 0.00% dovecot
65680 www 1 20 0 480M 28924K pfault 0:02 0.00% php-fpm
65682 www 1 20 0 376M 24896K pfault 0:02 0.00% php-fpm
64603 www 1 20 0 101M 1236K kqread 0:02 0.00% nginx
65686 www 1 20 0 376M 9728K select 0:02 0.00% php-fpm
65681 www 1 20 0 380M 22444K select 0:02 0.00% php-fpm
65685 www 1 20 0 376M 5380K select 0:02 0.00% php-fpm
65696 www 1 20 0 480M 2084K pfault 0:01 0.00% php-fpm
635 _pflogd 1 20 0 12284K 212K bpf 0:01 0.00% pflogd
65695 www 1 20 0 480M 1840K pfault 0:01 0.00% php-fpm
65697 www 1 20 0 480M 640K select 0:01 0.00% php-fpm
65690 www 1 20 0 484M 24016K pfault 0:01 0.00% php-fpm
65691 www 1 20 0 480M 20452K pfault 0:01 0.00% php-fpm
64602 www 1 20 0 101M 996K pfault 0:01 0.00% nginx
65684 www 1 20 0 460M 25108K pfault 0:01 0.00% php-fpm
835 root 1 20 0 66912K 860K select 0:01 0.00% proftpd
1503 root 1 20 0 36232K 364K kqread 0:01 0.00% dovecot-auth
65683 www 1 20 0 420M 25832K pfault 0:00 0.00% php-fpm
738 root 1 20 0 12088K 612K select 0:00 0.00% syslogd
65692 www 1 20 0 464M 110M select 0:00 0.00% php-fpm
65709 www 1 21 0 464M 118M select 0:00 0.00% php-fpm
65712 www 1 20 0 464M 118M pfault 0:00 0.00% php-fpm
65708 www 1 20 0 464M 118M select 0:00 0.00% php-fpm
65687 www 1 20 0 376M 18868K pfault 0:00 0.00% php-fpm
Код: Выделить всё
[11-Jan-2015 05:45:37] WARNING: [pool www] child 65622, script '/usr/local/www/apache24/data/forum.server.info/index.php' (request: "GET /index.php") executing too slow (6.457785 sec), logging
[11-Jan-2015 05:45:37] WARNING: [pool www] child 65620, script '/usr/local/www/apache24/data/server.info/index.php' (request: "GET /index.php") executing too slow (5.253016 sec), logging
[11-Jan-2015 05:45:37] NOTICE: child 65622 stopped for tracing
[11-Jan-2015 05:45:37] NOTICE: about to trace 65622
[11-Jan-2015 05:45:37] ERROR: failed to ptrace(PT_IO) pid 65622: Bad address (14)
[11-Jan-2015 05:45:37] NOTICE: finished trace of 65622
[11-Jan-2015 05:45:37] NOTICE: child 65620 stopped for tracing
[11-Jan-2015 05:45:37] NOTICE: about to trace 65620
[11-Jan-2015 05:45:37] ERROR: failed to ptrace(PT_IO) pid 65620: Bad address (14)
[11-Jan-2015 05:45:37] NOTICE: finished trace of 65620
[11-Jan-2015 05:45:39] WARNING: [pool www] child 65624, script '/usr/local/www/apache24/data/server.info/wp-cron.php' (request: "POST /wp-cron.php") executing too slow (6.947353 sec), logging
[11-Jan-2015 05:45:39] NOTICE: child 65624 stopped for tracing
[11-Jan-2015 05:45:39] NOTICE: about to trace 65624
[11-Jan-2015 05:45:45] ERROR: failed to ptrace(PT_IO) pid 65624: Bad address (14)
[11-Jan-2015 05:45:45] NOTICE: finished trace of 65624
[11-Jan-2015 05:45:49] WARNING: [pool www] child 65628, script '/usr/local/www/apache24/data/server.info/index.php' (request: "GET /index.php") executing too slow (12.146980 sec), logging
[11-Jan-2015 05:45:49] WARNING: [pool www] child 65627, script '/usr/local/www/apache24/data/server.info/index.php' (request: "GET /index.php") executing too slow (8.608700 sec), logging
[11-Jan-2015 05:45:49] WARNING: [pool www] child 65626, script '/usr/local/www/apache24/data/server.info/index.php' (request: "GET /index.php") executing too slow (14.077189 sec), logging
[11-Jan-2015 05:45:49] WARNING: [pool www] child 65625, script '/usr/local/www/apache24/data/server.info/index.php' (request: "GET /index.php") executing too slow (14.641975 sec), logging
[11-Jan-2015 05:45:49] WARNING: [pool www] child 65623, script '/usr/local/www/apache24/data/forum.server.info/index.php' (request: "HEAD /index.php") executing too slow (13.075876 sec), logging
[11-Jan-2015 05:45:49] NOTICE: child 65628 stopped for tracing
[11-Jan-2015 05:45:49] NOTICE: about to trace 65628
[11-Jan-2015 05:45:49] ERROR: failed to ptrace(PT_IO) pid 65628: Bad address (14)
[11-Jan-2015 05:45:49] NOTICE: finished trace of 65628
[11-Jan-2015 05:45:49] NOTICE: child 65627 stopped for tracing
[11-Jan-2015 05:45:49] NOTICE: about to trace 65627
[11-Jan-2015 05:45:49] ERROR: failed to ptrace(PT_IO) pid 65627: Bad address (14)
[11-Jan-2015 05:45:49] NOTICE: finished trace of 65627
[11-Jan-2015 05:45:49] NOTICE: child 65626 stopped for tracing
[11-Jan-2015 05:45:49] NOTICE: about to trace 65626
[11-Jan-2015 05:45:49] ERROR: failed to ptrace(PT_IO) pid 65626: Bad address (14)
[11-Jan-2015 05:45:49] NOTICE: finished trace of 65626
[11-Jan-2015 05:45:49] NOTICE: child 65625 stopped for tracing
[11-Jan-2015 05:45:49] NOTICE: about to trace 65625
[11-Jan-2015 05:45:49] ERROR: failed to ptrace(PT_IO) pid 65625: Bad address (14)
[11-Jan-2015 05:45:49] NOTICE: finished trace of 65625
[11-Jan-2015 05:45:49] NOTICE: child 65623 stopped for tracing
[11-Jan-2015 05:45:49] NOTICE: about to trace 65623
[11-Jan-2015 05:45:49] NOTICE: finished trace of 65623
Отключил плагины, которые не использовал.
Думал, что ддосят. Статистика nginx в среднем показывает следующее:
Код: Выделить всё
Active connections: 23
server accepts handled requests
80 80 309
Reading: 0 Writing: 2 Waiting: 21
Код: Выделить всё
limit_req_zone $binary_remote_addr zone=site:10m rate=2r/s;
Код: Выделить всё
limit_req zone=site burst=4;
Собственно конфиг php-fpm:
Код: Выделить всё
[global]
pid = /var/run/php-fpm.pid
error_log = /var/log/php-fpm.log
;syslog.facility = daemon
;syslog.ident = php-fpm
log_level = notice
;emergency_restart_threshold = 0
;emergency_restart_interval = 0
;process_control_timeout = 0
;process.max = 128
;process.priority = -19
daemonize = yes
;rlimit_files = 1024
;rlimit_core = 0
events.mechanism = kqueue
;systemd_interval = 10
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
[www]
;prefix = /path/to/pools/$pool
user = server
group = server
listen = /tmp/php-fpm.sock
;listen.backlog = 128
listen.owner = server
listen.group = server
listen.mode = 0666
;listen.allowed_clients = 127.0.0.1
; priority = -19
pm = dynamic
pm.max_children = 30
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 5
;pm.process_idle_timeout = 10s;
pm.max_requests = 50
;pm.status_path = /status
;ping.path = /ping
;ping.response = pong
;access.log = log/$pool.access.log
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
slowlog = /var/log/$pool.log.slow
request_slowlog_timeout = 5s
;request_terminate_timeout = 0
;rlimit_files = 1024
;rlimit_core = 0
;chroot =
;chdir = /var/www
;catch_workers_output = yes
;security.limit_extensions = .php .php3 .php4 .php5
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M
Код: Выделить всё
root@server:/usr/home/user # tail -f /var/log/www.log.slow
[0x0000000802443428] require_wp_db() /usr/local/www/apache24/data/server.info/wp-settings.php:79
[0x0000000802443030] +++ dump failed
[11-Jan-2015 06:17:20] [pool www] pid 1447
script_filename = /usr/local/www/apache24/data/server.info/wp-cron.php
[0x0000000802448158] mysql_connect() /usr/local/www/apache24/data/server.info/wp-includes/wp-db.php:1418
[0x0000000802447c70] db_connect() /usr/local/www/apache24/data/server.info/wp-includes/wp-db.php:612
[0x0000000802447908] __construct() /usr/local/www/apache24/data/server.info/wp-includes/load.php:352
[0x0000000802443b08] require_wp_db() /usr/local/www/apache24/data/server.info/wp-settings.php:79
[0x0000000802443710] +++ dump failed
Код: Выделить всё
# ll -h /var/db/mysql/slow.log
-rw-rw---- 1 mysql mysql 849M Jan 11 05:34 /var/db/mysql/slow.log
Код: Выделить всё
# Time: 150111 1:14:51
# User@Host: server[server] @ localhost [] Id: 978
# Query_time: 59.620983 Lock_time: 0.067413 Rows_sent: 0 Rows_examined: 1
SET timestamp=1420917291;
UPDATE `wp_options` SET `option_value` = 'a:28889:{i:1419877932;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877947;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877948;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877958;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877964;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877974;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877988;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877989;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419877991;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878003;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878006;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878015;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878017;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878018;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878019;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878022;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1419878023;a:1:{s:12:\"my_new_event\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\"
Код: Выделить всё
[client]
character_set_client=utf8
#password = your_password
#port = 3306
socket = /tmp/mysql.sock
[mysqld]
skip-networking
character-set-server=utf8
init-connect="SET NAMES utf8"
long_query_time=5
#slow_query_log=1
#slow_query_log_file=/var/db/mysql/slow.log
#port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
query_cache_size=64M
max_allowed_packet = 128M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
innodb_flush_log_at_trx_commit=2
skip-innodb_doublewrite
server-id = 1
[mysqldump]
quick
max_allowed_packet = 128M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
Код: Выделить всё
root@server:/usr/home/user # uname -srm
FreeBSD 9.3-RELEASE-p6 amd64
root@server:/usr/home/user # php -v
PHP 5.4.36 (cli) (built: Jan 6 2015 20:16:41)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
root@server:/usr/home/user # php -m
[PHP Modules]
apc
bcmath
bz2
calendar
Core
ctype
date
dom
ereg
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcre
PDFlib
PDO
pdo_mysql
pdo_sqlite
Phar
posix
pspell
Reflection
session
SimpleXML
snmp
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
zip
zlib
[Zend Modules]