{"action":"created","issue":{"url":"https://api.github.com/repos/swoole/swoole-src/issues/774","repository_url":"https://api.github.com/repos/swoole/swoole-src","labels_url":"https://api.github.com/repos/swoole/swoole-src/issues/774/labels{/name}","comments_url":"https://api.github.com/repos/swoole/swoole-src/issues/774/comments","events_url":"https://api.github.com/repos/swoole/swoole-src/issues/774/events","html_url":"https://github.com/swoole/swoole-src/issues/774","id":166485682,"number":774,"title":"swoole_client 在 Mac 下对 unix socket 不起作用","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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-20T03:16:57Z","updated_at":"2016-07-25T06:43:58Z","closed_at":null,"body":"在 Mac OS X 下，用 swoole_client 连接 swoole_server 创建的 unix socket 服务器，收不到响应。但是同样的程序，在 Linux 下没有问题。\r\n\r\n另外，就是 swoole_client 在 Linux 下连接 swoole_server 创建的 TCP 服务器，读写性能很低，比 unix socket 要低很多。但是在 Mac OS X 上连接 TCP 服务器的读写性能，跟 Linux 下的 unix socket 性能一样快。"},"comment":{"url":"https://api.github.com/repos/swoole/swoole-src/issues/comments/234852913","html_url":"https://github.com/swoole/swoole-src/issues/774#issuecomment-234852913","issue_url":"https://api.github.com/repos/swoole/swoole-src/issues/774","id":234852913,"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-07-25T06:43:57Z","updated_at":"2016-07-25T06:43:57Z","body":"测试代码放在这里了：https://github.com/hprose/hprose-swoole/tree/master/examples/src\r\n\r\n先运行 UnixServer.php，再运行 UnixClientBenchmark.php：\r\n\r\n在 Mac OS X 10.11.6，PHP 5.5.38，swoole 1.8.7 下，运行结果为：\r\n```\r\nfloat(1.6292669773102)\r\nfloat(0.00016292669773102)\r\n```\r\n\r\n在 Ubuntu 64bit 16.04，PHP 7.0，swoole 1.8.7 下，运行结果为：\r\n```\r\nfloat(0.74352622032166)\r\nfloat(7.4352622032166E-5)\r\n```\r\n\r\n先运行 TcpServer.php，再运行 TcpHDClientBenchmark.php：\r\n\r\n在 Mac OS X 10.11.6，PHP 5.5.38，swoole 1.8.7 下，运行结果为：\r\n```\r\nfloat(1.7051320075989)\r\nfloat(0.00017051320075989)\r\n```\r\n\r\n在 Ubuntu 64bit 16.04，PHP 7.0，swoole 1.8.7 下，运行结果为：\r\n```\r\nfloat(79.967931032181)\r\nfloat(0.0079967931032181)\r\n```\r\n\r\n运行 TcpFDClientBenchmark.php：\r\n\r\n在 Mac OS X 10.11.6，PHP 5.5.38，swoole 1.8.7 下，运行结果为：\r\n\r\n```\r\nfloat(1.2581930160522)\r\nfloat(0.00012581930160522)\r\n```\r\n\r\n在 Ubuntu 64bit 16.04，PHP 7.0，swoole 1.8.7 下，运行结果为：\r\n```\r\nfloat(8.406779050827)\r\nfloat(0.0008406779050827)\r\n```\r\n\r\n上面的 UnixClient 的实现代码（UnixClient 也有全双工和半双工之分，默认是半双工的）跟 TcpClient 的实现代码是一样的（只是地址不同）。\r\n\r\n从上面的运行结果可以看出：在 Mac OS X 下，Unix Socket 和 Tcp 的客户端运行效率是差不多的。但是在 Linux 下，Tcp 客户端的性能明显不对劲，半双工模式执行时间是全双工模式的 10 倍，全双工模式执行时间是 Unix Socket 半双工模式的 10 倍。"}}
{"actor":{"display_login":"andot"}}