{"action":"created","issue":{"url":"https://api.github.com/repos/hprose/hprose-go/issues/17","labels_url":"https://api.github.com/repos/hprose/hprose-go/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/hprose/hprose-go/issues/17/comments","events_url":"https://api.github.com/repos/hprose/hprose-go/issues/17/events","html_url":"https://github.com/hprose/hprose-go/issues/17","id":125799619,"number":17,"title":"hprose-go 远程调用性能有待优化","user":{"login":"henrypfhu","id":8036030,"avatar_url":"https://avatars.githubusercontent.com/u/8036030?v=3","gravatar_id":"","url":"https://api.github.com/users/henrypfhu","html_url":"https://github.com/henrypfhu","followers_url":"https://api.github.com/users/henrypfhu/followers","following_url":"https://api.github.com/users/henrypfhu/following{/other_user}","gists_url":"https://api.github.com/users/henrypfhu/gists{/gist_id}","starred_url":"https://api.github.com/users/henrypfhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrypfhu/subscriptions","organizations_url":"https://api.github.com/users/henrypfhu/orgs","repos_url":"https://api.github.com/users/henrypfhu/repos","events_url":"https://api.github.com/users/henrypfhu/events{/privacy}","received_events_url":"https://api.github.com/users/henrypfhu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-10T04:28:56Z","updated_at":"2016-01-10T11:41:58Z","closed_at":null,"body":"在ThinkPad W540 8Core超线程，32G 内存机器上测试，使用样例代码进行测试，更改代码如下：\r\n```javascript\r\ntype Stub struct {\r\n\tHello func(string) (string, error)\r\n}\r\n\r\nfunc main() {\r\n\truntime.GOMAXPROCS(runtime.NumCPU())\r\n\tclient := hprose.NewClient(\"tcp4://127.0.0.1:4321/\")\r\n\tvar stub *Stub\r\n\tclient.UseService(&stub)\r\n\tclient.SetKeepAlive(true)\r\n\tstartTime := time.Now()\r\n\tfor i :=1; i < 1000000; i++ {\r\n\t\tstub.Hello(\"world\")\r\n\t}\r\n\tendTime := time.Now()\r\n\tfmt.Println(\"Time used: \", endTime.Sub(startTime).Seconds())\r\n\r\n\tresult, error := stub.Hello(\"world\")\r\n\tif error == nil {\r\n\t\tfmt.Println(result)\r\n\t} else {\r\n\t\tfmt.Println(error)\r\n\t}\r\n}\r\n```\r\n\r\n经过多次测试，CPU使用率极低只有10%不到，100万次调用平均花时 55秒左右，也就是每秒不到2万次调用，性能有待优化！\r\n\r\n这种简单的Hello测试，按理能达到50万次调用每秒以上。\r\n"},"comment":{"url":"https://api.github.com/repos/hprose/hprose-go/issues/comments/170337601","html_url":"https://github.com/hprose/hprose-go/issues/17#issuecomment-170337601","issue_url":"https://api.github.com/repos/hprose/hprose-go/issues/17","id":170337601,"user":{"login":"andot","id":232161,"avatar_url":"https://avatars.githubusercontent.com/u/232161?v=3","gravatar_id":"","url":"https://api.github.com/users/andot","html_url":"https://github.com/andot","followers_url":"https://api.github.com/users/andot/followers","following_url":"https://api.github.com/users/andot/following{/other_user}","gists_url":"https://api.github.com/users/andot/gists{/gist_id}","starred_url":"https://api.github.com/users/andot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andot/subscriptions","organizations_url":"https://api.github.com/users/andot/orgs","repos_url":"https://api.github.com/users/andot/repos","events_url":"https://api.github.com/users/andot/events{/privacy}","received_events_url":"https://api.github.com/users/andot/received_events","type":"User","site_admin":false},"created_at":"2016-01-10T11:41:58Z","updated_at":"2016-01-10T11:41:58Z","body":"主要瓶颈在客户端，而不是服务器端，如果你把客户端和服务器端分开测试，你会发现服务器端可以支撑更多的并发调用。"}}