服务器的配置是Xeon E5506 2.13GHz*2  8G内存
日访问IP13W  pv在300W  目前还在增长中, 我现在的配置白天非常的快,就是到晚上高峰的时候会出现问题,数据库卡死.,我用的是IIS+PHP+MYSQL,现在服务器的内存和cpu消耗都很少,请不要给我更换linux  或换apache等建议,本人不熟悉.希望各位高手能给我个配置,谢谢目前的配置:
max_connections=500
query_cache_size=128M
table_cache=512
tmp_table_size=16M
thread_cache_size=64
myisam_max_sort_file_size=100G
myisam_max_extra_sort_file_size=100G
myisam_sort_buffer_size=16M
key_buffer_size=2G
read_buffer_size=8M
read_rnd_buffer_size=32M
sort_buffer_size=4M
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=22M
innodb_log_file_size=10M
innodb_thread_concurrency=18下面是运行信息

解决方案 »

  1.   

    首先确定你用的是什么存储引擎如果是innodb的 
    那么innodb_buffer_pool_size=22M改成4G
      

  2.   


    mysql> show engines;
    +------------+---------+--------------------------------------------------------
    --------+
    | Engine     | Support | Comment
            |
    +------------+---------+--------------------------------------------------------
    --------+
    | MyISAM     | YES     | Default engine as of MySQL 3.23 with great performance
            |
    | MEMORY     | YES     | Hash based, stored in memory, useful for temporary tabl
    es      |
    | InnoDB     | DEFAULT | Supports transactions, row-level locking, and foreign k
    eys     |
    | BerkeleyDB | NO      | Supports transactions and page-level locking
            |
    | BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disa
    ppears) |
    | EXAMPLE    | YES     | Example storage engine
            |
    | ARCHIVE    | YES     | Archive storage engine
            |
    | CSV        | NO      | CSV storage engine
            |
    | ndbcluster | NO      | Clustered, fault-tolerant, memory-based tables
            |
    | FEDERATED  | YES     | Federated MySQL storage engine
            |
    | MRG_MYISAM | YES     | Collection of identical MyISAM tables
            |
    | ISAM       | NO      | Obsolete storage engine
            |
    +------------+---------+--------------------------------------------------------
    --------+
    12 rows in set (0.00 sec)
      

  3.   

    MyISAM | YES | Default 
    如果建表没有指定engine则用的是myisam引擎
    myisam由于其没有行锁,本身并发就会慢
      

  4.   

    那我上面的my.ini有什么问题呢?
      

  5.   

    max_connections=500
    太少了吧?你可以自己做些并发测试,一般cpu或者内存都剩余很多,那就应该考虑是不是最大连接数太低了,导致连接都在等待,使得连接网站非常慢你也可以将apache的mod_cache,mod_mem_cache模块打开,让网站缓存,减少磁盘读写时间,提高速度,这样会消耗一些内存
      

  6.   

    我用的是IIS,还有phpmyadmin里面的统计信息显示连接数都没有超过400过