免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12345
最近访问板块 发新帖
楼主: yzfighter
打印 上一主题 下一主题

请教:1G内存能承受多少并发连接数 [复制链接]

论坛徽章:
62
2016科比退役纪念章
日期:2016-06-28 17:45:06奥兰多魔术
日期:2015-05-04 22:47:40菠菜神灯
日期:2015-05-04 22:35:07菠菜神灯
日期:2015-05-04 22:35:02NBA季后赛大富翁
日期:2015-05-04 22:33:34NBA常规赛纪念章
日期:2015-05-04 22:32:032015年亚洲杯纪念徽章
日期:2015-04-14 16:54:452015年亚洲杯之朝鲜
日期:2015-03-19 23:03:16明尼苏达森林狼
日期:2015-03-16 21:51:152015小元宵徽章
日期:2015-03-06 15:57:202015年迎新春徽章
日期:2015-03-04 09:55:282015年辞旧岁徽章
日期:2015-03-03 16:54:15
41 [报告]
发表于 2005-09-02 14:57 |只看该作者

请教:1G内存能承受多少并发连接数

原帖由 "befeel" 发表:
俺的mysql服务器跑cacti,刚装好做测试,跑了一天后有2000多个线程
ps -ef | grep mysql | wc -l
2400
一会儿mysql就死了,俺把进程杀光以后用/etc/init.d/mysql restart重启mysql恢复正常,大概这是啥问题呢.
PS,我..........


正常一个不做任何操作的空连接会消耗1~2M的内存,这是不做任何操作的情况、。如果做简单的update,select操作,根据总结出的数据量5M~10G不等。
10G以上就不考虑了。

你的情况很大可能是连了数据库没有断开。

论坛徽章:
0
42 [报告]
发表于 2005-09-02 16:33 |只看该作者

请教:1G内存能承受多少并发连接数

兄弟们有话好好说

希望争论的朋友从$(MYSQL)/docs/mysql.info里能得到一些启示。另外看了一下源代码,没找到对连接数的设置做最大限制,只是与max_connections比较而已

If you build MySQL yourself, you can patch LinuxThreads for
better stack use. See *Note source-notes-linux::. If           you do
not want to patch LinuxThreads, you should set
`max_connections' to a value no higher than           500. It should be
even less if you have a large key buffer,           large heap tables,
or some other things that make           `mysqld' allocate a lot of
memory, or if you           are running a 2.2 kernel with a 2GB patch.
If you are using           our binary or RPM version 3.23.25 or later,
you can safely set           `max_connections' at 1500, assuming no
large           key buffer or heap tables with lots of data. The more
you           reduce `STACK_SIZE' in LinuxThreads the more
threads you can safely create. We recommend values between
128KB and 256KB.
......


(注:MYSQL做过的benchmark)
We have tested MySQL on the 2.4 kernel on a two-CPU machine
and found MySQL scales _much_ better. There           was virtually no
slowdown on query throughput all the way up           to 1,000 clients,
and the MySQL scaling factor (computed as           the ratio of
maximum throughput to the throughput for one           client) was
180%. We have observed similar results on a           four-CPU system:
Virtually no slowdown as the number of           clients was increased
up to 1,000, and a 300% scaling factor.            Based on these
results, for a high-load SMP server using a 2.2           kernel, we
definitely recommend upgrading to the 2.4 kernel at           this
point.

We have discovered that it is essential to run the           `mysqld'
process with the highest possible           priority on the 2.4 kernel
to achieve maximum performance.            This can be done by adding a
`renice -20 $$'           command to `mysqld_safe'. In our testing on a
         four-CPU machine, increasing the priority resulted in a 60%
       throughput increase with 400 clients.

论坛徽章:
0
43 [报告]
发表于 2005-09-03 10:11 |只看该作者

请教:1G内存能承受多少并发连接数

我最近也碰到了,以前服务器运行良好。但是最近不知道怎么回事,mysql进程在短期内迅速增加,然后网站就不能连接了。

我的具体问题请看这:
http://bbs.chinaunix.net/forum/viewtopic.php?show_type=&p=4043901#4043901

论坛徽章:
62
2016科比退役纪念章
日期:2016-06-28 17:45:06奥兰多魔术
日期:2015-05-04 22:47:40菠菜神灯
日期:2015-05-04 22:35:07菠菜神灯
日期:2015-05-04 22:35:02NBA季后赛大富翁
日期:2015-05-04 22:33:34NBA常规赛纪念章
日期:2015-05-04 22:32:032015年亚洲杯纪念徽章
日期:2015-04-14 16:54:452015年亚洲杯之朝鲜
日期:2015-03-19 23:03:16明尼苏达森林狼
日期:2015-03-16 21:51:152015小元宵徽章
日期:2015-03-06 15:57:202015年迎新春徽章
日期:2015-03-04 09:55:282015年辞旧岁徽章
日期:2015-03-03 16:54:15
44 [报告]
发表于 2005-09-05 10:08 |只看该作者

请教:1G内存能承受多少并发连接数

原帖由 "okjooo" 发表:
我最近也碰到了,以前服务器运行良好。但是最近不知道怎么回事,mysql进程在短期内迅速增加,然后网站就不能连接了。

我的具体问题请看这:
http://bbs.chinaunix.net/forum/viewtopic.php?show_type=&p=4043901..........


增加了多少?现在是多少

论坛徽章:
0
45 [报告]
发表于 2005-09-06 11:35 |只看该作者

请教:1G内存能承受多少并发连接数

使用 ps -ef|grep httpd|wc -l  查看,有时候达到 1980(平常也就200-400之间),使用Top命令查看显示 3433 processes(平常是在300-600之间)。但是这个时候cpu显示非常空闲。

使用 ps -ef | grep mysql | wc -l  查询一般都是 100多,但是有的时候访问非常少的时候他也不降下来,一直维持一个固定的数,比如 100 ,你用 ps -ef | grep mysql | wc -l 查询多次,他会稳定在 100 很长时间除非流量明显增加。明显减少他也不降低。为何?

我用 phpMyAdmin 里使用SHOW PROCESSLIST 查询,一般都在 10多个左右。
为什么呢?

mysql 不能访问的时候一般都是 Apache 达到800并发,Mysql 达到 600。

这2个查询有什么区别?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP