Recent Forum Posts
From categories:
page 1 of 212next »

许哥:go如何通过一个字串动态创建对象?
比如java里面,有myObject = class.forName("my.com.myObject");
假设有一个mysql库字串是 "github/mysql",我如何像java一样动态得到这个mysql的接口或结构?比如假设可以 sqltest=newObject("github/mysql")?

嘿大伟 (guest) 27 Feb 2015 06:48
in discussion Hidden / Per page discussions » 我的文章

许哥您好,请教一个问题:
golang http.ResponseWriter 的Write()方法,服务的QPS由3万降到7000。附上我的测试代码和boom测试结果:
现在我测试到的情况是这样的,如果我只填写http的header,那么服务端的处理速度很高,单纯测试(没有业务逻辑),QPS能达到3万,但是如果我添加payload,那么QPS就只能达到不足8000了,只有6000的样子。这个落差太大了,我尝试直接使用http.ResponseWriter 接口中的Write方法写入一个[50]Byte,效果一样。根据我的测试和你们的分析,应该是IO的问题,不过这个也太夸张了。
func handleHeader(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Length", "0") }

func handlePayload50(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Length", "50") w.Write(make([]byte, 50)) }

func handlePayload128(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Length", "128") w.Write(make([]byte, 128)) }

func handlePayload1024(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Length", "1024") w.Write(make([]byte, 1024)) }

func main() { runtime.GOMAXPROCS(runtime.NumCPU()) http.HandleFunc("/header", handleHeader) http.HandleFunc("/payload50", handlePayload50) http.HandleFunc("/payload128", handlePayload128) http.HandleFunc("/payload1024", handlePayload1024) host := fmt.Sprintf("%s:%d", "0.0.0.0", 5001) http.ListenAndServe(host, nil) }

and the boom test result: ./boom -c 1000 -n 500000 -cpus 12 XXXXXX/header 500000 / 500000 Boooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 %

Summary: Total: 12.8799 secs. Slowest: 3.2799 secs. Fastest: 0.0018 secs. Average: 0.0239 secs. Requests/sec: 38810.4907

Status code distribution: [200] 499875 responses

Response time histogram: 0.002 [1] | 0.330 [499306] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎ 0.657 [0] | 0.985 [0] | 1.313 [312] | 1.641 [0] | 1.969 [0] | 2.297 [0] | 2.624 [0] | 2.952 [0] | 3.280 [256] |

Latency distribution: 10% in 0.0125 secs. 25% in 0.0172 secs. 50% in 0.0216 secs. 75% in 0.0257 secs. 90% in 0.0295 secs. 95% in 0.0327 secs. 99% in 0.0549 secs.

./boom -c 500 -n 500000 -cpus 12 XXXXXX/payload128 500000 / 500000 Boooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 %

Summary: Total: 62.5205 secs. Slowest: 3.0714 secs. Fastest: 0.0112 secs. Average: 0.0601 secs. Requests/sec: 7997.1501 Total Data Received: 63998208 bytes. Response Size per Request: 128 bytes.

Status code distribution: [200] 499986 responses

Response time histogram: 0.011 [1] | 0.317 [495652] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎ 0.623 [0] | 0.929 [0] | 1.235 [4092] | 1.541 [0] | 1.847 [0] | 2.153 [0] | 2.459 [0] | 2.765 [0] | 3.071 [241] |

Latency distribution: 10% in 0.0405 secs. 25% in 0.0436 secs. 50% in 0.0481 secs. 75% in 0.0546 secs. 90% in 0.0629 secs. 95% in 0.0731 secs. 99% in 0.1054 secs.

by 嘿大伟 (guest), 27 Feb 2015 06:48
飏有泪 (guest) 07 Feb 2015 05:32
in discussion Hidden / Per page discussions » C++ Memory Management Innovation: GC Allocator

作为一个初学者,处在C++11,C++14和C++17的交替时代,仍感觉GC Allocator重要。可是,中国又重新发明了局域网,code.google.com就是连翻墙都上不去!您能把StdExt整个源码包发给我邮箱里吗?附带一句,您为什么不把项目迁移到github或者OSChina里去呢?!

by 飏有泪 (guest), 07 Feb 2015 05:32

demonc.com
Douglas Crockford

by Demon (guest), 30 Sep 2014 13:10
Dante Elrik (guest) 29 Mar 2014 23:55
in discussion Hidden / Per page discussions » 雷军的投资、创业观

Excellent Write up!

Dante Elrik
Founder Cloudshopper

by Dante Elrik (guest), 29 Mar 2014 23:55
POPGO (guest) 08 Dec 2013 09:03
in discussion Hidden / Per page discussions » 我的文章

我用erlang做过手机银行的服务端,效果还是不错的

by POPGO (guest), 08 Dec 2013 09:03
枯の灵 (guest) 05 Nov 2013 16:16
in discussion Hidden / Per page discussions » 雷军的投资、创业观

总结得不错 谢谢分享了

by 枯の灵 (guest), 05 Nov 2013 16:16
qq277049 (guest) 12 Jan 2013 03:45
in discussion Hidden / Per page discussions » go-iconv: libiconv for go

windows下要怎么安装呢?win没有make

by qq277049 (guest), 12 Jan 2013 03:45
扶楼猪一笑 (guest) 22 Nov 2012 10:41
in discussion Hidden / Per page discussions » go-iconv: libiconv for go

到底还更新不了?说话不算话哩

by 扶楼猪一笑 (guest), 22 Nov 2012 10:41
无流居士 (guest) 19 Nov 2012 09:19
in discussion Hidden / Per page discussions » go-iconv: libiconv for go

老兄,这个库可否更新一下,现在正需要用这个,谢谢。
我还买了你的书,最近正在看。

by 无流居士 (guest), 19 Nov 2012 09:19
jianjun (guest) 20 Sep 2012 08:57
in discussion Hidden / Per page discussions » 我的文章

许哥您好:

看到您编写的winx, 我有一个问题请教, 为什么MFC的消息映射要提供_AFXDLL和非_AFXDLL两个implementation, 比如
#ifdef _AFXDLL
#define DECLARE_MESSAGE_MAP() private: static const AFX_MSGMAP_ENTRY _messageEntries[]; protected: static AFX_DATA const AFX_MSGMAP messageMap; static const AFX_MSGMAP* PASCAL _GetBaseMessageMap(); virtual const AFX_MSGMAP* GetMessageMap() const;
#else
#define DECLARE_MESSAGE_MAP() private: static const AFX_MSGMAP_ENTRY _messageEntries[]; protected: static AFX_DATA const AFX_MSGMAP messageMap; virtual const AFX_MSGMAP* GetMessageMap() const; #endif
为什么直接用非_AFXDLL的版本的不行? 非要用一个函数_GetBaseMessageMap()去取基类的messageMap?

by jianjun (guest), 20 Sep 2012 08:57
justin (guest) 23 Aug 2012 12:18
in discussion Hidden / Per page discussions » go-iconv: libiconv for go

windows下安装有错误

by justin (guest), 23 Aug 2012 12:18
arkxu (guest) 14 Apr 2012 07:30
in discussion Hidden / Per page discussions » 美的让人震惊的斯坦福大学

previous was mis-typed,

should be this one:

post/21073112161

by arkxu (guest), 14 Apr 2012 07:30
arkxu (guest) 13 Apr 2012 05:55
in discussion Hidden / Per page discussions » 美的让人震惊的斯坦福大学

updated video link here:

/post/20895366702

by arkxu (guest), 13 Apr 2012 05:55
TAO (guest) 24 Feb 2012 15:38
in discussion Hidden / Per page discussions » re2c - 将正则表达式转为c代码

你用re2c处理过中文么?

by TAO (guest), 24 Feb 2012 15:38
cba (guest) 31 Dec 2011 06:27
in discussion Hidden / Per page discussions » 我的文章

在执行单元的公平调度方面,还是请指点下:
比如我要做一个管理大量设备(成千上万)的程序,需要即时监控设备状态,erlang进程的公平调度性是适合这个场景的,golang在这点上机制如何?

by cba (guest), 31 Dec 2011 06:27
john (guest) 25 Nov 2011 03:44
in discussion Hidden / Per page discussions » 成为 EverBox 粉丝拿 100GB 大奖!

account.everbox.com/signup/1737799332%40sdo
用这个可以不用邀请码免费注册everbox,注册就可以得到7G空间

by john (guest), 25 Nov 2011 03:44
junlin (guest) 15 Sep 2011 06:28
in discussion Hidden / Per page discussions » 我的文章

多谢许哥这么详细的说明,这样就清楚怎么选择了,多谢

by junlin (guest), 15 Sep 2011 06:28

如果你不考虑具体的使用场景,建议选择 golang。erlang 的适用范围相对狭窄。
两者目前都重服务端,所以客户端开发来说,都不是特别适合,如果非要用,建议用 golang。
服务端开发,如果团队比较小,喜欢函数式编程,而且网络模块偏重 io,逻辑不复杂,用 erlang 可以获得比 go 更好的性能,目前 go 语言在性能上还没做过非常大力度的优化。其他情况我建议用 golang。

golang vs. erlang by xushiweixushiwei, 13 Sep 2011 09:40
junlin (guest) 13 Sep 2011 07:36
in discussion Hidden / Per page discussions » 我的文章

许哥,能说一下,go和erlang的一些比较吗?
哪一个更适合大规模的实际应用?
多谢

by junlin (guest), 13 Sep 2011 07:36
page 1 of 212next »
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License