Azure Service Fabric Multi-Tenancy -
i'm trying little follow question that's been answered...
if setup tenants azure service fabric stateless services (they'll state out-of-band), how can put more 1 tenant on each node in cluster? in testing, seems service fabric gags if try , make instance count greater node count.
these tenants lightweight, should able run dozens of them on each node (we have hundreds overall), , don't want have node each one. specifically, tenants more-or-less opening long-polling http connection external customer service , streaming data our system - there's no public endpoints in play here. need ability spin lot of these workers that'll each open own long-polling connection.
can point me in right direction?
fyi, i've explained little bit more here... https://social.msdn.microsoft.com/forums/en-us/efd172e2-0783-489b-b3ab-ec62fb7b8ee4/multiple-instances-per-node?forum=azureservicefabric
thanks in advance!
you'll need somehow partition service.
there several options, 2 aligns here (and question linked are):
have sf application each tenant gets instance of service. need have shared service in front route requests correct service. should this.
myawesomeapp sharedstatelessapi <- external api points here mytenantservice_tenant1 <- servicetype: mytenantservice mytenantservice_tenant2 <- servicetype: mytenantservice ... the other solution have 1 (or more) service fabric application per tenant, , along lines of:
mysharedapp sharedstatelessapi <- external api points here tenant1 <- applicationtype: mytenantapp mytenantservice <- servicetype: mytenantservice tenant2 <- applicationtype: mytenantapp mytenantservice <- servicetype: mytenantservice it's same concept first example, partition done on higher lever.
personally, prefer second case. feels more right. in both cases, you'll have either create services/application manually when new customer signs up, or in code. if want in code, should @ fabricclient. if need example of that, let me know.
also, can see, should have shared public endpoint, , in endpoint route request correct service based on (header, auth token, uri, whatever inline app).
example of using fabricclient create service:
first need fabricclient. unsecured cluster (your local dev cluster), following enough:
var fabricclient = new fabricclient("localhost:19000"); when have deployed secured cluster (for example in azure), need authenticate fabricclient, so:
var creds = new x509credentials { findtype = x509findtype.findbythumbprint, findvalue = clientcertthumbprint, remotecertthumbprints = {clientcertthumbprint}, storelocation = storelocation.localmachine, storename = "my" }; var clusterendpoint = "clustername.location.cloudapp.azure.com:19000" // or whatever cluster endpoint var fabricclient = new fabricclient(creds, clusterendpoint); then, when have fabricclient, can create stateless service this:
var statelessdescriptor = new statelessservicedescription { applicationname = new uri("fabric:/myapp"), instancecount = 1, // how many instances. partitionschemedescription = new singletonpartitionschemedescription(), servicename = new uri("fabric:/myapp/tenanta"), servicetypename = "yourservicetypename", initializationdata = data_to_pass_to_service_byte[] // if needed. }; await _client.servicemanager.createserviceasync(statelessdescriptor) if passed data in "initializationdata" prop, available in service serviceinitializationparameters.initializationdata
Comments
Post a Comment