本帖最后由 风筝不会飞 于 2023-7-24 20:44 编辑
为静态的PHP程序,访问量大概是 3w IP 一天 ,高峰的时候访问IP是 5000,就那么一个小时爆发一下 ,然后其他时间是 1000 不到,
并发数, 我看了下Windows的性能监视器current connection,大概有 1000左右,不知道是重复IP还是蜘蛛比较多的缘故,并发最高的时候有 2000
但是CPU经常是 80-100%, 之前做了索引,好了一段时间 ,结果没到一个月又这样了.
服务器买的one provider的E3-1230 V6 32G内存, SSD,整体 内存才跑到 40%,MySQL占用内存大概 6GB,求教下是哪里还可以设置吗
show full processlist 大部分内容都是这个 ,查询type 表
- state Waiting for qu ery cache lock
- info sele ct a.typename,a.id,a.click fr om dede_arctype a whe re a.reid='8' and a.id<>'1540' or der by click de sc limit 0,10
- state Waiting for qu ery cache lock
- info SEL ECT id,reid,typename FR OM dede_arctype WHE RE typedir like '渊下宫' or id='54' LIMIT 0,1
复制代码
query cache检查的结果
- show variables like '%query_cache%';
- Variable_name Value
- have_query_cache YEs
- query_cache limit 1048576
- query_cache_min_res_unit 4096
- query_cache_size 4294966272
- query_cache_type ON
- query_cache_wlockinvali OFF
- Variable name Value
- Qcache free blocks54564
- Qcache free_memory 3838310960
- Qcache hits 26704566
- Qcache inserts 8459700
- Qcache lowmem_prunes
- Qcache_not_cached 5912360
- Qcache_queries_in_cache 263249
- Qcache total blocks 583383
复制代码
my.ini 内容
- [client]
- default-character-set=utf8
- port=3306
- [mysqld]
- character_set_server=utf8
- port=3306
- datadir=D:\websoft\mysql-5.6.15\data
- basedir=D:\websoft\mysql-5.6.15
- tmpdir =D:\websoft\mysql-5.6.15\data
- socket =D:\websoft\mysql-5.6.15\data\mysql.sock
- slow_query_log_file=D:\websoft\mysql-5.6.15\log\slow.log
- log-bin=mysql-bin
- binlog_format=mixed
- server_id = 1
- slow_query_log = ON
- slow-query-log-file = D:\websoft\mysql-5.6.15\data\mysql-slow.log
- long_query_time = 30
- #skip-locking
- max_connections = 5000
- table_open_cache = 10240
- query_cache_size = 10240M
- tmp_table_size = 10240M
- thread_cache_size = 2560
- binlog_cache_size = 2560K
- thread_stack = 5120K
- read_buffer_size = 8096K
- query_cache_type = 1
- max_heap_table_size = 2048M
- key_buffer_size = 10240M
- expire_logs_days = 10
- innodb_data_home_dir = D:\websoft\mysql-5.6.15\data
- innodb_flush_log_at_trx_commit =1
- innodb_log_buffer_size = 8096M
- innodb_buffer_pool_size = 8024M
- innodb_log_file_size=10240M
- innodb_thread_concurrency=32
- innodb-autoextend-increment=1000
- join_buffer_size = 8192K
- sort_buffer_size = 8096K
- read_rnd_buffer_size = 8048K
- max_allowed_packet = 32M
- explicit_defaults_for_timestamp=true
- sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
- [myisamchk]
- key_buffer_size = 10240M
- sort_buffer_size = 5120M
- read_buffer = 2560M
- write_buffer = 2560M
复制代码 |