Advice on proper use of Agenda #1237
Unanswered
raffaelescala97
asked this question in
Q&A
Replies: 2 comments 9 replies
-
Typically, agenda creates a mongodb doc per each job. In your case it sounds like creating 100k job records - a job per each of the IDs. Not sure what else to add. Please be more specific with your questions. |
Beta Was this translation helpful? Give feedback.
2 replies
-
The update won't be done on the same id if you create 100k job docs. It's
what Agenda is about. It's core feature. (BTW, MongoDB does not have tables
but collections.)
Not wanting to create 100k docs - sounds like premature optimisation. 100k
records is 1MB or 10MB of disk space. Computers were born to do exactly
that, to simplify human's life.
If you don't want to create 100k jobs - create 100, each for 1000 records.
But then you don't need Agenda, it loses sense to use Agenda.
…On Sun, 7 Feb 2021, 23:05 Raffaele Scala, ***@***.***> wrote:
Thank you for your reply. That's my point, I wanted to avoid creating a
table with 100k jobs, also because in the future these 100k ids will grow
and may become 900k, so could it not be redundant?
Could I have agenda work on the same table "Products" in my case and add
the fields necessary for it to work?
The operation performed on each id is an api call, and a refresh of a
field in the row related to the id.
I was thinking of creating a job that would fetch a different row at each
iteration, keeping track of it with a stored boolean variable.
The problem also arises in the management of concurrency, how could I make
sure that by increasing the number of machines the update is not done on
the same id?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1237 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMMEL2NCV6PM4VIFPIM3PDS5Z6W3ANCNFSM4XEQBTLQ>
.
|
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I just decided to adopt agenda for my project. I would like some advice on the correct usage.
I have a table with about 100k rows (Mongo), each with a unique id. I would like to set up a job every second that does an operation on each row.
Also I would like to parallelize the jobs on multiple machines, how can I make sure they don't iterate the same ids?
What is the correct approach in agenda?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions