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

NLU Rate Limits #1783

Merged
merged 6 commits into from
Jan 27, 2024
Merged

NLU Rate Limits #1783

merged 6 commits into from
Jan 27, 2024

Conversation

caiosba
Copy link
Contributor

@caiosba caiosba commented Jan 25, 2024

Description

As part of the ongoing development of the Natural Language Understanding (NLU) feature, it has been identified that the current implementation of the text similarity service lacks robust handling of concurrent requests. The absence of efficient concurrency management may lead to degraded performance and potential service disruptions when multiple requests are made simultaneously.

Issue

The primary issue is the lack of a concurrency control mechanism, resulting in potential race conditions and suboptimal response times during peak usage periods. It is imperative to enhance the system's capability to handle concurrent requests seamlessly to ensure a smooth and responsive user experience.

Objective

The goal of this ticket is to implement rate limits as a concurrent request handling mechanism for the NLU feature.

Changes

  • Store messages even before they are parsed
  • Keep a global NLU counter and increment/decrement it in a thread-safe way as NLU operations start and finish
  • Global rate limit: do not process using NLU when the current number of NLU operations is greater than the limit defined in a configuration key
  • User rate limit: do not process using NLU when the user who sent the message has sent more messages in the last seconds than the limit defined in a configuration key

@caiosba caiosba changed the title [WIP] NLU Rate Limits NLU Rate Limits Jan 27, 2024
@caiosba caiosba marked this pull request as ready for review January 27, 2024 04:05
@caiosba caiosba removed the request for review from DGaffney January 27, 2024 04:05
Copy link

codeclimate bot commented Jan 27, 2024

Code Climate has analyzed commit 53b1498 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (100% is the threshold).

This pull request will bring the total coverage in the repository to 100.0% (0.0% change).

View more on Code Climate.

@caiosba caiosba merged commit c00bb0b into develop Jan 27, 2024
7 of 8 checks passed
@caiosba caiosba deleted the feature/CV2-3982-nlu-rate-limits branch January 27, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants