VDS: обнаружение, выявление причин и устранение проблемных ситуаций. Диагностические утилиты и оптимизация

Embed Size (px)

DESCRIPTION

Слайды к лекции об анализе VDS серверов, прозвучавшей на петербургском Линуксфесте в июле 2014 года. Развернутая статья доступна по адресу http://debian-help.ru/vps-server-debian-analiz-problem-optimizaciya-nastroek

Citation preview

  • 1. VDS: , . -. 2014

2. . . . 3. - top 4. - free #free -m total used free shared buffers cached Mem: 3439 890 2548 0 181 227 -/+ buffers/cache: 481 2958 Swap: 4729 0 4729 5. - df df -h Filesystem Size Used Avail Use% Mounted on rootfs 97G 5.0G 87G 6% / udev 10M 0 10M 0% /dev tmpfs 344M 6.6M 338M 2% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.6G 0 1.6G 0% /run/shm 6. - du du -h max-depth=1 197M ./bin 129M ./local 22M ./include 4.0K ./ntfs 354M ./lib 4.0K ./src 6.3M ./lib32 30M ./sbin 379M ./share 4.0K ./games 1.1G . 7. - ncdu 8. - iftop 9. - iptraf 10. - bwm-ng 11. Apache - cd /var/log/apache2 tail -n1000 access.log | grep " 302 " | awk '{print $1}' | sort | uniq -c | sort -g 1 77.66.215.97 1 82.145.220.175 2 207.241.226.231 8 199.192.207.146 29 178.154.160.29 751 37.140.141.35 12. Apache 13. Nginx 14. MySQL - mytop 15. MySQL MySQLTuner -------- Performance Metrics ------------------------------------------------- [--] Up for: 22h 56m 26s (674K q [8.169 qps], 83K conn, TX: 483M, RX: 65M) [--] Reads / Writes: 99% / 1% [--] Total buffers: 480.0M global + 2.7M per thread (151 max threads) [OK] Maximum possible memory usage: 885.8M (25% of installed RAM) [OK] Slow queries: 0% (0/674K) [OK] Highest usage of available connections: 3% (6/151) [OK] Key buffer size / total MyISAM indexes: 16.0M/640.0K [OK] Key buffer hit rate: 99.2% (46K cached / 364 reads) [OK] Query cache efficiency: 91.7% (311K cached / 340K selects) [OK] Query cache prunes per day: 0 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 12K sorts) [OK] Temporary tables created on disk: 7% (118 on disk / 1K total) [OK] Thread cache hit rate: 99% (6 created / 83K connections) [!!] Table cache hit rate: 19% (129 open / 655 opened) [OK] Open file limit used: 8% (212/2K) [OK] Table locks acquired immediately: 100% (27K immediate / 27K locks) [OK] InnoDB data size / buffer pool: 96.0K/128.0M -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance MySQL started within last 24 hours - recommendations may be inaccurate Enable the slow query log to troubleshoot bad queries Increase table_cache gradually to avoid file descriptor limits Variables to adjust: table_cache (> 1200) 16. - atop 17. , , , , , , (DoS). 18. , , Df, du, ncdu, MySQL, , , . 19. , Apache. free, top, ps aux. OOM Killer, swap . , . egrep -i 'killed process' /var/log/* 20. . top, atop. VNC, . . . 21. () . (Ahrefs, BLEX, Sputnik). - IP. . 22. SMTP-. Joomla 1.5. SMTP-. Joomla 1.5 . . SMTP-. 23. root, root. , ps ax. Clam-av, rkhunter. . SSH. root. 24. (DoS) , , . DoS , IP , . VNC. . . . 25. Nginx, opcode- php, Apache, MySQL. 26. Nginx + php-fpm Apache, : , opcode-, - nginx, DNS- , , . 27. debian-help.ru slideshare.net/gesundes vk.com/gesundes 28. !