Hi Team, I have a SaaS service which will keep dat...
# troubleshooting
g
Hi Team, I have a SaaS service which will keep data globally with data owners across regions. I want to keep their data in respective regions to comply with Data Privacy Laws & Regulations. But I have to run queries globally to do analytics across regions. According to me, there are two ways to do it. 1. Have multi-region Pinot setup with real-time/offline servers localized to specific region. And brokers from across regions will call servers to run queries. 2. Have region wise multiple Pinot setups. Do querying and aggregating result at application level. Any other approach possible ? Which approach looks more feasible and easier to implement ? Thanks !
r
I think you will end up paying for a lot of egress if you do scatter gather queries across regions, so I would lean towards option 2 because it will probably lead to smaller amounts of data crossing regions
k
Will you have any requirements to aggregate across the two regions?
Or will the query have a filter on customerid?
g
We have requirement of aggregation also across regions.
k
how does privacy work in that case?
g
Various compliance forbid to store data in their geographic boundary but not while reading data.
We can do read time aggregation and serve in any other region.
k
got it
I dont know about your setup, but if cost is not a big factor and if your queries are mostly aggregation then 1 is better
2 is a slippery slope and you might have to rewrite the broker code in Pinot
g
@Richard Startin, option 2 will require designing and development at application level. We will not be able to leverage broker for aggregation. Can prestodb be another option ?
@Kishore G agreed.
For option 1, is there any mechanism to do segment assignment based on partition ?
k
yes, you can control the assignment based on partition
g
Any documentation referring how to do it ?
k
prestodb is a good workaround for option 2 but that will still incur the cost assuming prestodb spans across the regions
so, if you are ok with prestodb, then you should be theoretically ok with option 1 as well
@Jackie ^^ where are the docs for partition based assigment
g
For option 1, costing is due to network only or any other factor for costing ?
g
My requirement is to keep a partition and it's replica limited to specific region's servers. I couldn't find how to do it in above documentation.
j
I believe the requirement is to do partition assignment across multiple clusters. That has to be controlled on the client side by pushing different segments to different cluster
Segment assignment can only manage the assignment within a single cluster. I don't know if it is possible to maintain a multi-region cluster, and all of them sharing the same controller
k
@Jackie this is for option 1 - Have multi-region Pinot setup with real-time/offline servers localized to specific region. And brokers from across regions will call servers to run queries.
👍 1
j
Understood, but the segment assignment can only be applied to single cluster. It cannot assign segments across multiple clusters
g
Can we setup single multi-region cluster ?
m
@Jackie I think there's just one Pinot cluster, but servers are located in different regions. Also, the requirement (if I am reading correctly) is that servers on a specific region host specific segments
👍 1
j
The potential problem of having one cross region cluster is the latency between controllers and instances in other region, also the ZK
If the multi-region cluster setup works, then segment assignment can assign segments based on the partition id to different regions
👍 1
m
Yeah, there will be some latency and egress cost. but barring that, if we use partition based segment assignment such that data for a region goes to servers for that region, isn't that what we need here?
g
Yes, that is the requirement.
@Jackie how can we assign segment based on partition id ? Is there any documentation for that ?
j
The segment and instance assignment doc you just posted
You might need to manually set the
InstancePartitions
(mapping from (partition id & replica id) to servers)). Pinot won't know which server is in which region automatically
g
Need little direction here, how to set
InstancePartitions
? Can I set any configuration or need to do something else ?
m
@Jackie ^^
j
Here is the rest api signature:
Copy code
@PUT
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/tables/{tableName}/instancePartitions")
  @Authenticate(AccessType.UPDATE)
  @ApiOperation(value = "Create/update the instance partitions")
  public Map<InstancePartitionsType, InstancePartitions> setInstancePartitions(
      @ApiParam(value = "Name of the table") @PathParam("tableName") String tableName, String instancePartitionsStr)
You may check the
InstancePartitions.java
for details
g
Thanks @Jackie! I will look into this.