linux debian 6nginx + fpm + mysql测试工具webbench 当my.cnf 中的max_connetcions为50时,webbench 并发500 个带数据库操作的php页面。从命令show processlist来看. 数量为50当my.cnf中的max_connetcions为300或更多时,webbench 并发500个带数据库操作的php页面。从命令show processlist来看. 最大数量为203也就是无论怎么设置还是并发数为203, 首先php-fpm和nginx我已经测试过了并发1000以上没有任何问题,只不过响应时间要长几秒而以。求解为什么我只mysql只能有203个connections???my.cnf
---------------------------------[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8
max_connections=2000
log-bin=mysql-bin
server-id       = 1[mysqldump]
quick
max_allowed_packet = 16M[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M[mysqlhotcopy]
interactive-timeout
linux 系统参数ulimit -n  65536*  soft 65536
* hard 65536/etc/sysctl.conf 
---------------------------
# Controls IP packet forwarding
net.ipv4.ip_forward = 0# Controls source route verification
net.ipv4.conf.default.rp_filter = 1# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1# Controls the use of TCP syncookies
#net.ipv4.tcp_syncookies = 1
#net.ipv4.tcp_tw_reuse = 1
#net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_fin_timeout = 30# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456net.ipv4.tcp_max_syn_backlog = 4096
net.core.netdev_max_backlog = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 32768 65000
net.ipv4.tcp_keepalive_time = 12000
net.ipv4.tcp_max_tw_buckets = 12000
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_wmem = 8192 436600 873200
net.ipv4.tcp_rmem  = 32768 436600 873200
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_fin_timeout = 30
MySQL数据库

解决方案 »

  1.   

    用mysql客户端连进去试试   用户就用程序的用户名   看看连接能涨上去不  如果能  则是程序问题
      

  2.   

    navicat mysql 建立了两个 连接。分别指和同一个DB  只打开一个的情况下 show processlist 为 204此时打开另一个连接情况下为205..  这是否说有我用 webbench测试只能达到最多204个连接,与数据库性能无关
      

  3.   

    另外,我用两台不同的机器 分别使用 webbench来测试一个web地址。。但连接数还是没改变
      

  4.   

    直接登录在数据库所有服务器测试。 有些时候操作系统会有最大 TCP 连接数限制。
      

  5.   

    最大tcp 和一数内核参数我已经调整过了
      

  6.   

    你测试是同一MYSQL账号?
    mysql> show variables like"max_user%";
    +----------------------+-------+
    | Variable_name        | Value |
    +----------------------+-------+
    | max_user_connections | 0     |
    +----------------------+-------+    
    这个值是每个mysql账号的最大连接数。0是不限制