-
I've used BullMQ in a small personal project and it works great, thank you! The issue I'm currently having is that it's issuing a lot of daily commands which is pushing up costs which, on a personal project, I want to be as low as possible. For background, it's a bluesky feed generator looking for kickstarter projects, and it's probably over-engineered but that's what my personal projects are for! 😄 The app is hosted on fly.io which provides redis via upstash.io. I have three queues and two scheduled jobs, and the upstash stats show that it's making 44k commands per day. The scheduled jobs only run once per hour, and the remaining queue really only gets a job to execute every 5-10 minutes at most. I can see that there are five connections open (though I thought I'd shared the connection) and it's issuing 4 requests per second (two reads, two writes). Is this normal behaviour, or have I likely configured something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As far as I know, Upstash is now not charging for commands run inside BullMQ's scripts, only charging for 1 call per EVAL call. However, in this case I think the issue is with the "drainDelay" setting. This setting specifies the duration of the blocking commands in BullMQ, by default 5 seconds, that means that at least one command every 5 seconds will be issued. You can increase this value much more and everything would be fine and cheaper. Try with at least 60 seconds, and increase as you see fit. |
Beta Was this translation helpful? Give feedback.
As far as I know, Upstash is now not charging for commands run inside BullMQ's scripts, only charging for 1 call per EVAL call. However, in this case I think the issue is with the "drainDelay" setting. This setting specifies the duration of the blocking commands in BullMQ, by default 5 seconds, that means that at least one command every 5 seconds will be issued. You can increase this value much more and everything would be fine and cheaper. Try with at least 60 seconds, and increase as you see fit.
https://api.docs.bullmq.io/interfaces/v5.WorkerOptions.html#drainDelay