{"id":18403732,"url":"https://github.com/russellluo/slidingwindow","last_synced_at":"2025-04-04T12:10:28.013Z","repository":{"id":41156340,"uuid":"223737083","full_name":"RussellLuo/slidingwindow","owner":"RussellLuo","description":"Golang implementation of Sliding Window Algorithm for distributed rate limiting.","archived":false,"fork":false,"pushed_at":"2024-05-24T13:19:06.000Z","size":511,"stargazers_count":394,"open_issues_count":1,"forks_count":38,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T11:11:40.379Z","etag":null,"topics":["golang","rate-limiting"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RussellLuo.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}},"created_at":"2019-11-24T12:01:30.000Z","updated_at":"2025-01-29T23:18:21.000Z","dependencies_parsed_at":"2024-11-06T03:11:17.473Z","dependency_job_id":null,"html_url":"https://github.com/RussellLuo/slidingwindow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Fslidingwindow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Fslidingwindow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Fslidingwindow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RussellLuo%2Fslidingwindow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RussellLuo","download_url":"https://codeload.github.com/RussellLuo/slidingwindow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174456,"owners_count":20896078,"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":["golang","rate-limiting"],"created_at":"2024-11-06T02:48:02.062Z","updated_at":"2025-04-04T12:10:27.996Z","avatar_url":"https://github.com/RussellLuo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slidingwindow\n\nGolang implementation of Sliding Window Algorithm for distributed rate limiting.\n\n\n## Installation\n\n```bash\n$ go get -u github.com/RussellLuo/slidingwindow\n```\n\n\n## Design\n\n`slidingwindow` is an implementation of the scalable rate limiting algorithm used by [Kong][1].\n\nSuppose we have a limiter that permits 100 events per minute, and now the time comes at the \"75s\" point, then the internal windows will be as below:\n\n![slidingwindow](docs/slidingwindow.png)\n\nIn this situation, the limiter has permitted 12 events during the current window, which started 15 seconds ago, and 86 events during the entire previous window. Then the count approximation during the sliding window can be calculated like this:\n\n```\ncount = 86 * ((60-15)/60) + 12\n      = 86 * 0.75 + 12\n      = 76.5 events\n```\n\n\n## Test Utility\n\n![prom_reports](docs/prom_reports.png)\n\nFor details, see [testutil](testutil).\n\n\n## Documentation\n\nFor usage and examples see the [Godoc][2].\n\n\n## License\n\n[MIT][3]\n\n\n[1]: https://konghq.com/blog/how-to-design-a-scalable-rate-limiting-algorithm/\n[2]: https://godoc.org/github.com/RussellLuo/slidingwindow\n[3]: http://opensource.org/licenses/MIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellluo%2Fslidingwindow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frussellluo%2Fslidingwindow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellluo%2Fslidingwindow/lists"}