最近我的(基于Linux centOS的)Web服务器出现性能问题。 我对服务器上的所有站点的响应时间相当缓慢,而之前的页面加载速度要好得多。 我有eAccelerator运行,gzipped内容,优化的mysql查询和其他标准的优化过程,我已经确定已经实施。 我已经看了一下apache的统计数据,看看在性能方面是否有什么问题,有什么我应该关注的(比如请求率)? 感谢任何帮助,因为我没有在这方面的经验!
Maximum connect burst length: 0 Total: connections 1 requests 1 replies 1 test-duration 1.512 s Connection rate: 0.7 conn/s (1511.9 ms/conn, <=1 concurrent connections) Connection time [ms]: min 1511.9 avg 1511.9 max 1511.9 median 1511.5 stddev 0.0 Connection time [ms]: connect 32.3 Connection length [replies/conn]: 1.000 Request rate: 0.7 req/s (1511.9 ms/req) Request size [B]: 79.0 Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples) Reply time [ms]: response 1409.5 transfer 70.2 Reply size [B]: header 262.0 content 17425.0 footer 2.0 (total 17689.0) Reply status: 1xx=0 2xx=1 3xx=0 4xx=0 5xx=0 CPU time [s]: user 0.35 system 1.02 (user 23.1% system 67.5% total 90.6%) Net I/O: 11.5 KB/s (0.1*10^6 bps) Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
编辑:我也运行mysqltuner在服务器上,看看是否有什么可以改善 – 我可以做的事情。
-------- General Statistics -------------------------------------------------- [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 5.0.92-community [!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM -------- Storage Engine Statistics ------------------------------------------- [--] Status: +Archive -BDB +Federated +InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 111M (Tables: 662) [--] Data in InnoDB tables: 10M (Tables: 468) [!!] Total fragmented tables: 114 -------- Security Recommendations ------------------------------------------- [OK] All database users have passwords assigned -------- Performance Metrics ------------------------------------------------- [--] Up for: 4d 7h 19m 52s (2M q [5.717 qps], 94K conn, TX: 3B, RX: 208M) [--] Reads / Writes: 82% / 18% [--] Total buffers: 58.0M global + 4.4M per thread (400 max threads) [OK] Maximum possible memory usage: 1.8G (84% of installed RAM) [OK] Slow queries: 0% (22/2M) [OK] Highest usage of available connections: 3% (14/400) [OK] Key buffer size / total MyISAM indexes: 16.0M/63.2M [OK] Key buffer hit rate: 99.5% (1M cached / 8K reads) [OK] Query cache efficiency: 91.9% (1M cached / 1M selects) [!!] Query cache prunes per day: 17638 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 43K sorts) [!!] Temporary tables created on disk: 48% (205K on disk / 420K total) [OK] Thread cache hit rate: 99% (14 created / 94K connections) [!!] Table cache hit rate: 3% (1K open / 28K opened) [OK] Open file limit used: 51% (1K/2K) [OK] Table locks acquired immediately: 99% (184K immediate / 184K locks) [!!] InnoDB data size / buffer pool: 10.4M/8.0M -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance Enable the slow query log to troubleshoot bad queries When making adjustments, make tmp_table_size/max_heap_table_size equal Reduce your SELECT DISTINCT queries without LIMIT clauses Increase table_cache gradually to avoid file descriptor limits Variables to adjust: query_cache_size (> 16M) tmp_table_size (> 16M) max_heap_table_size (> 16M) table_cache (> 1024) innodb_buffer_pool_size (>= 10M)
您的系统是否依赖于多个数据库事务?
如果您确实已经完成了所有的性能优化,并且您的网站变慢了,那么也可能是数据库规模越来越大,用户群与数据库成比例地成长(例如,您的网站变得越来越stream行),并且需要更多时间运行相同的进程,在较小的数据库上执行。
对于一个普通的网站,当数据库增长到200MB时,它的性能会慢慢下降,要求更多的内存和一个不同的索引策略。
你可以使用像Pingdom这样的工具(他们有免费账户)来监控你的网站的正常运行时间和响应时间,然后你发现瓶颈,评估发生了什么。 另外,系统的平均负载是多less?
你每天有多less人,一年前你有多less人? 可能有区别。