{"action":"created","issue":{"url":"https://api.github.com/repos/h2non/rocky/issues/97","repository_url":"https://api.github.com/repos/h2non/rocky","labels_url":"https://api.github.com/repos/h2non/rocky/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/h2non/rocky/issues/97/comments","events_url":"https://api.github.com/repos/h2non/rocky/issues/97/events","html_url":"https://github.com/h2non/rocky/issues/97","id":164661119,"number":97,"title":"Performance when using rocky as a LB?","user":{"login":"Unitech","id":757747,"avatar_url":"https://avatars.githubusercontent.com/u/757747?v=3","gravatar_id":"","url":"https://api.github.com/users/Unitech","html_url":"https://github.com/Unitech","followers_url":"https://api.github.com/users/Unitech/followers","following_url":"https://api.github.com/users/Unitech/following{/other_user}","gists_url":"https://api.github.com/users/Unitech/gists{/gist_id}","starred_url":"https://api.github.com/users/Unitech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unitech/subscriptions","organizations_url":"https://api.github.com/users/Unitech/orgs","repos_url":"https://api.github.com/users/Unitech/repos","events_url":"https://api.github.com/users/Unitech/events{/privacy}","received_events_url":"https://api.github.com/users/Unitech/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/h2non/rocky/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/h2non/rocky/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-09T10:23:55Z","updated_at":"2016-07-10T23:06:49Z","closed_at":null,"body":"Hello h2non,\r\n\r\nI'm trying to use rocky as a loadbalancer, before digging into using http middlewares for traffic replay.\r\n\r\nI did a benchmark before going further with this code:\r\n\r\n```javascript\r\nvar rocky = require('rocky')\r\n\r\nvar proxy = rocky({ forwardHost:true })\r\n\r\nproxy\r\n  .balance(['http://localhost:8001']);\r\n\r\nproxy.routeAll();\r\n\r\nproxy.listen(3000);\r\n```\r\n\r\nThen the test http application listening on port 8001:\r\n```javascript\r\nvar http = require('http');\r\n\r\nvar server = http.createServer(function(req, res) {\r\n  res.writeHead(200);\r\n  res.end('hey');\r\n}).listen(process.env.PORT || 8001, function() {\r\n  console.log('App listening on port 8001');\r\n});\r\n```\r\n\r\nI did a benchmark with wrk. The first one without rocky and the second by hitting rocky for traffic balancing:\r\n\r\n```\r\nunitech@t450: ~/rocky-lb/wrk\r\n>>> wrk -c 100 -t 100 -d 10 http://localhost:8001\r\nRunning 10s test @ http://localhost:8001\r\n  100 threads and 100 connections\r\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\r\n    Latency     4.11ms    1.06ms  30.05ms   96.07%\r\n    Req/Sec   246.53     25.70   494.00     96.38%\r\n  246977 requests in 10.10s, 28.50MB read\r\nRequests/sec:  24453.03\r\nTransfer/sec:      2.82MB\r\n\r\nunitech@t450: ~/rocky-lb/wrk\r\n>>> wrk -c 100 -t 100 -d 10 http://localhost:3000\r\nRunning 10s test @ http://localhost:3000\r\n  100 threads and 100 connections\r\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\r\n    Latency    66.87ms   13.40ms 179.84ms   77.24%\r\n    Req/Sec    15.03      5.13    30.00     98.57%\r\n  14997 requests in 10.10s, 1.87MB read\r\nRequests/sec:   1484.76\r\nTransfer/sec:    189.95KB\r\n```\r\n\r\nThe result is quite different with and without rocky.\r\nWithout rocky (builting node http server) I get 246000 requests processed in 10 seconds. By using rocky It goes to 14997 requests in 10 seconds, 16x less performant than the raw http server.\r\n\r\nDo you have any tips on enhancing overall performance?\r\nAside from performance, rocky is clearly robust!\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/h2non/rocky/issues/comments/231616428","html_url":"https://github.com/h2non/rocky/issues/97#issuecomment-231616428","issue_url":"https://api.github.com/repos/h2non/rocky/issues/97","id":231616428,"user":{"login":"Unitech","id":757747,"avatar_url":"https://avatars.githubusercontent.com/u/757747?v=3","gravatar_id":"","url":"https://api.github.com/users/Unitech","html_url":"https://github.com/Unitech","followers_url":"https://api.github.com/users/Unitech/followers","following_url":"https://api.github.com/users/Unitech/following{/other_user}","gists_url":"https://api.github.com/users/Unitech/gists{/gist_id}","starred_url":"https://api.github.com/users/Unitech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unitech/subscriptions","organizations_url":"https://api.github.com/users/Unitech/orgs","repos_url":"https://api.github.com/users/Unitech/repos","events_url":"https://api.github.com/users/Unitech/events{/privacy}","received_events_url":"https://api.github.com/users/Unitech/received_events","type":"User","site_admin":false},"created_at":"2016-07-10T23:06:49Z","updated_at":"2016-07-10T23:06:49Z","body":"I guess this does not support websocket upgrade"}}
{"actor":{"display_login":"Unitech"}}