Message from discussion
Explicit blocking
Received: by 10.204.132.81 with SMTP id a17mr2526789bkt.4.1337612660066;
Mon, 21 May 2012 08:04:20 -0700 (PDT)
X-BeenThere: mongodb-user@googlegroups.com
Received: by 10.204.129.208 with SMTP id p16ls3739562bks.7.gmail; Mon, 21 May
2012 08:04:05 -0700 (PDT)
Received: by 10.204.152.217 with SMTP id h25mr2528924bkw.3.1337612645769;
Mon, 21 May 2012 08:04:05 -0700 (PDT)
Received: by 10.204.152.217 with SMTP id h25mr2528923bkw.3.1337612645732;
Mon, 21 May 2012 08:04:05 -0700 (PDT)
Return-Path: <spen...@10gen.com>
Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50])
by gmr-mx.google.com with ESMTPS id ig3si17802958bkc.3.2012.05.21.08.04.05
(version=TLSv1/SSLv3 cipher=OTHER);
Mon, 21 May 2012 08:04:05 -0700 (PDT)
Received-SPF: pass (google.com: domain of spen...@10gen.com designates 209.85.214.50 as permitted sender) client-ip=209.85.214.50;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of spen...@10gen.com designates 209.85.214.50 as permitted sender) smtp.mail=spen...@10gen.com
Received: by mail-bk0-f50.google.com with SMTP id jg9so5731868bkc.37
for <mongodb-user@googlegroups.com>; Mon, 21 May 2012 08:04:05 -0700 (PDT)
d=google.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:content-type:x-gm-message-state;
bh=vO7uA324vyMGEo5aPv1VOq19KGTU57jgTjpVZwmqz9E=;
b=APbL6d5/+y0BAxwhzs2snVXS0A3BCjT3NfNROKzoj5Y5kK+Hy3N8kjhtElBtRU02B9
243JETM14D6XwHUT+dm1WYIQ+ch7OyIFEe6VOuPw+ZM5nOHHdIwkI1LYSQwSoagp0fXW
INvLkO53hcC0zq8jRh6HhNwZgs1+cRNCCQWIWW7p7/25HikTUbODeFYnsSrTpgrtbgpj
/0SvFUP4I7JbquZbtlY9C38Sqb9VY/exGPOukHOAvMRaArPVtdw4eWCc8bu7VXs9BmnY
t5kNDFjGQR3zbszMrcY9SvNVh8KmPVXvupb7CDcfEA1yLlulHbfDQsnkMMdx+yxmGpIF
9cnA==
Received: by 10.204.148.79 with SMTP id o15mr8223186bkv.87.1337612645372; Mon,
21 May 2012 08:04:05 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.204.41.2 with HTTP; Mon, 21 May 2012 08:03:44 -0700 (PDT)
In-Reply-To: <00f7bc32-ed62-4f66-bf55-95cca4334...@b26g2000vbt.googlegroups.com>
References: <5b763aed-ed81-4fc1-a280-df0b9b3b1...@v2g2000vbx.googlegroups.com>
<29313708.825.1336577732756.JavaMail.geo-discussion-forums@yndm3>
<ea5ddcad-d16f-4516-8775-5127daa8d...@n33g2000vbi.googlegroups.com>
<CAFppeEQMuHzcVm3LGCnk6MR0bMdKPwZjKjkVQ-BMZMxvKX3...@mail.gmail.com>
<b2725758-0175-4c85-a7c0-3fcd37db2...@5g2000vbf.googlegroups.com>
<CAFppeERNFF5DGg6T-DoVdQYEdiZnJzS3a8U1=Ns_yMyAuYR...@mail.gmail.com> <00f7bc32-ed62-4f66-bf55-95cca4334...@b26g2000vbt.googlegroups.com>
From: Spencer T Brody <spen...@10gen.com>
Date: Mon, 21 May 2012 11:03:44 -0400
Message-ID: <CAFppeETSKnJR5ebH07Tnf4GL3xjwkyA5nSD5=TEMQyiURQb...@mail.gmail.com>
Subject: Re: [mongodb-user] Re: Explicit blocking
To: mongodb-user@googlegroups.com
Content-Type: multipart/alternative; boundary=0015175cd3b493151904c08d3619
X-Gm-Message-State: ALoCoQky6WJxBCucmqdFdYWgxULsdfhMX8Tnq5RnX2GyKn3lFQ2TdV26I3sQRM0vv8lUBfjNQ6q7
--0015175cd3b493151904c08d3619
Content-Type: text/plain; charset=ISO-8859-1
If you do a query like {"_id":{"$gte":my_obj._id}} with a tailable cursor,
it will scan through the entire collection in $natural order, returning any
documents that match the query condition. It will not, however, be able to
jump directly to the place in the collection where the _ids are greater
than the value provided as the query will not be using an index.
As for the PHP driver and QueryOption_AwaitData, you've already
discovered PHP-389. Until that is fixed, you could still use tailable
cursors, it just means that if you try to fetch more results and no new
documents have been inserted, the getmore will return immediately instead
of blocking.
On Sun, May 20, 2012 at 7:28 AM, Saar Korren <s...@a.co.il> wrote:
> On the topic of question 2: It is possible to get an ObjectId from an
> insert, that much I know. What I'm wondering is if I can make a query
> that starts from an ObjectId, and proceeds in the natural order. Would
> {"_id":{"$gte":my_obj._id}} work as expected?
On a slightly different note, I've stumbled into an issue which might
> be a show-stopper for me. The PHP driver seems to have no way to turn
> on flag 5 (QueryOption_AwaitData) on a cursor. I've looked into the
> code, and only flags 1 (QueryOption_CursorTailable), 2
> (QueryOption_SlaveOk), 4 (QueryOption_NoCursorTimeout), and 7 appear
> to be supported through special functions. There does not appear to be
> an option to set arbitrary flags.
>
> Short of modifying and compiling a custom MongoDB PHP driver, I see no
> solution to this. And that is hardly a viable option, due to
> deployment difficulties involving a custom driver.
>
> On May 14, 10:46 pm, Spencer T Brody <spen...@10gen.com> wrote:
> > 1) Yes, you can still do a value query when using a tailable cursor.
> > Tailable cursors should always sort on $natural - it will iterate over
> the
> > documents in insertion order, not using any index. But as it considers
> > every document in insertion order, it can check that the document
> satisfies
> > a given query expression and only return it if it does
> > 2) There is no built-in way to do this, but you could do it by including
> a
> > timestamp or objectId in the documents as they get inserted, and query
> for
> > documents where the timestamp is greater than the one that you create
> with
> > the insert.
> > 3) It is currently not possible to shard a capped collection.
> > 4) In 2.0.x releases the timeout is approximately 4 seconds and there is
> no
> > way to configure that. If you want your code to be able to wait for new
> > documents for longer than that, you will need to put the querying client
> > code in a loop that will retry the query from where it left off if it
> times
> > out. The documentation athttp://
> www.mongodb.org/display/DOCS/Tailable+Cursorshas some examples of
> > doing this.
> >
> >
> >
> >
> >
> >
> >
> > On Sun, May 13, 2012 at 2:57 AM, Saar Korren <s...@a.co.il> wrote:
> > > Okay, just a couple more questions:
> > > 1. It is mentioned tailing cursors do not use indexes. I assume this
> > > only refers to the sorting order, but like I said, the documentation
> > > is confusing. Is it still possible to tail a collection based on a
> > > specific value query?
> > > 2. While I could probably find this out myself through some
> > > experimentation, it could save time if you could answer this: Is it
> > > possible to produce a tailable cursor from an insert? That is, insert
> > > a dummy document, and then wait for documents that are inserted
> > > "approximately after" the inserted document? (Preferably with some
> > > additional constraints)
> > > 3. Do tailable cursors support sharding? (Assuming the tail is on a
> > > single shard, of course. It would just make more sense to have a
> > > single collection with several tailable shards than to have a separate
> > > collection for each blockable event)
> > > 4. The documentation mentions a timeout on tailable cursors, which is
> > > good, but it does not mention what said timeout is. Is it possible to
> > > configure the timeout (per cursor or per connection or per
> > > collection)? Since I do need to handle a 30 seconds timeout, if the
> > > timeout is much longer than that I could be stuck with needlessly
> > > prolonged connections.
> >
> > > On May 10, 6:10 pm, Spencer T Brody <spen...@10gen.com> wrote:
> > > > You're right, the documentation here was a bit confusing. I just
> updated
> > > > it to make the blocking behavior more explicit.
> > > > There is some more documentation about the QueryOption_AwaitData flag
> > > here:
> > >http://api.mongodb.org/cplusplus/1.5.1/namespacemongo.html#a7261673f7.
> ..
> > > > .
> >
> > > > Using a tailable cursor will not cause a busy-wait - replication uses
> > > > tailable cursors to read the oplog and that would be really bad if
> > > > replication maxed out your CPU.
> >
> > > > On Thu, May 10, 2012 at 3:43 AM, Saar Korren <s...@a.co.il> wrote:
> > > > > Sounds like I could just use a tailable cursor with my own capped
> > > > > collection to create a global optimistic signalling system.
> However,
> > > > > the documentation on tailable cursors says nothing about blocking
> if
> > > > > no document exist, save for a comment in the first example. Are you
> > > > > certain about the blocking behavior? Would it prevent a busy-wait
> spin-
> > > > > lock? (I wouldn't want to max my CPU on a signal wait) Is this
> just a
> > > > > case of unclear documentation?
> >
> > > > > Actually, re-reading the examples, it seems to be related to the
> > > > > QueryOption_AwaitData flag. What does it do for cursors which are
> not
> > > > > tailable? (The documentation is quite confusing)
> >
> > > > > On May 9, 6:35 pm, Spencer T Brody <spen...@10gen.com> wrote:
> > > > > > MongoDB does not currently have any general signaling and
> blocking
> > > > > > capabilities. If you just want to be notified when a document is
> > > > > updated,
> > > > > > however, one thing you could do is tail the oplog. The oplog
> records
> > > > > every
> > > > > > update that happens for use in replication. Because the oplog
> is a
> > > > > capped
> > > > > > collection, you can use a tailable cursor on it. Unlike a normal
> > > cursor,
> > > > > > when you query a tailable cursor and it runs out of results,
> rather
> > > than
> > > > > > returning it will block until there are new results to return.
> You
> > > could
> > > > > > write something to query the oplog with a tailable cursor so that
> > > you'll
> > > > > > receive notification of every new write right when it happens.
> >
> > > > > > More information on the oplog is
> > > > > > here:http://www.mongodb.org/display/DOCS/Replica+Sets+-+Oplog,
> and
> > > > > > information on tailable cursors is
> > > > > > here:http://www.mongodb.org/display/DOCS/Tailable+Cursors
> >
> > > > > > On Wednesday, May 9, 2012 10:24:10 AM UTC-4, Saar Korren wrote:
> >
> > > > > > > I am currently planning the migration of a large-scale service
> from
> > > > > > > MySQL to MongoDB. While in most use cases involved in the
> system
> > > > > > > MongoDB seems to be a superior solution (Especially considering
> > > most
> > > > > > > of the SQL queries were already optimized in a manner that is
> more
> > > > > > > consistent with MongoDB's paradigms), there is one feature of
> > > which I
> > > > > > > could not find an equivalent in MongoDB: Explicit locks.
> >
> > > > > > > Currently, I'm using explicit locks for three purposes:
> > > > > > > 1. Schema migration - This will be completely removed with the
> > > move to
> > > > > > > MongoDB.
> > > > > > > 2. Thrash reduction in job-queue polling. I use a lock to
> reduce
> > > > > > > collisions between workers polling job queues. The polling
> queries
> > > > > > > themselves are already designed to be atomic and collision
> free.
> > > > > > > However, a collision would result in a wasted poll-spin all but
> > > one of
> > > > > > > the workers, and with a sufficiently large quantity of workers
> a
> > > > > > > pessimistic lock has proven to drastically boost performance.
> This
> > > is
> > > > > > > not mandatory, but I would rather keep it.
> > > > > > > 3. Transforming asynchronous calls into a synchronous callback.
> > > This
> > > > > > > part is mandatory. I have one synchronous script which can
> block
> > > up to
> > > > > > > 30 seconds waiting for a call to another script which would
> release
> > > > > > > it. I was able to achieve a semaphore-like blocking system
> using
> > > > > > > MySQL's GET_LOCK, IS_USED_LOCK, and KILL. It's a bit of a hack,
> > > but it
> > > > > > > serves its purpose, to a point.
> >
> > > > > > > Point number 3 above is the most important one for me. As far
> as I
> > > > > > > could tell, MongoDB has no method to explicitly block for any
> > > > > > > controllable event, and, as the wait can reach several seconds
> > > even on
> > > > > > > normal operations, a spin-lock is simply not an option for me.
> > > > > > > Obviously, if there was a "wait for change" command for
> documents,
> > > > > > > even an optimistic one with no hard guarantees about changes
> made,
> > > > > > > that would solve my problem (Using a semi-blocking semi-spin
> > > > > > > signalling system). But as far as I could tell, there isn't.
> >
> > > > > > > I suppose I could continue to use MySQL user locks, but that
> comes
> > > > > > > with all the flaws of still relying on the MySQL database.
> >
> > > > > > > Is there any recommended method or system to work alongside
> MongoDB
> > > > > > > for explicit signalling and blocking?
> > > > > > > (Preferably one that shares MongoDB's properties regarding
> failover
> > > > > > > and potential sharding. And, of course, the lock manager being
> on a
> > > > > > > separate server from the blocking and signalling scripts)
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "mongodb-user" group.
> > > > > To post to this group, send email to mongodb-user@googlegroups.com
> .
> > > > > To unsubscribe from this group, send email to
> > > > > mongodb-user+unsubscribe@googlegroups.com.
> > > > > For more options, visit this group at
> > > > >http://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 mongodb-user@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > mongodb-user+unsubscribe@googlegroups.com.
> > > For more options, visit this group at
> > >http://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 mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
>
--0015175cd3b493151904c08d3619
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div class=3D"gmail_quote"><div>If you do a query like=A0{"_id":{=
"$gte":my_obj._id}} with a tailable cursor, it will scan through =
the entire collection in $natural order, returning any documents that match=
the query condition. =A0It will not, however, be able to jump directly to =
the place in the collection where the _ids are greater than the value provi=
ded as the query will not be using an index.</div>
<div><br></div><div>As for the PHP driver and QueryOption_AwaitData, you=
9;ve already discovered=A0PHP-389. =A0Until that is fixed, you could still =
use tailable cursors, it just means that if you try to fetch more results a=
nd no new documents have been inserted, the getmore will return immediately=
instead of blocking.</div>
<div><br></div></div><div class=3D"gmail_quote">On Sun, May 20, 2012 at 7:2=
8 AM, Saar Korren <span dir=3D"ltr"><<a href=3D"mailto:s...@a.co.il" tar=
get=3D"_blank">s...@a.co.il</a>></span> wrote:<br><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex">
On the topic of question 2: It is possible to get an ObjectId from an<br>
insert, that much I know. What I'm wondering is if I can make a query<b=
r>
that starts from an ObjectId, and proceeds in the natural order. Would<br>
{"_id":{"$gte":my_obj._id}} work as expected?=A0</block=
quote><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex">
On a slightly different note, I've stumbled into an issue which might<b=
r>
be a show-stopper for me. The PHP driver seems to have no way to turn<br>
on flag 5 (QueryOption_AwaitData) on a cursor. I've looked into the<br>
code, and only flags 1 (QueryOption_CursorTailable), 2<br>
(QueryOption_SlaveOk), 4 (QueryOption_NoCursorTimeout), and 7 appear<br>
to be supported through special functions. There does not appear to be<br>
an option to set arbitrary flags.<br>
<br>
Short of modifying and compiling a custom MongoDB PHP driver, I see no<br>
solution to this. And that is hardly a viable option, due to<br>
deployment difficulties involving a custom driver.<br>
<div class=3D"im"><br>
On May 14, 10:46=A0pm, Spencer T Brody <<a href=3D"mailto:spen...@10gen.=
com">spen...@10gen.com</a>> wrote:<br>
> 1) Yes, you can still do a value query when using a tailable cursor.<b=
r>
> =A0Tailable cursors should always sort on $natural - it will iterate o=
ver the<br>
> documents in insertion order, not using any index. =A0But as it consid=
ers<br>
> every document in insertion order, it can check that the document sati=
sfies<br>
> a given query expression and only return it if it does<br>
> 2) There is no built-in way to do this, but you could do it by includi=
ng a<br>
> timestamp or objectId in the documents as they get inserted, and query=
for<br>
> documents where the timestamp is greater than the one that you create =
with<br>
> the insert.<br>
> 3) It is currently not possible to shard a capped collection.<br>
> 4) In 2.0.x releases the timeout is approximately 4 seconds and there =
is no<br>
> way to configure that. =A0If you want your code to be able to wait for=
new<br>
> documents for longer than that, you will need to put the querying clie=
nt<br>
> code in a loop that will retry the query from where it left off if it =
times<br>
</div>> out. =A0The documentation athttp://<a href=3D"http://www.mongodb=
.org/display/DOCS/Tailable+Cursorshas" target=3D"_blank">www.mongodb.org/di=
splay/DOCS/Tailable+Cursorshas</a> some examples of<br>
> doing this.<br>
<div><div class=3D"h5">><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On Sun, May 13, 2012 at 2:57 AM, Saar Korren <<a href=3D"mailto:s..=
....@a.co.il">s...@a.co.il</a>> wrote:<br>
> > Okay, just a couple more questions:<br>
> > 1. It is mentioned tailing cursors do not use indexes. I assume t=
his<br>
> > only refers to the sorting order, but like I said, the documentat=
ion<br>
> > is confusing. Is it still possible to tail a collection based on =
a<br>
> > specific value query?<br>
> > 2. While I could probably find this out myself through some<br>
> > experimentation, it could save time if you could answer this: Is =
it<br>
> > possible to produce a tailable cursor from an insert? That is, in=
sert<br>
> > a dummy document, and then wait for documents that are inserted<b=
r>
> > "approximately after" the inserted document? (Preferabl=
y with some<br>
> > additional constraints)<br>
> > 3. Do tailable cursors support sharding? (Assuming the tail is on=
a<br>
> > single shard, of course. It would just make more sense to have a<=
br>
> > single collection with several tailable shards than to have a sep=
arate<br>
> > collection for each blockable event)<br>
> > 4. The documentation mentions a timeout on tailable cursors, whic=
h is<br>
> > good, but it does not mention what said timeout is. Is it possibl=
e to<br>
> > configure the timeout (per cursor or per connection or per<br>
> > collection)? Since I do need to handle a 30 seconds timeout, if t=
he<br>
> > timeout is much longer than that I could be stuck with needlessly=
<br>
> > prolonged connections.<br>
><br>
> > On May 10, 6:10 pm, Spencer T Brody <<a href=3D"mailto:spen...=
@10gen.com">spen...@10gen.com</a>> wrote:<br>
> > > You're right, the documentation here was a bit confusing=
. =A0I just updated<br>
> > > it to make the blocking behavior more explicit.<br>
> > > There is some more documentation about the QueryOption_Await=
Data flag<br>
> > here:<br>
> ><a href=3D"http://api.mongodb.org/cplusplus/1.5.1/namespacemongo.h=
tml#a7261673f7." target=3D"_blank">http://api.mongodb.org/cplusplus/1.5.1/n=
amespacemongo.html#a7261673f7.</a>..<br>
> > > .<br>
><br>
> > > Using a tailable cursor will not cause a busy-wait - replica=
tion uses<br>
> > > tailable cursors to read the oplog and that would be really =
bad if<br>
> > > replication maxed out your CPU.<br>
><br>
> > > On Thu, May 10, 2012 at 3:43 AM, Saar Korren <<a href=3D"=
mailto:s...@a.co.il">s...@a.co.il</a>> wrote:<br>
> > > > Sounds like I could just use a tailable cursor with my =
own capped<br>
> > > > collection to create a global optimistic signalling sys=
tem. However,<br>
> > > > the documentation on tailable cursors says nothing abou=
t blocking if<br>
> > > > no document exist, save for a comment in the first exam=
ple. Are you<br>
> > > > certain about the blocking behavior? Would it prevent a=
busy-wait spin-<br>
> > > > lock? (I wouldn't want to max my CPU on a signal wa=
it) Is this just a<br>
> > > > case of unclear documentation?<br>
><br>
> > > > Actually, re-reading the examples, it seems to be relat=
ed to the<br>
> > > > QueryOption_AwaitData flag. What does it do for cursors=
which are not<br>
> > > > tailable? (The documentation is quite confusing)<br>
><br>
> > > > On May 9, 6:35 pm, Spencer T Brody <<a href=3D"mailt=
o:spen...@10gen.com">spen...@10gen.com</a>> wrote:<br>
> > > > > MongoDB does not currently have any general signal=
ing and blocking<br>
> > > > > capabilities. =A0If you just want to be notified w=
hen a document is<br>
> > > > updated,<br>
> > > > > however, one thing you could do is tail the oplog.=
=A0The oplog records<br>
> > > > every<br>
> > > > > update that happens for use in replication. =A0Bec=
ause the oplog is a<br>
> > > > capped<br>
> > > > > collection, you can use a tailable cursor on it. =
=A0Unlike a normal<br>
> > cursor,<br>
> > > > > when you query a tailable cursor and it runs out o=
f results, rather<br>
> > than<br>
> > > > > returning it will block until there are new result=
s to return. =A0You<br>
> > could<br>
> > > > > write something to query the oplog with a tailable=
cursor so that<br>
> > you'll<br>
> > > > > receive notification of every new write right when=
it happens.<br>
><br>
> > > > > More information on the oplog is<br>
> > > > > here:<a href=3D"http://www.mongodb.org/display/DOC=
S/Replica+Sets+-+Oplog" target=3D"_blank">http://www.mongodb.org/display/DO=
CS/Replica+Sets+-+Oplog</a>, and<br>
> > > > > information on tailable cursors is<br>
> > > > > here:<a href=3D"http://www.mongodb.org/display/DOC=
S/Tailable+Cursors" target=3D"_blank">http://www.mongodb.org/display/DOCS/T=
ailable+Cursors</a><br>
><br>
> > > > > On Wednesday, May 9, 2012 10:24:10 AM UTC-4, Saar =
Korren wrote:<br>
><br>
> > > > > > I am currently planning the migration of a la=
rge-scale service from<br>
> > > > > > MySQL to MongoDB. While in most use cases inv=
olved in the system<br>
> > > > > > MongoDB seems to be a superior solution (Espe=
cially considering<br>
> > most<br>
> > > > > > of the SQL queries were already optimized in =
a manner that is more<br>
> > > > > > consistent with MongoDB's paradigms), the=
re is one feature of<br>
> > which I<br>
> > > > > > could not find an equivalent in MongoDB: Expl=
icit locks.<br>
><br>
> > > > > > Currently, I'm using explicit locks for t=
hree purposes:<br>
> > > > > > 1. Schema migration - This will be completely=
removed with the<br>
> > move to<br>
> > > > > > MongoDB.<br>
> > > > > > 2. Thrash reduction in job-queue polling. I u=
se a lock to reduce<br>
> > > > > > collisions between workers polling job queues=
. The polling queries<br>
> > > > > > themselves are already designed to be atomic =
and collision free.<br>
> > > > > > However, a collision would result in a wasted=
poll-spin all but<br>
> > one of<br>
> > > > > > the workers, and with a sufficiently large qu=
antity of workers a<br>
> > > > > > pessimistic lock has proven to drastically bo=
ost performance. This<br>
> > is<br>
> > > > > > not mandatory, but I would rather keep it.<br=
>
> > > > > > 3. Transforming asynchronous calls into a syn=
chronous callback.<br>
> > This<br>
> > > > > > part is mandatory. I have one synchronous scr=
ipt which can block<br>
> > up to<br>
> > > > > > 30 seconds waiting for a call to another scri=
pt which would release<br>
> > > > > > it. I was able to achieve a semaphore-like bl=
ocking system using<br>
> > > > > > MySQL's GET_LOCK, IS_USED_LOCK, and KILL.=
It's a bit of a hack,<br>
> > but it<br>
> > > > > > serves its purpose, to a point.<br>
><br>
> > > > > > Point number 3 above is the most important on=
e for me. As far as I<br>
> > > > > > could tell, MongoDB has no method to explicit=
ly block for any<br>
> > > > > > controllable event, and, as the wait can reac=
h several seconds<br>
> > even on<br>
> > > > > > normal operations, a spin-lock is simply not =
an option for me.<br>
> > > > > > Obviously, if there was a "wait for chan=
ge" command for documents,<br>
> > > > > > even an optimistic one with no hard guarantee=
s about changes made,<br>
> > > > > > that would solve my problem (Using a semi-blo=
cking semi-spin<br>
> > > > > > signalling system). But as far as I could tel=
l, there isn't.<br>
><br>
> > > > > > I suppose I could continue to use MySQL user =
locks, but that comes<br>
> > > > > > with all the flaws of still relying on the My=
SQL database.<br>
><br>
> > > > > > Is there any recommended method or system to =
work alongside MongoDB<br>
> > > > > > for explicit signalling and blocking?<br>
> > > > > > (Preferably one that shares MongoDB's pro=
perties regarding failover<br>
> > > > > > and potential sharding. And, of course, the l=
ock manager being on a<br>
> > > > > > separate server from the blocking and signall=
ing scripts)<br>
><br>
> > > > --<br>
> > > > You received this message because you are subscribed to=
the Google<br>
> > Groups<br>
> > > > "mongodb-user" group.<br>
> > > > To post to this group, send email to <a href=3D"mailto:=
mongodb-user@googlegroups.com">mongodb-user@googlegroups.com</a>.<br>
> > > > To unsubscribe from this group, send email to<br>
> > > > <a href=3D"mailto:mongodb-user%2Bunsubscribe@googlegrou=
ps.com">mongodb-user+unsubscribe@googlegroups.com</a>.<br>
> > > > For more options, visit this group at<br>
> > > ><a href=3D"http://groups.google.com/group/mongodb-user?h=
l=3Den" target=3D"_blank">http://groups.google.com/group/mongodb-user?hl=3D=
en</a>.<br>
><br>
> > --<br>
> > You received this message because you are subscribed to the Googl=
e Groups<br>
> > "mongodb-user" group.<br>
> > To post to this group, send email to <a href=3D"mailto:mongodb-us=
er@googlegroups.com">mongodb-user@googlegroups.com</a>.<br>
> > To unsubscribe from this group, send email to<br>
> > <a href=3D"mailto:mongodb-user%2Bunsubscribe@googlegroups.com">mo=
ngodb-user+unsubscribe@googlegroups.com</a>.<br>
> > For more options, visit this group at<br>
> ><a href=3D"http://groups.google.com/group/mongodb-user?hl=3Den" ta=
rget=3D"_blank">http://groups.google.com/group/mongodb-user?hl=3Den</a>.<br=
>
<br>
--<br>
You received this message because you are subscribed to the Google<br>
Groups "mongodb-user" group.<br>
To post to this group, send email to <a href=3D"mailto:mongodb-user@googleg=
roups.com">mongodb-user@googlegroups.com</a><br>
To unsubscribe from this group, send email to<br>
<a href=3D"mailto:mongodb-user%2Bunsubscribe@googlegroups.com">mongodb-user=
+unsubscribe@googlegroups.com</a><br>
</div></div>See also the IRC channel -- <a href=3D"http://freenode.net#mong=
odb" target=3D"_blank">freenode.net#mongodb</a><br>
</blockquote></div><br>
--0015175cd3b493151904c08d3619--