You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Ian Boston <ie...@tfd.co.uk> on 2013/01/29 23:42:48 UTC

Concurrency Question

Hi,
Are the concurrency characteristics of MongoDB [1] relevant to write
concurrency in Oak ?

IIUC from the presentation MongoDB pre 2.2 had global exclusive write
locks and post 2.2 has per database exclusive write locks which might
be scoped to the shard if the update only impacts a single shard.

I am assuming that any storage implementation for Oak won't rely on
this characteristic and could use a less synchronised storage
mechanism from one of the other providers ?

I ask, because I don't know if this is relevant, and want to be educated.

Thanks
Ian

1 http://www.10gen.com/presentations/concurrency-internals-mongodb-v22

RE: Concurrency Question

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

to elaborate a bit more on this topic. with the current mongomk
implementation the serializing aspect of the sync collection leaks
into the commit collection. that is, even though mongomk allows
two collections to concurrently write nodes and commits, it eventually
has to serialize on the sync update. but if that fails and in most
cases it will fail when you have concurrent commits, then it currently
means one of the writes will have to retry, which includes writing
the nodes and the commit document again. This is captured in
OAK-585.

As mentioned in the issue [0] a scheduler may help here to avoid
retries. An alternative approach was brought up by Jukka in his
MongoMK^2 proposal. Maintain multiple Journals in a hierarchy at
the cost of consistency. The way this could be implemented in the
current MongoMK is to have multiple documents in the sync
collection (aka journal heads). A process then needs to merge those
Journals regularly and handle conflicts.

Regards
 Marcel

[0] https://issues.apache.org/jira/browse/OAK-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13566335#comment-13566335

> -----Original Message-----
> From: Thomas Mueller [mailto:mueller@adobe.com]
> Sent: Donnerstag, 31. Januar 2013 09:21
> To: oak-dev@jackrabbit.apache.org
> Subject: Re: Concurrency Question
> 
> Hi,
> 
> >no, it's quite different. the equivalent to the journal in Jackrabbit 2.x
> >is rather the commit collection.
> >
> >the sync collection contains only a single document, which points to
> >the head of the commit history. so, it is somewhat similar to the
> >InstanceRevision we have in Jackrabbit 2.x clustering.
> 
> Sorry for the confusion, Marcel is right of course. The only way that the
> MongoMK "sync" collection is similar to the Jackrabbit 2.x journal is:
> write access to both is serialized. But that's it. (I hope I got that
> right now :-)
> 
> Regards,
> Thomas
> 


Re: Concurrency Question

Posted by Ian Boston <ie...@tfd.co.uk>.
On 31 January 2013 21:36, Thomas Mueller <mu...@adobe.com> wrote:
> Hi,
>
>>fuzzy distributed
>>time signal (as used in Google Spanner)
>
>
> That's quite interesting actually: Google Spanner relies on cluster nodes
> having very accurate clocks (atomic clocks / GPS): "TrueTime"

Only for the masters and then only to tie geographically distributed
servers to the same concept of TrueTime. In the same datacenter I
think the algorithm relies on determining jitter between nodes and
masters can agree amongst themselves what TrueTime is.

However for those that can't put GPS clocks into distributed
datacenters, and have control over the quality of the low level
hardware the fuzz on TrueTime is going to be too large to be of use.

I was thinking a highly accurate timestamp with knowledge of the
jitter might help in conflict resolution at merge time.... but maybe
not.

Ian

>
> http://www.wired.com/wiredenterprise/2012/09/google-spanner/all/
> http://static.googleusercontent.com/external_content/untrusted_dlcp/researc
> h.google.com/en//archive/spanner-osdi2012.pdf
>
>
> Regards,
> Thomas
>

Re: Concurrency Question

Posted by Ian Boston <ie...@tfd.co.uk>.
Please ignore my message, Marcel answered my questions.
Ian

