{"id":17169786,"url":"https://github.com/naftulikay/slumberd","last_synced_at":"2025-04-13T16:06:43.113Z","repository":{"id":37888747,"uuid":"210423940","full_name":"naftulikay/slumberd","owner":"naftulikay","description":"An HTTP server which sleeps during requests for a configurable amount of time.","archived":false,"fork":false,"pushed_at":"2023-06-14T16:13:25.000Z","size":210,"stargazers_count":4,"open_issues_count":14,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T16:06:31.669Z","etag":null,"topics":["http","rust","rust-lang"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naftulikay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-23T18:23:27.000Z","updated_at":"2019-12-31T07:49:58.000Z","dependencies_parsed_at":"2022-08-19T18:10:22.501Z","dependency_job_id":null,"html_url":"https://github.com/naftulikay/slumberd","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naftulikay%2Fslumberd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naftulikay%2Fslumberd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naftulikay%2Fslumberd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naftulikay%2Fslumberd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naftulikay","download_url":"https://codeload.github.com/naftulikay/slumberd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741204,"owners_count":21154254,"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":["http","rust","rust-lang"],"created_at":"2024-10-14T23:27:21.717Z","updated_at":"2025-04-13T16:06:43.088Z","avatar_url":"https://github.com/naftulikay.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slumberd [![Build Status][travis.svg]][travis] [![Docker Status][docker.svg]][docker]\n\nAn HTTP server which sleeps for a configurable amount of time, largely useful as a way to test functionality of HTTP\nproxies when dealing with long-lived requests.\n\nAvailable on Docker Hub as [`naftulikay/slumberd`][docker].\n\n## Usage\n\n`slumberd` is extremely flexible and can provide static or random request durations configurable via the CLI, specific\nrequest paths, query string parameters, and/or request headers. `slumberd` also returns a JSON response describing\nwhat it did, and sets response headers providing similar information.\n\n#### Sleep for 500ms\n\n```\n$ curl -i http://127.0.0.1:8080/sleep/500\nHTTP/1.1 200 OK\ncontent-length: 143\nx-request-id: 4699f361-3f53-4de9-ae01-1f36e8316cf5\ncontent-type: application/json\nx-slumber-time-millis: 500\nx-slumber-type: fixed\nx-slumber-time: 500ms\ndate: Wed, 23 Oct 2019 21:17:37 GMT\n\n{\n  \"slumber\": {\n    \"type\": \"fixed\",\n    \"time_millis\": 500,\n    \"time\": \"500ms\"\n  },\n  \"request_id\": \"4699f361-3f53-4de9-ae01-1f36e8316cf5\"\n}\n```\n\n#### Sleep for a Random Duration Between 500-1000ms\n\n```\n$ curl -i http://127.0.0.1:8080/random/500/1000\nHTTP/1.1 200 OK\ncontent-length: 255\nx-slumber-min-time-millis: 500\nx-request-id: c4f2c297-f95c-4e14-9e1b-7f634ff2afdd\nx-slumber-min-time: 500ms\ncontent-type: application/json\nx-slumber-max-time-millis: 1000\nx-slumber-max-time: 1s\nx-slumber-time-millis: 541\nx-slumber-type: random\nx-slumber-time: 541.962699ms\ndate: Wed, 23 Oct 2019 21:18:16 GMT\n\n{\n  \"slumber\": {\n    \"type\": \"random\",\n    \"time_millis\": 541,\n    \"time\": \"541.962699ms\",\n    \"max_time\": \"1s\",\n    \"max_time_millis\": 1000,\n    \"min_time_millis\": 500,\n    \"min_time\": \"500ms\"\n  },\n  \"request_id\": \"c4f2c297-f95c-4e14-9e1b-7f634ff2afdd\"\n}\n```\n\n**For complete usage information**, see [USAGE.md](./USAGE.md).\n\n## Performance and Portability\n\n`slumberd` uses [`actix-web`][actix-web] as a platform and uses Rust's zero-cost futures to \"sleep\" on each request.\nIndividual requests _do not_ block the thread that they are executing on, and as such, `slumberd` should scale fairly\nlinearly with the amount of requests it receives versus the available network bandwidth and number of logical CPU cores\navailable on the host.\n\n - One operating system thread per logical CPU is spawned, with each running a Tokio event loop.\n - Memory usage on cold boot is around 25MiB. I have not profiled `slumberd` under load, but similar Actix applications\n   I have written in the past will usually remain in the realm of ~100-200MiB under load.\n - The `--release` stripped static binary for Linux at time of writing is 4.06MiB. The Docker image should also be of\n   a similar size as it contains nothing but the binary.\n - The static `musl` binary has _zero_ system requirements other than an x86_64 architecture and any modern Linux kernel\n   (I'm assuming that any kernel version \u003e=2.6 should work just fine).\n\n## License\n\nLicensed at your discretion under either:\n\n - [Apache Software License, Version 2.0](./LICENSE-APACHE)\n - [MIT License](./LICENSE-MIT)\n\n [actix-web]: https://github.com/actix/actix-web\n [docker]: https://cloud.docker.com/repository/docker/naftulikay/slumberd\n [docker.svg]: https://img.shields.io/docker/cloud/build/naftulikay/slumberd.svg\n [travis]: https://travis-ci.org/naftulikay/slumberd\n [travis.svg]: https://travis-ci.org/naftulikay/slumberd.svg?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaftulikay%2Fslumberd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaftulikay%2Fslumberd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaftulikay%2Fslumberd/lists"}