请教一个gc的问题

81 views
Skip to first unread message

Simon Liu

unread,
Aug 30, 2012, 11:04:49 PM8/30/12
to golang...@googlegroups.com
大家在线上跑go写的server的时候,gc的影响大吗?如果很大的话,怎么解决的?隔段时间重启吗。。。

Felix Sun

unread,
Aug 30, 2012, 11:28:51 PM8/30/12
to golang...@googlegroups.com
不大,从来没重启过,也没遇到GC的问题。

2012/8/31 Simon Liu <simohay...@gmail.com>:


> 大家在线上跑go写的server的时候,gc的影响大吗?如果很大的话,怎么解决的?隔段时间重启吗。。。
>

> --
> 官网: http://golang-china.org/
> IRC: irc.freenode.net #golang-china
> @golangchina

Kula

unread,
Aug 30, 2012, 11:43:20 PM8/30/12
to golang...@googlegroups.com
你有在线上遇到问题吗? 什么问题?

2012/8/31 Simon Liu <simohay...@gmail.com>
大家在线上跑go写的server的时候,gc的影响大吗?如果很大的话,怎么解决的?隔段时间重启吗。。。

--

sharp

unread,
Aug 30, 2012, 11:55:50 PM8/30/12
to golang...@googlegroups.com
你用的什么操作系统啊

在 2012年8月31日 上午11:04,Simon Liu <simohay...@gmail.com>写道:
大家在线上跑go写的server的时候,gc的影响大吗?如果很大的话,怎么解决的?隔段时间重启吗。。。

--

Monnand

unread,
Aug 31, 2012, 12:01:44 AM8/31/12
to golang...@googlegroups.com
On 08/30/2012 11:43 PM, Kula wrote:
> �������������������� ʲô���⣿
>

go-nuts����һƪ�ʼ�����Ҳ������Ȥ��
https://groups.google.com/forum/#!topic/golang-nuts/hC0aJ8IASi4

ԭ�ĺͱ��˵ķ������£�
100% of our production system is now running Go as 95% of our
application (C being the other bits). Not side bits, but our critical
path.

�ٷ�֮�ٵ����ϵͳ����ʹ��Go������95%��Ӧ��Ҳ��Go������ʣ�µ���C��
��������Щ�������޹ؽ�Ҫ�ĵط�������ϵͳ�ĺ��IJ��֡�

We're running around 800 million requests a month
through our various public-facing sites run on more than
500 servers on AWS.

���ǵ�ϵͳÿ�´���а��ڸ������������źܶ���վ�������������������ѷ��
���ϡ�

Sites we power that are in pure-Go..
http://m.macys.com
http://m.1800flowers.com
...and a lot more.

������ϵͳ�����е���վ�У�
http://m.macys.com
http://m.1800flowers.com
�ȵȡ�

We are running this on our production servers, but we
also have a local development env that our customers run
and that is compiled in all three major operating systems.
We have a binary executable available for Linux, Mac OSX,
and *gasp* Windows!

����������ķ�������������Щ���򣬲���Ҳͬ���ṩһ�ף���Go�����ģ���
�صĿ����������ͻ�ʹ�á����׻���Ŀǰ֧���������ƽ̨������Linux��Mac OSX
�Լ�����̾һ��������Windows��

Since 1.0, Go has been ridiculously stable for us and
the decision to switch has been one of the better decisions
we've made as a business.

Go 1֮��Go���Լ����ȶ������Ǿ���ȫ��ת��Goƽ̨��������������ǵġ�

The power and speed of a compiled language, with the
flexibility and agility that we've come to expect in a
modern language.

��Go���ԣ����ű��������Ե��������ٶȣ��־߱��ִ����Ե��������ݡ�

-Hampton Catlin.
VP of Technology, Moovweb
http://twitter.com/hcatlin


PS: Also included a photo of our team with various Gopher
talisman's we keep around.

�����������ǵ��Ŷӣ���������һ��Gopher��ż

PPS: If you are in SF and want to chat with us, send me an email
and we'll chat!

������ھɽ�ɽ����������Ȥ���������ģ���ӭ���ʼ�����


> 2012/8/31 Simon Liu <simohay...@gmail.com
> <mailto:simohay...@gmail.com>>
>
> �����������goд��server��ʱ��gc��Ӱ��������ܴ�Ļ�����ô���
> �ģ�����ʱ�������𡣡���
>
> --
> ����: http://golang-china.org/
> IRC: irc.freenode.net <http://irc.freenode.net> #golang-china
> @golangchina
>
>
> --
> ����: http://golang-china.org/
> IRC: irc.freenode.net #golang-china
> @golangchina

ngaut

unread,
Aug 31, 2012, 2:23:45 AM8/31/12
to Golang-China
用go写了一个pub/sub服务器,操作系统windows xp 和 windows 7 32位
gc相当不给力,压力测试,不超过20秒内存就达到2G,然后系统内存不够,程序挂了。
最后关键地方用go调用c来分配和回收内存搞定。
go现在对大块的内存处理还不给力,这部分还在改进。
具体解决方案参考这里:http://www.cnblogs.com/gongaut/archive/
2012/04/06/2434207.html

南海

unread,
Aug 31, 2012, 2:29:02 AM8/31/12
to golang...@googlegroups.com
你确定你发的url可以打开?


--
官网: http://golang-china.org/
IRC:  irc.freenode.net     #golang-china
@golangchina

Wenlei Wu

unread,
Aug 31, 2012, 2:32:56 AM8/31/12
to golang...@googlegroups.com
分两段完整地址如下。

minux

unread,
Aug 31, 2012, 2:50:01 AM8/31/12
to golang...@googlegroups.com

2012/8/31 ngaut <nga...@gmail.com>
这个问题的workaround说过多少次了,用64位的Go。
用Go做服务器端的尤为如此。