On 31 January 2013 20:15, Ian Boston <ie...@tfd.co.uk> wrote:
> On 31 January 2013 19:21, Thomas Mueller <mu...@adobe.com> wrote:
>> Hi,
>>
>>>no, it's quite different. the equivalent to the journal in Jackrabbit 2.x
>>>is rather the commit collection.
>>>
>>>the sync collection contains only a single document, which points to
>>>the head of the commit history. so, it is somewhat similar to the
>>>InstanceRevision we have in Jackrabbit 2.x clustering.
>>
>> Sorry for the confusion, Marcel is right of course. The only way that the
>> MongoMK "sync" collection is similar to the Jackrabbit 2.x journal is:
>> write access to both is serialized. But that's it. (I hope I got that
>> right now :-)
>
>
> IIRC In JR2 each journal update was in a transaction that incremented
> the revision number, so the sequence had no holes.
>
> In MongoMK, am I right in thinking that since the sync collection only
> points to the head revision it only needs to be locked for as long as
> it takes to write the pointer to the head revision vastly reducing the
> time which other writers are blocked.
>
> Is that right or is the serialisation the same as in JR2 ?
>
> Also wondering: Do you need a sync at all or would a fuzzy distributed
> time signal (as used in Google Spanner) would give you enough padding
> between operations to know their sequence ?
> Please dont waste any time on this if its a simple "no".
>
> Ian
>
>
>>
>> Regards,
>> Thomas
>>
>>

Re: Concurrency Question

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>fuzzy distributed
>time signal (as used in Google Spanner)


That's quite interesting actually: Google Spanner relies on cluster nodes
having very accurate clocks (atomic clocks / GPS): "TrueTime"

http://www.wired.com/wiredenterprise/2012/09/google-spanner/all/
http://static.googleusercontent.com/external_content/untrusted_dlcp/researc
h.google.com/en//archive/spanner-osdi2012.pdf


Regards,
Thomas


Re: Concurrency Question

Posted by Ian Boston <ie...@tfd.co.uk>.
On 31 January 2013 19:21, Thomas Mueller <mu...@adobe.com> wrote:
> Hi,
>
>>no, it's quite different. the equivalent to the journal in Jackrabbit 2.x
>>is rather the commit collection.
>>
>>the sync collection contains only a single document, which points to
>>the head of the commit history. so, it is somewhat similar to the
>>InstanceRevision we have in Jackrabbit 2.x clustering.
>
> Sorry for the confusion, Marcel is right of course. The only way that the
> MongoMK "sync" collection is similar to the Jackrabbit 2.x journal is:
> write access to both is serialized. But that's it. (I hope I got that
> right now :-)


IIRC In JR2 each journal update was in a transaction that incremented
the revision number, so the sequence had no holes.

In MongoMK, am I right in thinking that since the sync collection only
points to the head revision it only needs to be locked for as long as
it takes to write the pointer to the head revision vastly reducing the
time which other writers are blocked.

Is that right or is the serialisation the same as in JR2 ?

Also wondering: Do you need a sync at all or would a fuzzy distributed
time signal (as used in Google Spanner) would give you enough padding
between operations to know their sequence ?
Please dont waste any time on this if its a simple "no".

Ian


>
> Regards,
> Thomas
>
>

Re: Concurrency Question

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>no, it's quite different. the equivalent to the journal in Jackrabbit 2.x
>is rather the commit collection.
>
>the sync collection contains only a single document, which points to
>the head of the commit history. so, it is somewhat similar to the
>InstanceRevision we have in Jackrabbit 2.x clustering.

Sorry for the confusion, Marcel is right of course. The only way that the
MongoMK "sync" collection is similar to the Jackrabbit 2.x journal is:
write access to both is serialized. But that's it. (I hope I got that
right now :-)

Regards,
Thomas



RE: Concurrency Question

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

no, it's quite different. the equivalent to the journal in Jackrabbit 2.x
is rather the commit collection.

the sync collection contains only a single document, which points to
the head of the commit history. so, it is somewhat similar to the
InstanceRevision we have in Jackrabbit 2.x clustering.

Regards
 Marcel


> -----Original Message-----
> From: ianboston@gmail.com [mailto:ianboston@gmail.com] On Behalf Of Ian
> Boston
> Sent: Donnerstag, 31. Januar 2013 06:46
> To: oak-dev@jackrabbit.apache.org
> Subject: Re: Concurrency Question
> 
> On 30 January 2013 20:27, Thomas Mueller <mu...@adobe.com> wrote:
> 
> > For the current MongoMK implementation, it's the "sync" collection.
> 
> Is that conceptually equivalent to the journal in Jackrabbit 2.x ?
> Ian
> 
> >
> > Regards,
> > Thomas
> >

