rate-limiting

command module
v0.0.0-...-ecbdb09 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Rate Limiting API in Golang for distributed sytems.

Given

You are given an external API endpoint which allows to check that given user-id does have the limit for the request on the given application or not. Appliaction is also deployed on ec2 with redis-elastic cache.

Example HTTP calls

curl -X GET http://localhost:8888/rate
Request Headers:
1. user-id:<userid>
2. application-id:<application-id>

Run

  • Clone the application
  • Create conf.json file from copying the conf.sample.json in rate-limiting/conf/ folder
  • Can specify the values of paramters mentioned in conf.json like port,redis credentials and number of request allowed in a minute and a hour for a user.
  • Now run go build . in rate-limitng project directory.
  • Once after build u will see binary file rate-limiting in the current directory
  • Run ./rate-limiting and hit enter. Will se logs of running the server on the mentioned Port.

Design a rate limiting application or API.

Requirements
  • The API must support multiple users and multiple application support.
  • If the HTTP status 200 means user is allowed to make call on respective application, http status should 429 when user exceeds the request for the given application.
  • The API should be stateless so that it can be horizontaly scaled up easily.
  • API should support sliding window approach ex user should have limit on request in a minute as well as an hour. All the parameter like number of requests should configurable from env file.
  • Deploy to AWS with using elastic-cache

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
util

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址