﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Vlad,
I wrote a five parts series about this exact topic:
http://ayende.com/blog/155809/api-design-sharding-status-for-failure-scenarios?key=167619a5bdec4055a66651904916ffb4
http://ayende.com/blog/155841/api-design-sharding-status-for-failure-scenariosndash-ignore-and-move-on?key=fe08107267224788b42ce633469418ec
http://ayende.com/blog/155873/api-design-sharding-status-for-failure-scenariosndash-explicit-failure-management?key=341dc08c7fde407a83dc2b7ad81c3bd0
http://ayende.com/blog/155905/api-design-sharding-status-for-failure-scenariosndash-explicit-failure-management-doesnrsquo-t-work?key=c9a5a273ba8d4029bd2f111e3a7293c8
http://ayende.com/blog/155937/api-design-sharding-status-for-failure-scenariosndash-solving-at-the-right-granularity?key=f3e596cb1e5342c193aa617553adea5d

I would like your opinion about this.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment27</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment27</guid><pubDate>Mon, 09 Apr 2012 11:33:28 GMT</pubDate></item><item><title>Vlad commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Sure things, Oren. A user should be notified in case when the system avoids unhandled exception. Basically I think about only Load&lt;T&gt;(id) operation which returns only single value. In this case we can: 1. return found document (if any exists); 2.return null; 3. return exception when not found any and connection is broken. Yes, you are right - the system must guarantee that user see all requested data _or_ notify about the problem like "You cannot view requested data because...", or in very rare situation - show part of requested data _and_ notify about the problem like "You see not all of requested data because..."</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment26</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment26</guid><pubDate>Mon, 09 Apr 2012 11:29:48 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Vlad,
Note that one thing that you have to worry about in this scenario is actually _knowing_ that you have a connection problem. The absolute worst thing you can have is to have a connection problem and for some of the data to just go away without you actually noticing.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment25</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment25</guid><pubDate>Mon, 09 Apr 2012 06:21:51 GMT</pubDate></item><item><title>Vlad commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Oren, here is an example of the case. One of a system customers wants to store their data in separated db instance, in their own network/datacenter. Database is sharded by Customer. The customer also wants to store user accounts at their site (very paranoidal policy). I want to avoid situation when customer's connection problems will affect the system and other users will not have access to it. It will be great to have sharding which helps to avoid the problem.
I've investigated the code of existing Access strategies (Sequential and Parallel) and as I see I can write the same but with appropriate exception handling. Thank you and your team for readable code!</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment24</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment24</guid><pubDate>Sun, 08 Apr 2012 23:04:44 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Vlad,
Right now, we don't handle this scenario, and that is on purpose.
I don't know what the kind of behavior to implement here would be.
But we do provide a hook to show how you can handle that yourself, giving you the ability to handle that.
The hook is the IShardAccessStrategy.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment23</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment23</guid><pubDate>Sun, 08 Apr 2012 10:14:37 GMT</pubDate></item><item><title>Vlad commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Oren, can I retrieve results if even nodes which doesn't contain appropriate data are down (offline)? Shards located in different datacentres. Simple example:
1. I do Load&lt;T&gt;(ID) from ShardedDocumentStore [Shard1, Shard2].
2. Shard 1 is online. Shard2 is offline (down).
3. Shard 1 contains required document.
I have exception in this case. How I can setup a session for retrieving available data? Does Raven have this possibility?

</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment22</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment22</guid><pubDate>Fri, 06 Apr 2012 22:10:16 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Sonic,
No, you can do it easily with RavenDB.
You need to provide two values to the ShardingOn method, the first is to extract the value from the entity, and the second is to convert the value to the shard id.
That way, you can do things like arbitrary or date based.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment21</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment21</guid><pubDate>Tue, 03 Apr 2012 00:05:10 GMT</pubDate></item><item><title>Sonic commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Is there a way to "partition/shard" the data by a dynamic/arbitrary sequential value like date?  In other words, could I tell RavenDB to partition a DocumentStore by month or do I have to explicitly define the shard like in your example of region?</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment20</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment20</guid><pubDate>Mon, 02 Apr 2012 17:44:11 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Petar,
Sure, take all the data from the sharded instances and put it in one box.
Then use the standard DocumentStore</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment19</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment19</guid><pubDate>Sun, 01 Apr 2012 08:34:41 GMT</pubDate></item><item><title>petar commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Is there a path that one can take to reverse the sharded DB back into single instance?

Thanks.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment18</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment18</guid><pubDate>Sat, 31 Mar 2012 02:35:43 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Morcs,
We provide an extension point for you to inject your own behavior, so I am not sure if an exception would be a good idea here.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment16</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment16</guid><pubDate>Fri, 23 Mar 2012 10:59:16 GMT</pubDate></item><item><title>morcs commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Understood :) I've not had to use anything like sharding before but it would worry me that:

