简体   繁体   中英

How to do partitioning in combination with Service Fabric Remoting

Let's say, I'm using Azure Service Fabric Stateful Service, with RemotingV2, and I want to store users phone numbers (That's the only thing my service does).

Task StoreNumber(string username, string phoneNumber);
Task<string> GetNumber(string username);

I want to use the username for partitioning.

What's the elegant way to do that?

can I remove the username parameter from the methods and somehow get it from the request?

Is there a better way?

Thanks

Here's a video that covers this subject and here's a working code sample that goes with it.

  • use a (proper eg FNV) hash algorithm to get the hash of username , use the long result to determine an Int64RangePartition by its key.
  • use a gateway that does the hashing for you (eg api management, or a custom stateless service) and forwards the call
  • you could usecustomer headers to pass the username . (the sample doesn't)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM