Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion priority queue with mongodb

Received: by 10.224.189.16 with SMTP id dc16mr10091809qab.0.1352908826459;
        Wed, 14 Nov 2012 08:00:26 -0800 (PST)
X-BeenThere: mongodb-user@googlegroups.com
Received: by 10.224.52.141 with SMTP id i13ls1153622qag.7.gmail; Wed, 14 Nov
 2012 07:59:58 -0800 (PST)
Received: by 10.224.207.66 with SMTP id fx2mr10077260qab.7.1352908798884;
        Wed, 14 Nov 2012 07:59:58 -0800 (PST)
Received: by 10.224.173.148 with SMTP id p20msqaz;
        Wed, 14 Nov 2012 07:58:28 -0800 (PST)
Received: by 10.52.76.136 with SMTP id k8mr334104vdw.13.1352908708600;
        Wed, 14 Nov 2012 07:58:28 -0800 (PST)
Date: Wed, 14 Nov 2012 07:58:28 -0800 (PST)
From: Alexander Peiniger <alex1...@gmail.com>
To: mongodb-user@googlegroups.com
Message-Id: <ec550dc5-2b58-4a45-bcbc-f2501cedd7ff@googlegroups.com>
In-Reply-To: <AANLkTikRNc9=ZKvUYs9ibF7jS-pJL86nZmnYFSHRdvkk@mail.gmail.com>
References: <711d031a-468d-40af-a871-a35d1dd2631e@v6g2000prd.googlegroups.com>
 <AANLkTin2EER5d+d8amTBxUX12yu9L+nOEhHP8v_=cvwo@mail.gmail.com>
 <c6243043-bae3-4391-947d-44d23741a91d@j8g2000yqd.googlegroups.com>
 <AANLkTikRNc9=ZKvUYs9ibF7jS-pJL86nZmnYFSHRdvkk@mail.gmail.com>
Subject: Re: [mongodb-user] Re: priority queue with mongodb
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_357_13748121.1352908708212"

------=_Part_357_13748121.1352908708212
Content-Type: multipart/alternative; 
	boundary="----=_Part_358_8861506.1352908708212"

------=_Part_358_8861506.1352908708212
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Sounds great. Could you give a short explanation of your schema and indices 
for this?

Alex

On Tuesday, August 3, 2010 7:43:37 PM UTC+2, dustismo wrote:
>
> findAndModify is what we use for a priority queue.  We are able to
> process > 1000 tasks per second on a single mongo instance using this
> approach.   Just make sure your indexing and querying strategy is
> optimal.
>
> On Tue, Aug 3, 2010 at 12:12 AM, bizz <her...@gmail.com <javascript:>> 
> wrote:
> > I tried that but the performance is very bad, comparing to other
> > options.
> >
> > On Aug 2, 6:29 pm, Michael Dirolf <m...@10gen.com> wrote:
> >> I think the best bet will probably be to use findAndModify. The
> >> update/limit that you suggest would be subject to race conditions,
> >> etc. Some sort of bulk findAndModify would be interesting but for now
> >> I would just do multiple calls.
> >>
> >> On Mon, Aug 2, 2010 at 10:07 AM, bizz <hers...@gmail.com> wrote:
> >> > Hi,
> >>
> >> > I want to use mongodb to create jobs priority queue.
> >> > I created a collection containing all the jobs, each job has priority
> >> > and minimum time for the next execution.
> >> > Now, I want to query for bulk of jobs to execute. (I use the java
> >> > client to do so)
> >> > I use the find method to query, sort and limit the jobs I want, and in
> >> > return I get a cursor.
> >>
> >> > My problem:
> >> > After I get the results I would like to mark the jobs as being
> >> > processed. I could come up with the next options:
> >> > 1. go over all the results (one by one with the cursor) and collect
> >> > all the ids, then use the update method to mark the jobs.
> >> > 2. move all the jobs to a new collection dedicated to the processing
> >> > client
> >> > 3. Not use the find method, and instead use FindAndModify for the
> >> > number of jobs I want, one by one
> >>
> >> > The options listed above have bad performance, because I have to go
> >> > over the jobs one by one to collect their ids so I could mark them as
> >> > being executed.
> >>
> >> > If I had one of the following features I would have been able to
> >> > perform this task:
> >> > 1. FindAndModify on bulk of entries
> >> > 2. Update with limit (so I could update using the original query)
> >> > 3. An option to get all the results from the find and not a cursor
> >>
> >> > I couldn't think of any other way that I could do this task with
> >> > better performance,
> >> > Anyone have an Idea?
> >>
> >> > Thanks
> >>
> >> > --
> >> > You received this message because you are subscribed to the Google 
> Groups "mongodb-user" group.
> >> > To post to this group, send email to mongod...@googlegroups.com<javascript:>
> .
> >> > To unsubscribe from this group, send email to 
> mongodb-user...@googlegroups.com <javascript:>.
> >> > For more options, visit this group athttp://
> groups.google.com/group/mongodb-user?hl=en.
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com<javascript:>
> .
> > To unsubscribe from this group, send email to 
> mongodb-user...@googlegroups.com <javascript:>.
> > For more options, visit this group at 
> http://groups.google.com/group/mongodb-user?hl=en.
> >
> >
>
>
------=_Part_358_8861506.1352908708212
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Sounds great. Could you give a short explanation of your schema and indices=
 for this?<div><br></div><div>Alex<br><br>On Tuesday, August 3, 2010 7:43:3=
7 PM UTC+2, dustismo wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">fin=
dAndModify is what we use for a priority queue. &nbsp;We are able to<br>pro=
cess &gt; 1000 tasks per second on a single mongo instance using this<br>ap=
proach. &nbsp; Just make sure your indexing and querying strategy is<br>opt=
imal.<p></p><p>On Tue, Aug 3, 2010 at 12:12 AM, bizz &lt;<a href=3D"javascr=
ipt:" target=3D"_blank" gdf-obfuscated-mailto=3D"AvKC-L9Zkw4J">her...@gmail=
.com</a>&gt; wrote:<br>&gt; I tried that but the performance is very bad, c=
omparing to other<br>&gt; options.<br>&gt;<br>&gt; On Aug 2, 6:29&nbsp;pm, =
Michael Dirolf &lt;<a>m...@10gen.com</a>&gt; wrote:<br>&gt;&gt; I think the=
 best bet will probably be to use findAndModify. The<br>&gt;&gt; update/lim=
it that you suggest would be subject to race conditions,<br>&gt;&gt; etc. S=
ome sort of bulk findAndModify would be interesting but for now<br>&gt;&gt;=
 I would just do multiple calls.<br>&gt;&gt;<br>&gt;&gt; On Mon, Aug 2, 201=
0 at 10:07 AM, bizz &lt;<a>hers...@gmail.com</a>&gt; wrote:<br>&gt;&gt; &gt=
; Hi,<br>&gt;&gt;<br>&gt;&gt; &gt; I want to use mongodb to create jobs pri=
ority queue.<br>&gt;&gt; &gt; I created a collection containing all the job=
s, each job has priority<br>&gt;&gt; &gt; and minimum time for the next exe=
cution.<br>&gt;&gt; &gt; Now, I want to query for bulk of jobs to execute. =
(I use the java<br>&gt;&gt; &gt; client to do so)<br>&gt;&gt; &gt; I use th=
e find method to query, sort and limit the jobs I want, and in<br>&gt;&gt; =
&gt; return I get a cursor.<br>&gt;&gt;<br>&gt;&gt; &gt; My problem:<br>&gt=
;&gt; &gt; After I get the results I would like to mark the jobs as being<b=
r>&gt;&gt; &gt; processed. I could come up with the next options:<br>&gt;&g=
t; &gt; 1. go over all the results (one by one with the cursor) and collect=
<br>&gt;&gt; &gt; all the ids, then use the update method to mark the jobs.=
<br>&gt;&gt; &gt; 2. move all the jobs to a new collection dedicated to the=
 processing<br>&gt;&gt; &gt; client<br>&gt;&gt; &gt; 3. Not use the find me=
thod, and instead use FindAndModify for the<br>&gt;&gt; &gt; number of jobs=
 I want, one by one<br>&gt;&gt;<br>&gt;&gt; &gt; The options listed above h=
ave bad performance, because I have to go<br>&gt;&gt; &gt; over the jobs on=
e by one to collect their ids so I could mark them as<br>&gt;&gt; &gt; bein=
g executed.<br>&gt;&gt;<br>&gt;&gt; &gt; If I had one of the following feat=
ures I would have been able to<br>&gt;&gt; &gt; perform this task:<br>&gt;&=
gt; &gt; 1. FindAndModify on bulk of entries<br>&gt;&gt; &gt; 2. Update wit=
h limit (so I could update using the original query)<br>&gt;&gt; &gt; 3. An=
 option to get all the results from the find and not a cursor<br>&gt;&gt;<b=
r>&gt;&gt; &gt; I couldn't think of any other way that I could do this task=
 with<br>&gt;&gt; &gt; better performance,<br>&gt;&gt; &gt; Anyone have an =
Idea?<br>&gt;&gt;<br>&gt;&gt; &gt; Thanks<br>&gt;&gt;<br>&gt;&gt; &gt; --<b=
r>&gt;&gt; &gt; You received this message because you are subscribed to the=
 Google Groups "mongodb-user" group.<br>&gt;&gt; &gt; To post to this group=
, send email to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-ma=
ilto=3D"AvKC-L9Zkw4J">mongod...@googlegroups.com</a>.<br>&gt;&gt; &gt; To u=
nsubscribe from this group, send email to <a href=3D"javascript:" target=3D=
"_blank" gdf-obfuscated-mailto=3D"AvKC-L9Zkw4J">mongodb-user...@<wbr>google=
groups.com</a>.<br>&gt;&gt; &gt; For more options, visit this group athttp:=
//<a href=3D"http://groups.google.com/group/mongodb-user?hl=3Den" target=3D=
"_blank">groups.google.com/<wbr>group/mongodb-user?hl=3Den</a>.<br>&gt;<br>=
&gt; --<br>&gt; You received this message because you are subscribed to the=
 Google Groups "mongodb-user" group.<br>&gt; To post to this group, send em=
ail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"A=
vKC-L9Zkw4J">mongod...@googlegroups.com</a>.<br>&gt; To unsubscribe from th=
is group, send email to <a href=3D"javascript:" target=3D"_blank" gdf-obfus=
cated-mailto=3D"AvKC-L9Zkw4J">mongodb-user...@<wbr>googlegroups.com</a>.<br=
>&gt; For more options, visit this group at <a href=3D"http://groups.google=
.com/group/mongodb-user?hl=3Den" target=3D"_blank">http://groups.google.com=
/<wbr>group/mongodb-user?hl=3Den</a>.<br>&gt;<br>&gt;<br></p><p></p></block=
quote></div>
------=_Part_358_8861506.1352908708212--

------=_Part_357_13748121.1352908708212--