而且就算不用Go,对于服务器来说,使用64位系统是基本上是必须的。

ngaut

unread,
Aug 31, 2012, 3:12:41 AM8/31/12
to Golang-China
服务器用户自己做的就是32位的windows xp或者2003,我们只提供自己的程序,没理由要求用户换64位,用户也不乐意:)

minux

unread,
Aug 31, 2012, 3:27:21 AM8/31/12
to golang...@googlegroups.com

2012/8/31 ngaut <nga...@gmail.com>

服务器用户自己做的就是32位的windows xp或者2003,我们只提供自己的程序,没理由要求用户换64位,用户也不乐意:)
那可以用CL 6114046。不过你得自行merge下,这个CL的最后更新是2个月前。
当然如果你用release版,可能merge会简单些。

目前这个CL正在被缓慢被merge,可惜最近Russ Cox同学家里有事儿,进展一直缓慢。
但是我感觉这个最终出现在Go 1.1还是毫无疑问的(不过Go 1.0.3肯定不可能了,即使
在Go 1.0.3发布前merge完了)。

ngaut

unread,
Aug 31, 2012, 3:57:51 AM8/31/12
to Golang-China
这个改动还是很大的,没有足够的测试估计悬,scheduler的并行gc和降低多核的锁消耗相关的代码也一直在变化,
正式的release估计至少要等到明年中旬了,看起来打算用go写server的人不少,呵呵,等不起啊,暂时先用别的方案解决gc的问题,
go还是用官方的标准的release版本好些,经过的测试多。毕竟不是每个人都像minux大牛对go研究得深。
另外问下北京这边有没有人组织golang的聚会啥的:) 请minux大牛给大家分享go相关的经验

南海

unread,
Aug 31, 2012, 4:50:59 AM8/31/12
to golang...@googlegroups.com
用window做go的服务器
太狠了
老老实实的换成linux吧

Monnand

unread,
Aug 31, 2012, 10:20:12 AM8/31/12
to golang...@googlegroups.com
On 08/31/2012 03:27 AM, minux wrote:
>
> 2012/8/31 ngaut <nga...@gmail.com <mailto:nga...@gmail.com>>
>
> �������û��Լ����ľ���32λ��windows xp����2003������ֻ�ṩ�Լ��ij�
> ��û����Ҫ���û���64λ���û�Ҳ�����⣺��
>
> �ǿ�����CL 6114046 <http://codereview.appspot.com/6114046/>�����������
> ��merge�£����CL����������2����ǰ��
> ��Ȼ�������release�棬����merge���Щ��
>
> Ŀǰ���CL���ڱ�����merge����ϧ���Russ Coxͬѧ�������¶��չһֱ����
> �����Ҹо�������ճ�����Go 1.1���Ǻ������ʵģ�����Go 1.0.3�϶��������ˣ���ʹ
> ��Go 1.0.3����ǰmerge���ˣ���

OTһ�£��ҿ���CL 6114046 <http://codereview.appspot.com/6114046/> ���ᵽ
�˲���������ա�������Դ�Ż���ʲôʱ����������

>
> --
> ����: http://golang-china.org/
> IRC: irc.freenode.net #golang-china
> @golangchina

Simon Liu

unread,
Aug 31, 2012, 11:49:10 AM8/31/12
to golang...@googlegroups.com, www.sh...@gmail.com
主要是我记得youtube的人说他们的vitess是每3-4秒延迟200ms,所以我就想问问现在gc的情况。。

minux

unread,
Sep 1, 2012, 3:29:42 AM9/1/12
to golang...@googlegroups.com

2012/8/31 Monnand <mon...@gmail.com>
OT一下,我看到CL 6114046 <http://codereview.appspot.com/6114046/> 上提到
了并行垃圾回收。这个特性大概会在什么时候加入进来?
Dmitriy Vyukov前一阵(5月)在搞这个,已经提交了以下改动,
后来又有几个小的性能微调,其他的暂时不知道;


PS: 可能还有人不清楚,我详细说下Go release相关的事情:
1, Go 1之后取消weekly发布,理由是这样会fragment user base
至少在短期内不会恢复;想要尝鲜的直接建议使用default分支;它是足够稳定的;

2, 当积累了足够的重要的bugfixes之后,会考虑发布一个新的Go 1.0.x版本;
其特点是:cherry pick一部分default分支的commit到release分支;要求是
不引入任何API改动(新加入API都不会考虑,如果一个bugfix必须引入新API,
那么要么这个改动不被选择要么会把导出符号改成非导出符号);保证用户
可以安全升级。

这个版本的发布流程大概包括如下三歩:
(1) 在golang-dev发布一个表格指示哪些commit计划被加入新的发布;此阶段
接受意见,但是绝大多数情况下只会接受反对加入某个commit的意见;想要
加入一个新commit是要花很大精力的。
这个表格以CL的形式发布方便大家评论。
示例:http://codereview.appspot.com/6279048/  (cherry pick的过程是自动的,
这个CL里面包含所需要的所有脚本)
(2) 在golang-dev发布几个preview,但是都不打包,需要自己去clone然后测试,
面向开发者
(3) 发布
在所有支持的系统上编译测试然后制作安装包,测试;上传到
http://code.google.com/p/go/downloads/list;然后在go-nuts发布更新说明;

关于Go 1.0.3的发布日期到现在也没有确定;而且还有标记优先级为Soon的问题
没解决,所以可能还得等等;

3,经过足够考验后的default分支在合适的时候用来发布Go 1.1
所有前段时间的改变,包括新添加的API会在这个时候发布出来。
也就是这次会是个merge。据说是今年年底发布这个。

Reply all
Reply to author
Forward
0 new messages