session.Query(...).OrderBy(...).Skip(x)

would return different, possibly confusing results in a sharded setup, but I do understand why.

Would the "safe by default" principle suggest that we should get an exception when trying to use Skip on an IOrderedQueryable in a sharded setup?</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment15</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment15</guid><pubDate>Fri, 23 Mar 2012 09:17:44 GMT</pubDate></item><item><title>Thomas Krause commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>@morcs and Jonty

Doing sorting and paging at the same time like being described is hard. One solution I could think of is using the same attribute for sharding and sorting.

So in the example above you could sort first by region and then by name. This would get the first pages from server A, the next pages from server B and so on. I'm not sure if this is already supported by RavenDB, but it shouldn't be too complicated. In case you reach the end of one shard and only get a partial page, you would need to do another request for the next shard to fill the page.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment14</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment14</guid><pubDate>Thu, 22 Mar 2012 21:14:49 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Morcs, 
It would get the 10 - 20 results from each server, sort them and give you 10 results </description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment13</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment13</guid><pubDate>Thu, 22 Mar 2012 11:54:18 GMT</pubDate></item><item><title>morcs commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>I guess what I really should do is download Raven DB and try it for myself, since Ayende's put so much effort in to making that as simple as possible to do :)</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment12</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment12</guid><pubDate>Thu, 22 Mar 2012 11:08:57 GMT</pubDate></item><item><title>morcs commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>So would the result of (hope the formatting works):

session.Query...()
.Skip(10)
.Take(10)
.ToList()

return unexpected results under sharding? Or would it get 20 results from each server and do the Skip and Take client-side?</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment11</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment11</guid><pubDate>Thu, 22 Mar 2012 11:07:47 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Geert,
Yes, you are correct.
You _cannot_ get a globally paged sharded result without having access to all of the information.
Now, we may provide feedback in the future that will allow you to fine tune those per shard, but this is _really_ hard to do, and place undue burden on the client.

More than that, the actual scenario doesn't look too good from a business point of view either. In a sharded env, you respect the sharding, and you don't try to go ahead and do things like this on the fly. You would modify your behavior so your queries respected the shard boundaries.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment10</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment10</guid><pubDate>Thu, 22 Mar 2012 09:56:43 GMT</pubDate></item><item><title>Jonty commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>I'm with Geert here. Logically you'd have to bring back m results from each server, as the first record on any given server could be in the desired page. Unless you did some kind of round robin between servers before returning to the client.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment9</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment9</guid><pubDate>Wed, 21 Mar 2012 21:49:20 GMT</pubDate></item><item><title>Geert Baeyaert commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Ok, I must be missing something.

Let's say we want document 3 through 5, sorted by key.  There are 2 servers in the cluster.
Server A contains docs with key A, B, C, E, H.
Server B contains docs with key D, F, G, I, J

The expected result without clustering is C, D, E.

However, with clustering:
Server A : C, E, H
Server B : G, I, J
which after sorting, and taking the first 3, gives you C, E, G.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment8</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment8</guid><pubDate>Wed, 21 Mar 2012 21:11:33 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Greet,
No, it does no.
we get the N-M from each server, then sort them, and give you the required page size from there.
</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment7</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment7</guid><pubDate>Wed, 21 Mar 2012 19:08:05 GMT</pubDate></item><item><title>morcs commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>@Geert I guess that's the case, except it would be the reduce results that are being returned and thrown away, not whole documents!</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment6</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment6</guid><pubDate>Wed, 21 Mar 2012 16:53:11 GMT</pubDate></item><item><title>Geert Baeyaert commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Ayende, is that also how it works for pages other than the first page?

Let's say we want documents n through m.  Are you saying that you get the first m documents from each server, and then on the client sort and throw away the unnecessary documents?</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment5</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment5</guid><pubDate>Wed, 21 Mar 2012 16:37:39 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Jonty,
Yes, that is what we are doing.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment4</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment4</guid><pubDate>Wed, 21 Mar 2012 11:19:06 GMT</pubDate></item><item><title>Jonty commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>How does that work then? Presumably you'd have to sort on each server, return the number of results from each server equal to the page size and do a further sort on the client.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment3</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment3</guid><pubDate>Wed, 21 Mar 2012 11:14:54 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Jonty,
Paging and sort _is_ supported.</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment2</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment2</guid><pubDate>Wed, 21 Mar 2012 11:11:00 GMT</pubDate></item><item><title>Jonty commented on RavenDB Sharding&amp;ndash;Map/Reduce in a cluster</title><description>Nice. Presumably paging and sorting are not supported?</description><link>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment1</link><guid>http://ayende.com/155361/ravendb-sharding-map-reduce-in-a-cluster#comment1</guid><pubDate>Wed, 21 Mar 2012 11:08:33 GMT</pubDate></item></channel></rss>