{"action":"created","issue":{"url":"https://api.github.com/repos/kellabyte/Haywire/issues/71","labels_url":"https://api.github.com/repos/kellabyte/Haywire/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/kellabyte/Haywire/issues/71/comments","events_url":"https://api.github.com/repos/kellabyte/Haywire/issues/71/events","html_url":"https://github.com/kellabyte/Haywire/pull/71","id":120023575,"number":71,"title":"Experimental support for pico HTTP parser","user":{"login":"kellabyte","id":676347,"avatar_url":"https://avatars.githubusercontent.com/u/676347?v=3","gravatar_id":"","url":"https://api.github.com/users/kellabyte","html_url":"https://github.com/kellabyte","followers_url":"https://api.github.com/users/kellabyte/followers","following_url":"https://api.github.com/users/kellabyte/following{/other_user}","gists_url":"https://api.github.com/users/kellabyte/gists{/gist_id}","starred_url":"https://api.github.com/users/kellabyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kellabyte/subscriptions","organizations_url":"https://api.github.com/users/kellabyte/orgs","repos_url":"https://api.github.com/users/kellabyte/repos","events_url":"https://api.github.com/users/kellabyte/events{/privacy}","received_events_url":"https://api.github.com/users/kellabyte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-02T20:00:10Z","updated_at":"2015-12-03T13:38:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kellabyte/Haywire/pulls/71","html_url":"https://github.com/kellabyte/Haywire/pull/71","diff_url":"https://github.com/kellabyte/Haywire/pull/71.diff","patch_url":"https://github.com/kellabyte/Haywire/pull/71.patch"},"body":"@nmdguerreiro I would love your code review feedback on this because there's some flaws in my implementation.\r\n\r\n`pico` http parser is a SSE accelerated HTTP parser. This can gain us quite a lot of performance in Haywire I believe. It's not a streaming parser like `http_parser` that Haywire already uses but I've made it so you can configure which one Haywire uses. There's a cloudflare fork of this parser that is AVX optimized as well. I don't want to require AVX or SSE but since performance is Haywire's main goal, I want to get these integrated and see how fast we can go!\r\n\r\nKeep in mind there's some hard coded values and not tidy stuff in this branch so far because I'm experimenting. There's a major bug in my implementation though which is killing performance that I would love a code review on to get it fixed so we can see the potential of `pico` in Haywire.\r\n\r\nTo run `pico` run the following `./build/hello_world --parser pico`\r\n\r\nThe big problem with my pico implementation is it's losing requests over time. The longer the benchmark the slower the requests/second throughput rate is. If you run `dstat` and watch network throughput you'll see over time it slows down until almost no responses get sent. I suspect that there's a loop/buffer management issue that is causing requests to stall and never get processed.\r\n\r\nIf you do a really short benchmark you can see some amazing potential.\r\n\r\n### HTTP_PARSER\r\n```\r\n./build/hello_world --threads 20 --parser http_parser --batch 64\r\n\r\n../bin/wrk/wrk --script ./pipelined_get.lua --latency -d 10s -t 20 -c 256 http://104.130.19.205:8000 -- 64\r\nRunning 10s test @ http://104.130.19.205:8000\r\n  20 threads and 256 connections\r\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\r\n    Latency    11.77ms   12.04ms  63.20ms   75.96%\r\n    Req/Sec   147.27k    49.42k  348.40k    75.32%\r\n  Latency Distribution\r\n     50%    6.78ms\r\n     75%   23.08ms\r\n     90%   34.49ms\r\n     99%    0.00us\r\n  29456134 requests in 10.10s, 4.33GB read\r\nRequests/sec: 2,916,682.82\r\nTransfer/sec:    439.49MB\r\n```\r\n\r\n### PICO\r\n2 second run shows some great potential.\r\n\r\n```\r\n./build/hello_world --threads 20 --parser pico --batch 64\r\n\r\n./bin/wrk/wrk --script ./pipelined_get.lua --latency -d 2s -t 20 -c 256 http://104.130.19.205:8000 -- 64\r\nRunning 2s test @ http://104.130.19.205:8000\r\n  20 threads and 256 connections\r\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\r\n    Latency   661.65us  488.02us   9.51ms   71.29%\r\n    Req/Sec   386.06k    88.75k  486.79k    41.35%\r\n  Latency Distribution\r\n     50%  740.00us\r\n     75%    1.27ms\r\n     90%    0.00us\r\n     99%    0.00us\r\n  15980992 requests in 2.10s, 2.35GB read\r\nRequests/sec: 7,610,895.00\r\nTransfer/sec:      1.12GB\r\n```\r\n\r\n2 minute run shows how performance tanked over time.\r\n```\r\n./build/hello_world --threads 20 --parser pico --batch 64\r\n\r\n../bin/wrk/wrk --script ./pipelined_get.lua --latency -d 2m -t 20 -c 256 http://104.130.19.205:8000 -- 64\r\nRunning 2m test @ http://104.130.19.205:8000\r\n  20 threads and 256 connections\r\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\r\n    Latency   401.47us  341.74us  16.19ms   88.10%\r\n    Req/Sec   233.44k    71.54k  561.32k    73.52%\r\n  Latency Distribution\r\n     50%  262.00us\r\n     75%  448.00us\r\n     90%  812.00us\r\n     99%    1.77ms\r\n  141840704 requests in 2.00m, 20.87GB read\r\nRequests/sec: 1,181,341.04\r\nTransfer/sec:    178.01MB\r\n```\r\n\r\ndstat output during the pico run\r\n```\r\ndstat -n --output output.csv\r\n\r\n-net/total-\r\n recv  send\r\n5870B  274B\r\n 120M  415M\r\n 332M 1145M\r\n 254M  877M\r\n 210M  724M\r\n 180M  622M\r\n 150M  519M\r\n 142M  489M\r\n 127M  438M\r\n 100M  343M\r\n  90M  312M\r\n  80M  277M\r\n  77M  265M\r\n  77M  266M\r\n  77M  266M\r\n  77M  266M\r\n  76M  262M\r\n  76M  263M\r\n  79M  272M\r\n  77M  265M\r\n  71M  244M\r\n  70M  242M\r\n  70M  242M\r\n  64M  221M\r\n  60M  207M\r\n  55M  191M\r\n  52M  180M\r\n  52M  181M\r\n  52M  180M\r\n  52M  180M\r\n  52M  180M\r\n-net/total-\r\n recv  send\r\n  52M  180M\r\n  52M  180M\r\n  52M  180M\r\n  52M  180M\r\n  52M  180M\r\n  52M  180M\r\n  51M  175M\r\n  52M  178M\r\n  52M  180M\r\n  52M  179M\r\n  52M  180M\r\n  52M  179M\r\n  52M  180M\r\n  52M  180M\r\n  52M  180M\r\n  52M  179M\r\n  50M  174M\r\n  50M  172M\r\n  50M  172M\r\n  50M  172M\r\n  50M  172M\r\n  50M  172M\r\n  50M  172M\r\n  50M  172M\r\n  50M  173M\r\n  50M  171M\r\n  51M  175M\r\n  51M  176M\r\n  51M  176M\r\n  51M  176M\r\n  51M  176M\r\n  51M  176M\r\n  51M  176M\r\n  51M  176M\r\n  51M  176M\r\n  47M  161M\r\n  47M  164M\r\n  48M  165M\r\n  48M  166M\r\n-net/total-\r\n recv  send\r\n  48M  167M\r\n  48M  166M\r\n  48M  166M\r\n  48M  166M\r\n  48M  167M\r\n  48M  167M\r\n  48M  165M\r\n  47M  164M\r\n  47M  164M\r\n  48M  165M\r\n  48M  164M\r\n  49M  168M\r\n  48M  165M\r\n  47M  163M\r\n  48M  165M\r\n  40M  139M\r\n  30M  103M\r\n  30M  103M\r\n  30M  103M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  29M  102M\r\n  29M  102M\r\n  29M  102M\r\n  29M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  102M\r\n  30M  103M\r\n  29M  101M\r\n  18M   61M\r\n-net/total-\r\n recv  send\r\n8112k   27M\r\n8124k   27M\r\n8084k   27M\r\n9200k   31M\r\n9855k   33M\r\n9654k   33M\r\n3973k   13M\r\n```"},"comment":{"url":"https://api.github.com/repos/kellabyte/Haywire/issues/comments/161642146","html_url":"https://github.com/kellabyte/Haywire/pull/71#issuecomment-161642146","issue_url":"https://api.github.com/repos/kellabyte/Haywire/issues/71","id":161642146,"user":{"login":"nmdguerreiro","id":2456228,"avatar_url":"https://avatars.githubusercontent.com/u/2456228?v=3","gravatar_id":"","url":"https://api.github.com/users/nmdguerreiro","html_url":"https://github.com/nmdguerreiro","followers_url":"https://api.github.com/users/nmdguerreiro/followers","following_url":"https://api.github.com/users/nmdguerreiro/following{/other_user}","gists_url":"https://api.github.com/users/nmdguerreiro/gists{/gist_id}","starred_url":"https://api.github.com/users/nmdguerreiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmdguerreiro/subscriptions","organizations_url":"https://api.github.com/users/nmdguerreiro/orgs","repos_url":"https://api.github.com/users/nmdguerreiro/repos","events_url":"https://api.github.com/users/nmdguerreiro/events{/privacy}","received_events_url":"https://api.github.com/users/nmdguerreiro/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T13:38:46Z","updated_at":"2015-12-03T13:38:46Z","body":"Nevermind, that's just because it's waiting for the batch to be complete before writing the responses, due to https://github.com/kellabyte/Haywire/pull/71/files#diff-8844e879666d0ad3b814e81396a5b13cR386."}}