{"id":27786295,"url":"https://github.com/clever/http-science","last_synced_at":"2025-04-30T15:59:11.985Z","repository":{"id":33689838,"uuid":"37342627","full_name":"Clever/http-science","owner":"Clever","description":"Forward http requests to two places, report any differences in the response.","archived":false,"fork":false,"pushed_at":"2025-04-29T20:05:31.000Z","size":551,"stargazers_count":27,"open_issues_count":4,"forks_count":2,"subscribers_count":63,"default_branch":"master","last_synced_at":"2025-04-29T21:20:50.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clever.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2015-06-12T20:19:22.000Z","updated_at":"2025-04-29T20:05:33.000Z","dependencies_parsed_at":"2023-01-15T02:04:59.087Z","dependency_job_id":"4de9dd26-862b-4652-92d6-7e6b01ab1b4e","html_url":"https://github.com/Clever/http-science","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fhttp-science","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fhttp-science/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fhttp-science/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fhttp-science/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clever","download_url":"https://codeload.github.com/Clever/http-science/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251737842,"owners_count":21635687,"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":[],"created_at":"2025-04-30T15:59:11.313Z","updated_at":"2025-04-30T15:59:11.976Z","avatar_url":"https://github.com/Clever.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-science\n\nhttp-science is a worker that can perform both load and correctness testing. For Clever specific instructions, see [confluence](https://clever.atlassian.net/wiki/display/ENG/Use+http-science).\n\n\n## Motivation\n\nChanges to existing code often fall into the bucket of having no user-facing effect, e.g. refactors or rewrites. In theory, tests should give you 100% confidence in rolling out changes like this. However, in practice there is often a lot of risk associated with these changes, e.g. the operational risk of the code running in a production environment (performance, etc.), or lack of confidence in the tests.\n\n\"[Science](http://zachholman.com/talk/move-fast-break-nothing/)\" is a pattern GitHub introduced for deploying changes to code paths that should not change the output of that code path. `http-science` is a tool for doing the same experimentation at the network level.\n\n\n## Summary\n\nhttp-science takes traffic captured with [gor](https://github.com/buger/gor) and replays it at the specified URL(s). It recognizes two job types, 'load' and 'correctness'. When running a load test, traffic is replayed at a single URL and the distribution of response codes are logged. When running a correctness test, traffic is replayed simultaneously to a ExperimentURL and a ControlURL. The responses are compared and differences are logged.\n\nhttp-science expects files to be located at `s3://\u003cs3_bucket\u003e/\u003cfile_prefix\u003e/yyyy/mm/dd/hh/filename.gz`. We plan to support local files soon.\n\n## Running\n\n`./http-science $PAYLOAD`\n\nIf http-science is running as a gearman worker, you can post through gearman-admin\n`echo $PAYLOAD | http POST \u003cgearman-admin-url\u003e/job/http-science`\n\nThe PAYLOAD will depend on which type of test you are running\n\n## Load Testing\n\nAssuming that your target is running at \u003cURL\u003e, start a basic load test with PAYLOAD\n\n```\n{\n  \"job_type\": \"load\", // Required\n  \"service_name\": \"\u003cSERVICE_NAME\u003e\" // Required\n  \"load_env\": \"\u003cENV\u003e\", // Required\n}\n```\n\nThe maximum rate that requests can be replayed appears to be ~100 req/s. If you need more than this, running multiple concurrently is suggested. We have not investigated what the bottleneck of this performance is.\n\n## Correctness Testing\n\nAssuming that your control is running at \u003cControlURL\u003e, and your experiment at \u003cExperimentURL\u003e, start a basic correctness test with PAYLOAD.\n\n```\n{\n  \"job_type\": \"correctness\", // Required\n  \"service_name\": \"\u003cSERVICE_NAME\u003e\" // Required\n  \"control_env\": \"\u003cENV\u003e\", // Required\n  \"experiment_env\": \"\u003cENV\u003e\", // Required\n  \"diff_loc\": \"s3://bucket/prefix/file\" // Required, can be s3 or local path\n}\n```\n\n\n## Optional Params\nThe following params can be included in the payload for both load and correctness testing to give more control over the test:\n```\n{\n  \"start_before\": \"2016/05/31:23\", // Default 9999/99/99:99\n  \"speed\": 300, // Default 100\n  \"reqs\": 1000, // Default 1000\n  \"job_number\": 1, // Default 1. Required if total_jobs defined\n  \"total_jobs\": 1, // Default 1. Required if job_number defined\n  \"methods\": \"GET,POST,PATCH\", // Default GET\n  \"email\": address // Email address to send results to once job is done\n  \"disallow_url_regex\": url // URLs to ignore, comma separated if multiple\n}\n```\n\n* file_prefix: Necessary if there are directories between the bucket and your files\n* start_before: Only replay requests recorded before this date. Format is yyyy/mm/dd:hh\n* speed: The percentage of recorded speed you want to replay the requests at\n* reqs: The minimum number of requests you want replayed. In practice we go slightly over this\n* job_number: If running multiple workers in parallel, give each one a unique number \u003c total_jobs\n* total_jobs: Number of total jobs running in parallel\n* methods: The http methods we will forward\n* disallow_url_regex: Urls to ignore when analyzing correctness, comma separated if multiple\n\n## Vendoring\n\nPlease view the [dev-handbook for instructions](https://github.com/Clever/dev-handbook/blob/master/golang/godep.md).\n\n## Extensions\n\nThese features could be added to make this more useful\n\n* Exit once we have a certain number of diffs\n* Let gor specify a rate per second rather than a percentage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fhttp-science","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclever%2Fhttp-science","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fhttp-science/lists"}