Re: Concurrency Question

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>>For the current MongoMK implementation, it's the "sync" collection.
>
>Is that conceptually equivalent to the journal in Jackrabbit 2.x ?

In a way, yes. Actually there is also a (currently serialized) journal in
the MongoMK, same as in Jackrabbit 2.x.

I just noticed we didn't define scalable writes as a goal:
http://wiki.apache.org/jackrabbit/Goals%20and%20non%20goals%20for%20Jackrab
bit%203 - we have "High write throughput across cluster nodes" and
"Concurrent writes within single cluster node". In my view, we simply
forgot to explicitly add "Concurrent, scalable writes within multiple
cluster nodes" as a goal. Unless somebody disagrees of course.

Regards,
Thomas


Re: Concurrency Question

Posted by Ian Boston <ie...@tfd.co.uk>.
On 30 January 2013 20:27, Thomas Mueller <mu...@adobe.com> wrote:

> For the current MongoMK implementation, it's the "sync" collection.

Is that conceptually equivalent to the journal in Jackrabbit 2.x ?
Ian

>
> Regards,
> Thomas
>

Re: Concurrency Question

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>Is the one collection that can't be sharded the one holding the root
>of the repo ?

For the current MongoMK implementation, it's the "sync" collection.

Regards,
Thomas


Re: Concurrency Question

Posted by Ian Boston <ie...@tfd.co.uk>.
Hi,
Thanks for educating me, that makes sense.

Is the one collection that can't be sharded the one holding the root
of the repo ?
(my oak terminology might not be right, sorry)

Ian


On 30 January 2013 19:53, Thomas Mueller <mu...@adobe.com> wrote:
> Hi,
>
> As far as I understand, this was within one shard and replica (one
> mongod). See also: http://www.infoq.com/news/2010/08/MongoDB-1.6
>
> For scalable writes, we would need to write concurrently to different
> shards. Even if all operations within one shard are synchronized (and I
> don't think that's the case), Oak would still be scalable. Concurrent
> operations within one mongod might improve performance / throughput
> however.
>
>
> The current MongoMK does have a scalability problem in my view, because
> there is at least one collection that can't be sharded. But I guess this
> is something we need to solve anyway, if we really want to have a scalable
> solution.
>
> Regards,
> Thomas
>
>
>
>
> On 1/29/13 11:42 PM, "Ian Boston" <ie...@tfd.co.uk> wrote:
>
>>Hi,
>>Are the concurrency characteristics of MongoDB [1] relevant to write
>>concurrency in Oak ?
>>
>>IIUC from the presentation MongoDB pre 2.2 had global exclusive write
>>locks and post 2.2 has per database exclusive write locks which might
>>be scoped to the shard if the update only impacts a single shard.
>>
>>I am assuming that any storage implementation for Oak won't rely on
>>this characteristic and could use a less synchronised storage
>>mechanism from one of the other providers ?
>>
>>I ask, because I don't know if this is relevant, and want to be educated.
>>
>>Thanks
>>Ian
>>
>>1 http://www.10gen.com/presentations/concurrency-internals-mongodb-v22
>

Re: Concurrency Question

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

As far as I understand, this was within one shard and replica (one
mongod). See also: http://www.infoq.com/news/2010/08/MongoDB-1.6

For scalable writes, we would need to write concurrently to different
shards. Even if all operations within one shard are synchronized (and I
don't think that's the case), Oak would still be scalable. Concurrent
operations within one mongod might improve performance / throughput
however.


The current MongoMK does have a scalability problem in my view, because
there is at least one collection that can't be sharded. But I guess this
is something we need to solve anyway, if we really want to have a scalable
solution.

Regards,
Thomas




On 1/29/13 11:42 PM, "Ian Boston" <ie...@tfd.co.uk> wrote:

>Hi,
>Are the concurrency characteristics of MongoDB [1] relevant to write
>concurrency in Oak ?
>
>IIUC from the presentation MongoDB pre 2.2 had global exclusive write
>locks and post 2.2 has per database exclusive write locks which might
>be scoped to the shard if the update only impacts a single shard.
>
>I am assuming that any storage implementation for Oak won't rely on
>this characteristic and could use a less synchronised storage
>mechanism from one of the other providers ?
>
>I ask, because I don't know if this is relevant, and want to be educated.
>
>Thanks
>Ian
>
>1 http://www.10gen.com/presentations/concurrency-internals-mongodb-v22