{"id":23089232,"url":"https://github.com/steventen/http-parser-benchmark","last_synced_at":"2025-07-08T12:08:04.653Z","repository":{"id":146880452,"uuid":"442898188","full_name":"steventen/http-parser-benchmark","owner":"steventen","description":"https://stevenyue.com/blogs/http-message-parsing-in-java-web-servers/","archived":false,"fork":false,"pushed_at":"2021-12-29T21:49:38.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T17:24:04.257Z","etag":null,"topics":["benchmark","go","golang","http","http-server","httpparser","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steventen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-29T21:48:12.000Z","updated_at":"2024-08-19T11:08:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"75adbc49-6392-460d-a438-2b2bbf9d5324","html_url":"https://github.com/steventen/http-parser-benchmark","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"cf27a17efbfd07fcea61c73fd07d9ae50a75a0b6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/steventen/http-parser-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steventen%2Fhttp-parser-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steventen%2Fhttp-parser-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steventen%2Fhttp-parser-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steventen%2Fhttp-parser-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steventen","download_url":"https://codeload.github.com/steventen/http-parser-benchmark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steventen%2Fhttp-parser-benchmark/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264267070,"owners_count":23581929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","go","golang","http","http-server","httpparser","java"],"created_at":"2024-12-16T20:31:05.840Z","updated_at":"2025-07-08T12:08:04.623Z","avatar_url":"https://github.com/steventen.png","language":"Java","readme":"# Http Request Message Parsing Benchmark \n\nBenchmark the performance on parsing a simple Http request message.\n\nEach parser takes a simple http message as input, and creates an object or struct accordingly,\neach testing function returns a string containing the http method, one header value and one cookie name. This is to prevent the code from handling the parsing lazily and also to avoid dead code elimination.\n\n\n## Run Benchmark on Java Library\n\n[Java Microbenchmark Harness (JMH)](https://github.com/openjdk/jmh) is used. \n```\ncd java/\n\nmvn clean verify\n\njava -jar target/benchmarks.jar\n```\n\n### Results\n\nComputer: Mac mini (2012)\nCPU: 2.3 GHz Quad-Core Intel Core i7\nMemory: 16 GB 1600 MHz DDR3\n\n### Netty\n\n`HttpRequestDecoder` from `Netty` `v4.1.72.Final` is used to parse the request message\n\n```\n# JMH version: 1.33\n# VM version: JDK 11.0.7, OpenJDK 64-Bit Server VM, 11.0.7+10\n# VM invoker: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java\n# VM options: \u003cnone\u003e\n# Blackhole mode: full + dont-inline hint (default, use -Djmh.blackhole.autoDetect=true to auto-detect)\n# Warmup: 5 iterations, 10 s each\n# Measurement: 5 iterations, 10 s each\n# Timeout: 10 min per iteration\n# Threads: 1 thread, will synchronize iterations\n# Benchmark mode: Average time, time/op\n# Benchmark: org.sample.MyBenchmark.testHttpParserFromNetty\n\n... ...\n\nResult \"org.sample.MyBenchmark.testHttpParserFromNetty\":\n  5637.774 ±(99.9%) 195.638 ns/op [Average]\n  (min, avg, max) = (5299.449, 5637.774, 5997.024), stdev = 261.172\n  CI (99.9%): [5442.136, 5833.413] (assumes normal distribution)\n```\n\n### Rawhttp\n\n[Rawhttp](https://github.com/renatoathaydes/rawhttp) `v2.4.1` is used for this benchmark\n\n```\n# JMH version: 1.33\n# VM version: JDK 11.0.7, OpenJDK 64-Bit Server VM, 11.0.7+10\n# VM invoker: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java\n# VM options: \u003cnone\u003e\n# Blackhole mode: full + dont-inline hint (default, use -Djmh.blackhole.autoDetect=true to auto-detect)\n# Warmup: 5 iterations, 10 s each\n# Measurement: 5 iterations, 10 s each\n# Timeout: 10 min per iteration\n# Threads: 1 thread, will synchronize iterations\n# Benchmark mode: Average time, time/op\n# Benchmark: org.sample.MyBenchmark.testRawHttp\n\n... ...\n\nResult \"org.sample.MyBenchmark.testRawHttp\":\n  7109.697 ±(99.9%) 218.194 ns/op [Average]\n  (min, avg, max) = (6636.232, 7109.697, 7606.377), stdev = 291.283\n  CI (99.9%): [6891.503, 7327.892] (assumes normal distribution)\n```\n\nCompare both together, we have\n```\nBenchmark                            Mode  Cnt     Score     Error  Units\nMyBenchmark.testHttpParserFromNetty  avgt   25  5637.774 ± 195.638  ns/op\nMyBenchmark.testRawHttp              avgt   25  7109.697 ± 218.194  ns/op\n```\n\n\n## Run Benchmark on Go Library\n\nThe build-in benchmarking facility from testing package is used for Go.\n\n```\ngoos: darwin\ngoarch: amd64\npkg: example/hello\ncpu: Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz\nBenchmarkParseRequest-8   \t  233466\t      4753 ns/op\nPASS\nok  \texample/hello\t1.330s\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteventen%2Fhttp-parser-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteventen%2Fhttp-parser-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteventen%2Fhttp-parser-benchmark/lists"}