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

Check Sidekiq for multiple emails being sent/retireved #1748

Open
sonamvg opened this issue Mar 21, 2024 · 1 comment
Open

Check Sidekiq for multiple emails being sent/retireved #1748

sonamvg opened this issue Mar 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sonamvg
Copy link
Contributor

sonamvg commented Mar 21, 2024

Recently, on MIRU STAGING, an error occurred and the number of hits on Redis was exhausted.
On debugging, it looked like it was due to multiple email errors.

Need to check if we are trying to resend emails after failure multiple times.

Error:
2024-03-18T08:19:49.632 app[148eddd6ad53e8] ewr [info] [48b00e70-19b2-48bc-a831-a7efc962adaa] RedisClient::CommandError (ERR max daily request limit exceeded. Limit: 10000, Usage: 10000. See https://upstash.com/docs/redis/troubleshooting/max_daily_request_limit for details):

@sonamvg sonamvg added the bug Something isn't working label Mar 21, 2024
@gowsik-ragunath
Copy link
Contributor

Fly free redis DB is limited to a free allowance of 10,000 commands per day. Ref.

This is the current Staging redis DB daily usage chart, Ref.

Screenshot 2024-03-22 at 10 41 51 AM

We are getting capped when over 20,000 commands are executed(not sure if there is any individual limit for each redis commands).

Possible fix:

I found this discussion where they recommend decreasing the Sidekiq concurrency, and increasing the fetch timeout.

  1. We already have concurrency as 1 for both development and production, but please check if this code is actually working,

development:
:concurrency: 1
production:
:concurrency: 1

  1. Increase the timeout limit for the Sidekiq fetch operation,

Please add the following code snippet to the sidekiq.rb initializer and ensure it's assigned only for the staging app.

https://community.fly.io/t/managing-redis-rate-limits-on-sidekiq-and-rails/6741/10

# frozen_string_literal: true

Sidekiq.configure_client do |config|
  config.redis = {
    url: ENV["REDIS_URL"], network_timeout: 5,
    ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
  }
end

Sidekiq.configure_server do |config|
  config.redis = {
    url: ENV["REDIS_URL"], network_timeout: 5,
    ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
  }
  Sidekiq::BasicFetch::TIMEOUT = 15
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants