OrleansContrib / OrleansCouchbaseProvider

MIT License
6 stars 7 forks source link

Add support for multi-node Couchbase cluster connectivity storage configuration #10

Open marjum opened 7 years ago

marjum commented 7 years ago

The storage provider's configuration currently allows specification of a single Couchbase node URI, like so:

<Provider Type="Orleans.Storage.OrleansCouchBaseStorage" Name="CouchbaseStorage" Server="http://192.168.99.100:8091" UserName="" Password="" BucketName="orleans_storage" />

It does not seem possible however to specify multiple Couchbase cluster nodes into the same configuration. Looking into the code base, the provider's Init method adds the configured Server property as a single entry into the client configuration's Servers list:

var server = config.Properties["Server"]; . . clientConfig.Servers.Add(new Uri(server));

Granted that as long as the specified node is up when the client attempts to connect, it receives server configuration of the cluster's current state, including the current node list. However client connectivity is expected to fail if the configured node were to be down, or if it were to be outside of the cluster at the time.

Perhaps as an alternative, the provider configuration could allow Couchbase client configuration to be specified into app.config, enabling full configuration in addition to the required nodes list. (e.g, bucket options, connection pooling)

MikeGoldsmith commented 7 years ago

Hi @marjum - Yeah, this is something I have intended to look at.

I think adding both support for a complete Couchbase config section and be able to split the server parameter would offer the most versatility.

ashkan-saeedi-mazdeh commented 7 years ago

@MikeGoldsmith Speaking of configuration, another desired config not related to this is the ability to store some state as binary data instead of JSON. Actually this is one nice advantage of Couchbase over many other NoSQL databases so please keep an eye on that too if you think it can be interesting.

The StorageProvider attribute has a property which indicates if the serialization should be to JSON or not and Orleans has a binary serializer SerializationManager which can serialize data to binary in a none-backward compatible manner. That is one option and there are many others as well.

All these said I'm currently not using the provider but I had a plan to support this since it was useful for me back then at least.

MikeGoldsmith commented 7 years ago

@ashkan-saeedi-mazdeh The SDK client supports binary storage by either:

  1. use a custom serializer that just converts to byte arrays
  2. convert the value to byte array in app code so the data type is binary[]

I think option 1 would be best as it offers the most options going forward. I've created issue #11 to add binary storage support.

ashkan-saeedi-mazdeh commented 7 years ago

@MikeGoldsmith Great! Yes I knew the SDK supports it so it just needs to be added to the provider. I'm closing this.

MikeGoldsmith commented 7 years ago

@ashkan-saeedi-mazdeh please can you re-open this issue so we can track full Couchbase config integration?

ashkan-saeedi-mazdeh commented 7 years ago

@MikeGoldsmith sorry for my confusion. Yup

MikeGoldsmith commented 7 years ago

@ashkan-saeedi-mazdeh Thanks 👍