question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redis memory accumulates by job process return value

See original GitHub issue

Using base use case inspired by quick start docs https://docs.bullmq.io/

const { Queue, Worker } = require('bullmq');

const someData = 'some data';

const queue = new Queue('queueName');

queue.add('index', {}, { removeOnComplete: true });

new Worker(queue.name, async job => {
  return someData;
});

Every time I run the code above, the job is added to the queue and processed. Redis memory increases (at least) linearly by someData size + some small amount.

I expect memory to decline after job is removed, which it supposedly is here - redis key bull:queueName:{id} not present upon completion.

Redis memory: redis-cli -> INFO MEMORY -> “used_memory”

This code equivalent in the old ‘bull’ library seems to work as expected.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
roggervalfcommented, Mar 17, 2022

drained event was saved continuously even when worker is idle, this was fixed in https://github.com/taskforcesh/bullmq/pull/1123, so I think this should be the main reason of this issue

0reactions
manastcommented, Jan 14, 2021

@sspread If you could provide a test case that demonstrates the issue I can look into it. As far as I can see, we XTRIM when posting events and in my tests it works as it should.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis memory accumulates by job process return value #366
Every time I run the code above, the job is added to the queue and processed. Redis memory increases (at least) linearly by...
Read more >
Memory Optimization for Redis | Redis Documentation Center
Redis and clients are typically IO bound and the IO costs are typically at least 2 orders of magnitude in respect to the...
Read more >
Memory management best practices | Memorystore for Redis
You should regularly monitor your cache-hit ratio so that you know what percentage of key lookups are successfully returned by keys in your...
Read more >
MEMORY USAGE - Redis
The MEMORY USAGE command reports the number of bytes that a key and its value require to be stored in RAM. The reported...
Read more >
How we diagnosed and resolved Redis latency spikes with ...
If eviction overhead saturates the main thread's CPU, then response rate falls below request arrival rate. Redis accumulates a request backlog ( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found