﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Sheppard Y-随笔分类-golang</title><link>http://www.cppblog.com/yangsf5/category/20712.html</link><description>keep thinking keep coding.</description><language>zh-cn</language><lastBuildDate>Tue, 12 Jul 2016 18:59:40 GMT</lastBuildDate><pubDate>Tue, 12 Jul 2016 18:59:40 GMT</pubDate><ttl>60</ttl><item><title>一次简单的hack</title><link>http://www.cppblog.com/yangsf5/archive/2014/05/15/206970.html</link><dc:creator>Sheppard Y</dc:creator><author>Sheppard Y</author><pubDate>Thu, 15 May 2014 03:11:00 GMT</pubDate><guid>http://www.cppblog.com/yangsf5/archive/2014/05/15/206970.html</guid><wfw:comment>http://www.cppblog.com/yangsf5/comments/206970.html</wfw:comment><comments>http://www.cppblog.com/yangsf5/archive/2014/05/15/206970.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yangsf5/comments/commentRss/206970.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yangsf5/services/trackbacks/206970.html</trackback:ping><description><![CDATA[<div><div></div><fieldset><legend><span style="color: #ff0000; line-height: normal;">2016-07-12 日更新&nbsp;</span></legend><div><span style="line-height:normal;color:red;">此篇博客已经迁移到新博客，并做行文检查和优化排版：<br /></span><div></div></div><a href="http://blog.clawz.me/2014/05/15/14-a-easy-hack/"><div><div><span style="color:red;">http://blog.clawz.me/2014/05/15/14-a-easy-hack/</span></div></div></a></fieldset><a href="http://blog.clawz.me/2014/05/15/14-a-easy-hack/"><div><div></div></div><span style="orphans: 2; text-align: -webkit-auto; widows: 2;"></span></a><span style="orphans: 2; text-align: -webkit-auto; widows: 2;"><br /><font face="微软雅黑" size="3"><span style="line-height: normal;">一、背景</span></font></span><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;朋友公司有款老软件，运行在windows下，C/S架构。客户端为很久前外包开发的。这个客户端为GUI界面。朋友想定时自动让软件做些事情。这个客户端以前设计时没有提供这种定时功能，只有每次执行当次的操作。朋友自己对软件开发不熟，如是找到我。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">二、朋友给的解决方案</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;他表示做个按键脚本之类的，定时的去模拟在客户端上的单次操作。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">三、我的解决方案</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（一）了解需求</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;这是C/S架构，之前是每次鼠标点击后，客户端给服务器发送相应的网络包。现在要做的是破解这个协议，然后自己写程序定时发送对应协议的网络包即可。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（二）解决方案</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;朋友的解决方案，对于擅长客户端的人是可以的。但是我不怎么擅长，会花不少时间。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;所以我选择我自己更擅长的网络编程。如上边说的，先破解协议，然后想干啥就非常方便了。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">四、解决过程</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（一）破解协议</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;本想找个协议监听软件，我来远程操作就行了，但是他们使用环境公网无法连入。如果我写文档让他来按步骤走，对于非专业人士来说也挺费事的。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;随后我想到他们的行业不那么互联网，他们联系的外包素质应该不是那么高。估计也就是windows那套.net搞的，顶多也就java搞的。所以让他把客户端拷出外网，我来反编译试试。同时我去网上查下.net的反编效果，有网游表示没有混效果的C#代码反编出来跟源代码基本没啥区别，另外以前反编译过java，反编得的代码也跟原工程差不多。所以开始淡定的祈祷反编顺利。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;看了眼客户端里的各文件，感觉到是C#，找了个dotPeek，反编译出来相当清晰。（这玩意的反编译效果比以前反编译flash的代码还清晰，flah反编译后的变量名基本编程local1之流了，这个C#反编出来变量名都是好的）</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（二）分析协议</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;C#代码虽没写过，但是语法跟Java/C++非常像。分析起来不是很费劲。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;果然代码写的很windows的.net，客户端直接连接的数据库，然后在客户单发起select之类的查询语句。数据库表和字段名基本是中文拼音首字母。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;后来具体逻辑也懒得看，直接找到数据库的配置，让朋友在内网装个数据库客户端，连数据库看表里数据了。让他比对表里数据和客户端软件上显示的数据对比，找出咱们要的哪几个字段。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（三）实现需求</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;这个是整个过程里最简单的了。用了自己最喜欢的golang写了个没有GUI的程序，定时给他去数据库查想要的数据。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">五、后记</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;整个过程的顺利多亏给他们写外包的公司用的C#，还没有做代码混淆之类的。</div></div><img src ="http://www.cppblog.com/yangsf5/aggbug/206970.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yangsf5/" target="_blank">Sheppard Y</a> 2014-05-15 11:11 <a href="http://www.cppblog.com/yangsf5/archive/2014/05/15/206970.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>claw设计草稿</title><link>http://www.cppblog.com/yangsf5/archive/2014/03/31/206404.html</link><dc:creator>Sheppard Y</dc:creator><author>Sheppard Y</author><pubDate>Mon, 31 Mar 2014 03:09:00 GMT</pubDate><guid>http://www.cppblog.com/yangsf5/archive/2014/03/31/206404.html</guid><wfw:comment>http://www.cppblog.com/yangsf5/comments/206404.html</wfw:comment><comments>http://www.cppblog.com/yangsf5/archive/2014/03/31/206404.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yangsf5/comments/commentRss/206404.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yangsf5/services/trackbacks/206404.html</trackback:ping><description><![CDATA[<div><div><div><div></div><fieldset><legend><span style="color: #ff0000; line-height: normal;">2016-07-12 日更新&nbsp;</span></legend><div><span style="line-height:normal;color:red;">此篇博客已经迁移到新博客，并做行文检查和优化排版：<br /></span><div></div></div><a href="http://blog.clawz.me/2014/03/31/14-claw-design/"><div><div><span style="color:red;">http://blog.clawz.me/2014/03/31/14-claw-design/</span></div></div></a></fieldset><a href="http://blog.clawz.me/2014/03/31/14-claw-design/"><div><div></div></div><span style="orphans: 2; text-align: -webkit-auto; widows: 2;"></span></a><span style="orphans: 2; text-align: -webkit-auto; widows: 2;"><br /><font face="微软雅黑" size="3"><span style="line-height: normal;">一、目标</span></font></span><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;参考云风skynet，实现go版本的开源服务器引擎。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">二、细节</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（一）服务</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;按服务来拆模块的好处不说了。只说go来的实现方式。go里有channel和goroutine。消息队列和轻量级线程都天然解决了。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（二）服务间的通信</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;同进程内的服务之间通信，直接往对方channel发消息即可。不同进程里靠各进程自己的harbor服务来转发。harbor服务来负责集群间的通信。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;集群里设置一个master服务来做全局的名字服务，主要用于登记和同步集群里各个进程开启的各个服务。所有harbor启动后向master注册自己，master向所有harbor广播同步新加入的这个机器。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（三）组播</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;经常需要向某几个服务广播一个消息，组播问题。multicast服务来管理组播。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（四）日志</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;使用glog。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">三、已实现的服务</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（一）master和harbor</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;暂时master做为harbor的中心控制器的。后续会改进，做成harbor之间两两通信，减少对master的单点依赖。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（二）gate</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;gate用来做通常的网络监听用。目前的很简单，用户需要向这个服务器注册自己的包解析和处理器。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">（三）web</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;web负责http的监听，template的加载cache，几个通用函数的提取。</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">四、ps</div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;">&nbsp; &nbsp; &nbsp;项目地址：<a href="https://github.com/yangsf5/claw">https://github.com/yangsf5/claw</a></div></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"><a href="https://github.com/yangsf5/claw"></a></div></div><div style="font-family: 微软雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; font-size: medium;"></div></div><img src ="http://www.cppblog.com/yangsf5/aggbug/206404.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yangsf5/" target="_blank">Sheppard Y</a> 2014-03-31 11:09 <a href="http://www.cppblog.com/yangsf5/archive/2014/03/31/206404.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>集群实现细节（1）-异服通信和压测</title><link>http://www.cppblog.com/yangsf5/archive/2013/10/17/203784.html</link><dc:creator>Sheppard Y</dc:creator><author>Sheppard Y</author><pubDate>Thu, 17 Oct 2013 06:45:00 GMT</pubDate><guid>http://www.cppblog.com/yangsf5/archive/2013/10/17/203784.html</guid><wfw:comment>http://www.cppblog.com/yangsf5/comments/203784.html</wfw:comment><comments>http://www.cppblog.com/yangsf5/archive/2013/10/17/203784.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yangsf5/comments/commentRss/203784.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yangsf5/services/trackbacks/203784.html</trackback:ping><description><![CDATA[<p>&nbsp;</p><fieldset><legend><span style="color: #ff0000;">&nbsp;2016-07-11 日更新&nbsp;</span></legend><div><span style="color:red;">此篇博客已经迁移到新博客，并做行文检查和优化排版：</span></div><div></div><a href="http://blog.clawz.me/2013/10/17/13-game-cluster-design-detail-1/"><div><span style="color:red;">http://blog.clawz.me/2013/10/17/13-game-cluster-design-detail-1/</span></div></a></fieldset><a href="http://blog.clawz.me/2013/10/17/13-game-cluster-design-detail-1/"><div></div><p>&nbsp;</p></a><p><br /></p><p>一、背景</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;项目开始后，先敲定了大体可横向扩展的集群架构（这是个美好的期望），然后开始编写单进程的服务器底层和逻辑，让前边几个迭代周期的逻辑内容配合客户端跑起来了。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;接着就是将单进程的架构扩展起来，设计上细化下架构的扩展。已写在前篇《休闲手游服务器集群扩展思考》里。最近的两周在将之前单进程的服务器架构里部分模块扩展为支持这篇随笔里提到的集群架构。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;实现的过程中碰到的一些需要仔细设计的细节，原则上还是K.I.S.S。</p> <p>&nbsp;</p> <p>二、全服玩家在线状态</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;逻辑服务器集群的负载均衡算法还没实现。先只扩展玩家间的同服通信为异服通信（通过redis的pub/sub，以下将这个用于通信转发的redis简称为通信redis）。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;问题链：（&#8220;--&gt;&gt;&#8221;引出的下个问题被当前问题所依赖）</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;通信发起方需要知道目标方在逻辑集群里的哪个服务器上  --&gt;&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;玩家登陆和退出时往通信redis报告  --&gt;&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;登陆时检查账号是否注册到我们的游戏，否就注册  --&gt;&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p> <p>（一）登陆和注册</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;玩家拿到用户系统的账号来登陆我们游戏服务器。游戏服务器拿client给的这个code再去用户系统服务器做验证，通过后继续。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;检查账号是否在我们游戏注册，如果没有则注册上，映射出游戏服务器上的一个local  uid。这里需要检查玩家是否在游戏注册了，所以需要一个platform uid与local  uid的映射表。这个映射之前单进程服务器时与其他角色数据放在相同redis上的，现在移到全局类的redis上（以下简称全局redis，暂时是将通信redis和全局redis放一起的，等以后看压测和线上反馈再做演变）。另外用来本地注册生成local  uid的自增长id也移到了全局redis上。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&#8203;检查完注册，得到local  uid，先看是否在本服务器登陆了，否则再向通信redis查看是否登陆在其他服务器。如果已登陆，则踢掉之前的登陆。之前单进程只有同服重复登陆踢人，现在多个异服重复登陆的踢人操作。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;登陆成功向通信redis报告local uid和所在的这个logic服务器的server  id。另外退出时也向通信redis报告，注销掉这条记录。</p> <p>&nbsp;</p> <p>（二）异服通信</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;每个逻辑服务器都与通信redis建立用于pub/sub的链接，各逻辑服务器有自己的频道。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;异服上的玩家通信时，从通信redis拿到目标玩家所在server  id，让后向目标server所对应的专有频道pub数据即可。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;</p> <p>三、压测工具</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;加了这个集群扩展后，底层测试只是单元测试是不够的。反正要压力测试工具迟早要写，就先写了简单版的压测工具，来做异服通信的自动化测试。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;压测工具开始的想法挺多的，后来抛弃了一些短期不好实现的想法。现在就简单的，一个client一个Client  struct，这个处理client的通信发送接收。做相同动作的client为一个Group struct。每个动作为一个Rule  struct，里边组合好收到什么包后做什么事情，或者直接发些什么包。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;c++端游压测的每个Rule动作一般用lua来写的，比较方便，我们这个压测工具用go写，rule暂时也用go写，也不麻烦。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;感慨下，这种并行的应用场景，go的编程思维与具体写法比node.js更适合c/c++出身的程序员。</p><p>&nbsp;</p><img src ="http://www.cppblog.com/yangsf5/aggbug/203784.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yangsf5/" target="_blank">Sheppard Y</a> 2013-10-17 14:45 <a href="http://www.cppblog.com/yangsf5/archive/2013/10/17/203784.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我就先不学Go语言了（后来还是学了）</title><link>http://www.cppblog.com/yangsf5/archive/2013/04/08/199232.html</link><dc:creator>Sheppard Y</dc:creator><author>Sheppard Y</author><pubDate>Mon, 08 Apr 2013 10:29:00 GMT</pubDate><guid>http://www.cppblog.com/yangsf5/archive/2013/04/08/199232.html</guid><wfw:comment>http://www.cppblog.com/yangsf5/comments/199232.html</wfw:comment><comments>http://www.cppblog.com/yangsf5/archive/2013/04/08/199232.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yangsf5/comments/commentRss/199232.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yangsf5/services/trackbacks/199232.html</trackback:ping><description><![CDATA[<div></div><fieldset><legend><span style="color: #ff0000;">2016-07-06 日更新&nbsp;</span></legend><div><span style="color:red;">此篇博客已经迁移到新博客，并做行文检查和优化排版：</span></div><div></div><a href="http://blog.clawz.me/2013/03/29/13-study-golang/"><div><span style="color:red;">http://blog.clawz.me/2013/03/29/13-study-golang/</span></div></a></fieldset><a href="http://blog.clawz.me/2013/03/29/13-study-golang/"><div></div><p>&nbsp;</p></a><p><br />一、为什么想了解Go</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;了解了ruby的开发之快后，一直想把ruby作为以后自己项目的后端语言，但是看了twitter从ruby改为java之后新闻之后，有点担忧，到时可以考虑ruby搭配java，或者jruby来开发后端。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;今天又看到一篇文章，XX项目将开发语言从ruby换成Go之后，服务器从30台减少到了2台，并且单台CPU从之前的50%将到了2%。如果对Go又燃起好奇之心。</p> <p>&nbsp;&#8203;</p> <p>二、了解Go</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;酷客有两篇文章介绍了下Go：</p> <p><a href="http://coolshell.cn/articles/8460.html" data_ue_src="http://coolshell.cn/articles/8460.html">http://coolshell.cn/articles/8460.html</a></p> <p><a href="http://coolshell.cn/articles/8489.html" data_ue_src="http://coolshell.cn/articles/8489.html">http://coolshell.cn/articles/8489.html</a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;Go语言是google开发的。目前只是google一些内部项目在使用，他们自己的商业产品线里都还没用到过Go，google外的业内也暂无别的重量级应用使用了Go。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;Go的语法有些像ruby之类的脚本语言一样简洁，但是有些也挺别扭的。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;Go声称效率接近c/c++，然后容易开发并行程序。</p> <p>&nbsp;</p> <p>三、个人需求总结</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;我如果近期换的工作还是游戏（页游或者手游）的话，就用不用考虑那么高的性能了，所以java就够了。就先不去学习Go了。<br /><br />ps：2013年3月29日我在CU的博文</p><img src ="http://www.cppblog.com/yangsf5/aggbug/199232.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yangsf5/" target="_blank">Sheppard Y</a> 2013-04-08 18:29 <a href="http://www.cppblog.com/yangsf5/archive/2013/04/08/199232.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>