mysql max connection_我应该为MySQL设置什么max_connection?

bd96500e110b49cbb3cd949968f18be7.png

I am using MySQL 5.1.35 database on Linux Centos.

The Linux server has 2GB RAM with 14GB of disk space.

I have created webservices using Restlet framework in Java which has thousand user access.

I want to set max_connection for maximum concurrent connections.

So please suggest me that what max_connection should I set?

Thanks in advance.

解决方案

You need to calculate the memory required by your MySQL engine. See manual here

If you are using MYISAM tables then you can calculate memory requirement using following formula:

key_buffer_size + (read_buffer_size + sort_buffer_size) * max_connections = K bytes of memory

Ideally this should not exceed 2 GB in your case.

Configuration parameters depends on type of your application and querys, but standard values for you could be:

key_buffer_size = 1024MB + (read_buffer_size = 1MB + sort_buffer_size = 4MB) * 200 ~= 2GB

key_buffer_size is a global variables whereas read_buffer_size and sort_buffer_size are session level parameters.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值