akrsmv
akrsmv

Reputation: 830

Service Fabric - (reaching MaxReplicationMessageSize) Huge amount of data in a reliable dictionary

EDIT question summary:

and the summary of my few questions from below: how can one achieve storing large amount of data into a reliable dictionary?

TL DR;

Apparently, I am missing something...

System.Fabric.FabricReplicationOperationTooLargeException: The replication operation is larger than the configured limit - MaxReplicationMessageSize ---> System.Runtime.InteropServices.COMException

Questions:

For any help on this - thanks a lot!

Upvotes: 3

Views: 1353

Answers (1)

Eli Arbel
Eli Arbel

Reputation: 22749

The issue is that you're trying to add a large amount of data into a single dictionary record. When Service Fabric tries to replicate that data to other replicas of the service, it encounters a quota of the replicator, MaxReplicationMessageSize, which indeed defaults to 50MB (documented here).

You can increase the quota by specifying a ReliableStateManagerConfiguration:

internal sealed class Stateful1 : StatefulService
{
    public Stateful1(StatefulServiceContext context)
        : base(context, new ReliableStateManager(context,
            new ReliableStateManagerConfiguration(new ReliableStateManagerReplicatorSettings
            {
                MaxReplicationMessageSize = 1024 * 1024 * 200
            }))) { }
}

But I strongly suggest you change the way you store your data. The current method won't scale very well and isn't the way Reliable Collections were meant to be used.

Instead, you should store each HospitalData in a separate dictionary item. Then you can query the items in the dictionary (see this answer for details on how to use LINQ). You will not need to change the above quota.

PS - You don't necessarily have to use partitioning for 500MB of data. But regarding your question - you could use partitions even if you can't derive the key from the query, simply by querying all partitions and then combining the data.

Upvotes: 4

Related Questions