orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Is there any sample for the 2.0 configuraton?

Open ForkBug opened this issue 8 years ago • 13 comments

There is no sample, no document about common orleans 2.0 configuration usage. UseLocalhostClustering in http://dotnet.github.io/orleans/Documentation/2.0/Configuration2.0.html is not enough

ForkBug avatar Mar 18 '18 02:03 ForkBug

I'm interested in seeing the documentation improved as well, so to start the conversation: @ForkBug are there any specific items do you think that needs to be mentioned?

Looking at orleans/Samples/2.0/ directory, it seems there are a bunch of sample projects with example configurations. Maybe it makes sense to keep the Configuration2.0.html at a higher level but include a link to a page that details the various options that can be configured one by one? (in the style of MS Docs or Python API)

mehmetakbulut avatar Mar 23 '18 22:03 mehmetakbulut

We started updated the docs for 2.0, and you should see more progress next week.

Contributions are more than welcome!

sergeybykov avatar Mar 23 '18 23:03 sergeybykov

For the early adoption of 2.0, according to the most common and simplified orleans user case: a simple cluster deployed on 2 boxes, with azure clustering. How to do configuration in the silo and client part? we already configured it out by digging into the UT source code. But if there is a detailed guide, it may be helpful for most users.

And IMHO, UseLocalhostClustering may be useless for the real world orleans applications. So only UseLocalhostClustering in the doc/example is not enough

ForkBug avatar Mar 24 '18 05:03 ForkBug

It seems someone encounters the same problem. You may use our code before 2.0 doc update: silo:

        var sb =  new SiloHostBuilder()
            .Configure<ClusterOptions>(
                op => { op.ClusterId = ; })
            .UseAzureStorageClustering(op => { op.ConnectionString = ; })
            .UseAzureTableReminderService(op => { op.ConnectionString = ;})
            .Configure<AzureTableReminderStorageOptions>(op =>
                {
                    op.ConnectionString = 
                })
            .Configure<EndpointOptions>(op =>
            {
                op.GatewayPort = ;
                op.SiloPort = ;
                op.AdvertisedIPAddress = ;
            })
            .ConfigureLogging(logging =>
            {
                logging.AddFile("Logs/OrleansSilos-{Date}.txt");
                if (!IsService)
                {
                    logging.AddConsole();
                }
            })
            .Configure<StatisticsOptions>(op =>
            {
                op.CollectionLevel = StatisticsLevel.Info;
                op.LogWriteInterval=TimeSpan.FromSeconds(300);
                op.PerfCountersWriteInterval = TimeSpan.FromSeconds(30);
            })
            .AddSimpleMessageStreamProvider()
            .AddAzureTableGrainStorage("PubSubStore", builder => builder.Configure<IOptions<ClusterOptions>>((options, silo) =>
            {
                options.DeleteStateOnClear = true;
                options.ConnectionString = ;
            }))
            .ConfigureApplicationParts(parts =>
            {
                parts.AddApplicationPart(typeof().Assembly).WithReferences();
                parts.AddApplicationPart(typeof().Assembly).WithReferences();
            });
            return sb.Build();

ForkBug avatar Mar 24 '18 05:03 ForkBug

Client:

client = new ClientBuilder() .Configure<ClusterOptions>( op => { op.ClusterId = ; }) .UseAzureStorageClustering(op => { op.ConnectionString = ; }) .Configure<EndpointOptions>(options => { options.AdvertisedIPAddress = ; options.GatewayPort = ; }) .ConfigureApplicationParts(parts => { parts.AddApplicationPart(typeof().Assembly).WithReferences(); parts.AddApplicationPart(typeof().Assembly).WithReferences(); parts.AddFromApplicationBaseDirectory(); } ) .ConfigureLogging(logging=> logging.AddFile("OrleansClients.txt")) .Build();

ForkBug avatar Mar 24 '18 05:03 ForkBug

It's the code for our testing environment. Therefore there may be mistakes. Please refer to updated 2.0 doc some days later

ForkBug avatar Mar 24 '18 05:03 ForkBug

@ForkBug , @sergeybykov Can any help me, what should i use instead ClusterConfiguration in 2.0.0-rc2 release?

rdcm avatar Mar 26 '18 10:03 rdcm

@rdcm Try the following instead of ClusterConfiguration:

var builder = new SiloHostBuilder()
                .UseLocalhostClustering()
                .Configure<EndpointOptions>(options => options.AdvertisedIPAddress = IPAddress.Loopback)
                .ConfigureLogging(logging => logging.AddConsole());

var host = builder.Build();
await host.StartAsync();
return host;

mehmetakbulut avatar Mar 26 '18 14:03 mehmetakbulut

@rdcm my example code is a simple configuration for azure table based cluster

ForkBug avatar Mar 27 '18 12:03 ForkBug

More specific example from old xml config:

    <LogConsistencyProviders>
      <Provider Type="Orleans.EventSourcing.CustomStorage.LogConsistencyProvider" Name="CustomStorage" />
    </LogConsistencyProviders>

In master branch at now exist CustomStorageSiloBuilderExtensions class with methods AddCustomStorageBasedLogConsistencyProviderAsDefault and AddCustomStorageBasedLogConsistencyProvider but not included in 2.0.0-rc2. How can i rewrite this xml section with new fluent api?

rdcm avatar Mar 27 '18 13:03 rdcm

unfortunately LogConsistencyProvider wasn't migrated completely to use the new ISiloHostBuilder pattern in rc. So to configure it in rc, you need to use the legacy ClusterConfiguration, and then feed the ClusterConfiigurator to ISiloHostBuilder.UseConfiguration(this ISiloHostBuilder builder, ClusterConfiguration configuration)

xiazen avatar Mar 27 '18 17:03 xiazen

We updated our docs to 2.0 last week: http://dotnet.github.io/orleans/Documentation/Introduction.html Currently on the top nav bar, we have the 2.0 Documentation button which would take you to 2.0 docs, we also have the 1.5 Documentation section, which would take you to the pre 2.0 APIs. 2.0 doc section share similar structure and hierarchy with 1.5 docs, but the content was all updated to 2.0. Welcome to check it out.

We also have a doctalking about how to configure a cluster using azure clustering in 2.0. Since you mentioned interested in that before, so I figured I should point this out specifically.

xiazen avatar Apr 02 '18 19:04 xiazen

Close this issue now since I think we had questions answered and demand met in this issue. But do feel free to reopen this if I missed anything.

xiazen avatar Apr 02 '18 19:04 xiazen