Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Persistent Storage (e.g., Redis) in express-rate-limit #432

Closed
talhariaz324 opened this issue Jan 18, 2024 · 1 comment · Fixed by #433
Closed

Add Support for Persistent Storage (e.g., Redis) in express-rate-limit #432

talhariaz324 opened this issue Jan 18, 2024 · 1 comment · Fixed by #433
Labels
enhancement Making the library better

Comments

@talhariaz324
Copy link

Description

The proposed feature aims to enhance express-rate-limit by introducing support for persistent storage, specifically targeting distributed and scalable application scenarios. Currently, express-rate-limit relies on in-memory storage, limiting its effectiveness in environments with multiple instances or microservices. The addition of persistent storage, such as Redis, provides a standardized solution for maintaining rate-limiting state across instances and ensures consistent behavior in distributed architectures.

Why

Scalability: The ability to use Redis or a similar solution for storage would enable applications to scale horizontally, supporting a larger number of servers or instances.

Distributed Systems: For applications deployed in distributed environments, persistent storage is crucial for maintaining rate-limiting state across multiple nodes.

Improved Performance: Redis and other persistent storage solutions are optimized for performance and can offer better response times in scenarios with high request volumes.

Alternatives

Existing Workaround:
Currently, developers resort to custom middleware or external rate-limiting services for persistent storage in express-rate-limit. However, these workarounds introduce complexity, synchronization challenges, and potential costs.

Alternatives

Forking the Library:

  • Users could fork the express-rate-limit library and implement custom changes to support their specific storage needs. However, this approach diverges from the main project, making it challenging to stay up-to-date with future releases and improvements.

Creating a Middleware Wrapper:

  • Developers could create a middleware wrapper around express-rate-limit that incorporates custom storage solutions. This, however, involves additional development effort and may not seamlessly integrate with the existing API of express-rate-limit.

Rationale for Feature Request:
Existing solutions bring complexities, dependencies and potential maintenance challenges. The proposed feature aims to provide a standardized, built-in solution, aligning with express-rate-limit's simplicity while enhancing scalability and versatility.

@nfriedly, I am interested in contributing to this feature and would like to request assignment. I believe this enhancement aligns with my skills, and I am eager to take on the responsibility of implementing it. If possible, please assign this feature to me. I will make sure to keep you updated on my progress and seek feedback as needed. Thank you! Additionally, I am open to further discussion to clarify any details or address any concerns you may have.

@talhariaz324 talhariaz324 added the enhancement Making the library better label Jan 18, 2024
@nfriedly
Copy link
Member

nfriedly commented Jan 19, 2024

Hi @talhariaz324, that's a really good idea - we've actually already implemented it, just in separate modules! See https://express-rate-limit.mintlify.app/reference/configuration#store for a list.

The stores got de-emphasized a bit in our recent reworking of the documentation, so maybe I should go back and make sure they get a call out in the readme, and maybe their own page in the docs website to bring them back to prominence.

nfriedly added a commit that referenced this issue Jan 19, 2024
This moves the list of stores from the bottom of the Configuration page to a new Data Stores page, and makes a few other changes to make it a little more prominent.

Closes #432
nfriedly added a commit that referenced this issue Jan 20, 2024
This moves the list of stores from the bottom of the Configuration page to a new Data Stores page, and makes a few other changes to make it a little more prominent.

Closes #432


---------

Co-authored-by: Vedant K <gamemaker0042@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Making the library better
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants