Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8300973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:45:43+00:00 2026-06-08T16:45:43+00:00

Say I have about 150 requests coming in every second to an api (node.js)

  • 0

Say I have about 150 requests coming in every second to an api (node.js) which are then logged in Redis. At that rate, the moderately priced RedisToGo instance will fill up every hour or so.

The logs are only necessary to generate daily\monthly\annual statistics: which was the top requested keyword, which was the top requested url, total number of requests daily, etc. No super heavy calculations, but a somewhat time-consuming run through arrays to see which is the most frequent element in each.

If I analyze and then dump this data (with a setInterval function in node maybe?), say, every 30 minutes, it doesn’t seem like such a big deal. But what if all of sudden I have to deal with, say, 2500 requests per second?

All of a sudden I’m dealing with 4.5 ~Gb of data per hour. About 2.25Gb every 30 minutes. Even with how fast redis\node are, it’d still take a minute to calculate the most frequent requests.

Questions:
What will happen to the redis instance while 2.25 gb worth of dada is being processed? (from a list, I imagine)

Is there a better way to deal with potentially large amounts of log data than moving it to redis and then flushing it out periodically?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:45:46+00:00Added an answer on June 8, 2026 at 4:45 pm

    IMO, you should not use Redis as a buffer to store your log lines and process them in batch afterwards. It does not really make sense to consume memory for this. You will better served by collecting your logs in a single server and write them on a filesystem.

    Now what you can do with Redis is trying to calculate your statistics in real-time. This is where Redis really shines. Instead of keeping the raw data in Redis (to be processed in batch later), you can directly store and aggregate the statistics you need to calculate.

    For instance, for each log line, you could pipeline the following commands to Redis:

    zincrby day:top:keyword 1 my_keyword
    zincrby day:top:url 1 my_url
    incr day:nb_req
    

    This will calculate the top keywords, top urls and number of requests for the current day. At the end of the day:

    # Save data and reset counters (atomically)
    multi
    rename day:top:keyword tmp:top:keyword
    rename day:top:url tmp:top:url
    rename day:nb_req tmp:nb_req
    exec
    
    # Keep only the 100 top keyword and url of the day
    zremrangebyrank tmp:top:keyword 0 -101
    zremrangebyrank tmp:top:url 0 -101
    
    # Aggregate monthly statistics for keyword
    multi    
    rename month:top:keyword tmp
    zunionstore month:top:keyword 2 tmp tmp:top:keyword
    del tmp tmp:top:keyword
    exec
    
    # Aggregate monthly statistics for url
    multi    
    rename month:top:url tmp
    zunionstore month:top:url 2 tmp tmp:top:url
    del tmp tmp:top:url
    exec
    
    # Aggregate number of requests of the month
    get tmp:nb_req
    incr month:nb_req <result of the previous command>
    del tmp:nb_req
    

    At the end of the month, the process is completely similar (using zunionstore or get/incr on monthly data to aggregate the yearly data).

    The main benefit of this approach is the number of operations done for each log line is limited while the monthly and yearly aggregation can easily be calculated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Many people have argued about function size. They say that functions in general should
I can't seem to find anywhere that talks about doing this. Say I have
Let's say I have about 10 css files on my site. I wanted to
I have a question about how Hibernate persists entity relations. Let's say I have
Brief Idea about the flow : I have say minimum 1 and maximum 18
This question about Timers for windows services got me thinking: Say I have (and
I want to record what various sources have to say about a historical figure.
Maybe it's not worth worrying about in this scenario, but lets say you have
I have a question about laying out some swing components. Say, I have a
I'm developing an iPhone app and have a question about memory management. Let's say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.