Skip to content

Trade-offs · Senior and Staff

Data residency vs latency vs one global store

Which to choose when users are in several countries: one global store, a store in each region, or a split by data type, with cost and law worked out.

Asked at: SeniorStaff

The decision

Data residency means that some data must be stored, or sometimes also processed, inside a country or region. A law, a regulator or a customer contract can ask for it. You have three ways to build. A global store is one primary database in one region, with copies elsewhere for safety. A regional store keeps each region's users in a database in that region. A split keeps only the regulated data (personal and payment data) in the region, and puts the rest in the global store. The forces are legal risk, speed for the user, and the cost of running more than one stack. None of them wins every time.

Choose one global store when

  • No law or contract forces the data to stay. Many laws allow a transfer if a rule is followed (see Sources).
  • Most users are within about 100 ms of one region, or the product is not chatty. The 100 ms is our rough limit (Assumption).
  • The team is small and cannot yet run several stacks with on-call cover.
  • You have no signed customer who needs a local copy.

Choose a regional store per country or region when

  • A law or a contract says the data stays in the region. Example: the Reserve Bank of India direction that payment system providers store payment system data only in India (see Sources).
  • Users far from the store make many calls in a row, so the delay adds up.
  • You sell to large customers who ask for residency in every deal.

Choose a split by data type when

  • Only a small part of your data is regulated, such as identity, payment and health fields.
  • The rest is large and shared, such as a catalogue, search or analytics.
  • You can put a stable key in the global store and keep the person's details behind it, in the region.

The numbers that change the answer

Latency (calculation). Assumption: a signal travels in fibre at 200,000 km a second, and the route from Mumbai to a store in Frankfurt is 7,000 km. The best possible round trip is 2 x 7,000 / 200,000 = 0.07 seconds = 70 ms. Assumption: real networks add delay, so the round trip is 120 ms. A page that makes 5 database calls in a row waits 5 x 120 = 600 ms with a far store. With a store in the same city (Assumption: 2 ms) it waits 5 x 2 = 10 ms.

Cost of three regional stacks (assumptions plus calculation).

  • One stack with a standby copy costs Rs 900,000 a month (Assumption).
  • Three regional stacks: 3 x 900,000 = Rs 2,700,000. The extra is 1,800,000 a month, or Rs 21,600,000 a year.
  • Two more engineers to build and operate it: 2 x Rs 3,000,000 = Rs 6,000,000 a year (Assumption).
  • Total extra: 21,600,000 + 6,000,000 = Rs 27,600,000 a year, which is Rs 2.76 crore.

What it earns (assumptions plus calculation).

  • The EU brings Rs 3 crore (30,000,000) of revenue a month. Assumption: the slow far store loses 2% of it. Loss = 30,000,000 x 0.02 x 12 = Rs 7,200,000 a year (Rs 72 lakh).
  • Latency alone does not pay for the regional stacks. The gap is 27,600,000 - 7,200,000 = Rs 20,400,000.
  • Assumption: a blocked enterprise deal is worth Rs 25 lakh (2,500,000) a year. Break-even is 20,400,000 / 2,500,000 = 8.2 deals.

Read it this way: go regional when you have lost, or will lose, about 8 deals a year to residency. Below that number, the global store wins on money. The 8.2 is our own calculation from our own assumptions, so replace the inputs with yours.

Cited facts about the law.

  • The Digital Personal Data Protection Act 2023, section 16, lets the Central Government restrict, by notification, transfers to a country or territory outside India. It also says a stricter Indian law on transfers is not affected. Section 1(2) says different provisions can start on different dates, so check the current status of each provision.
  • The Reserve Bank of India direction of 6 April 2018 says system providers must store the entire data of their payment systems only in India. For the foreign leg of a transaction, the data can also be stored abroad.
  • The European Commission lists the countries with an adequacy decision, and India is not on the list. Without a decision, the European Data Protection Board lists safeguards such as standard contractual clauses and binding corporate rules.

This page is not legal advice. Confirm the rules for your case with a lawyer before you build.

What breaks with each choice

One global store.

  • A law or a contract changes, and you must move data under pressure. Fallback: keep a home_region field on every tenant from day one.
  • Far users see slow pages. Fallback: cache read-only data near them and reduce sequential calls.
  • A region fails and all users suffer. Fallback: a standby copy in a second region.

Regional stores.

  • A global feature, such as search across all users, now crosses regions. Fallback: send only non-personal summaries to the global side.
  • Users who travel or move need their data moved. Fallback: a documented move process, tested each quarter.
  • Cost is 3 times the base (Rs 2,700,000 against 900,000 a month in the example), even where a region has few users.

Split.

  • The line between regulated and other data moves over time. A new field such as a phone number can quietly become personal data. Fallback: a data catalogue with an owner, and a review for each new field.
  • Joins across the two sides are now remote calls. Fallback: carry a copy of the few needed fields as a token.

What it costs

  • Money and people: about Rs 2.76 crore a year for three regions in the example, against zero for the global store.
  • Reversible-first path. Start with one global store. In the first sprint, add a home_region field to every tenant, keep personal data in its own tables, and keep encryption keys per region. This costs a few engineer-weeks (Assumption) and keeps every door open. Move to a split when the first regulated customer signs. Move to full regional stacks when blocked deals pass about 8 a year. Move also if the far-store delay costs more than the stacks (the 600 ms page above).
  • Changing your mind later: global to regional is a data move with dual writes and a verified cutover. Assumption: it takes months. Regional back to global is easier technically, but you may break the promise you made to customers.

How each level answers

The question is: "Users in India and the EU. Where does the data live?"

SDE-1: Data residency means the data stays in one country. A store far from users is slower.

SDE-2: I put a database in each region, and I route users by their region. It follows the law and is faster for users, but it costs more.

Senior: First I ask what is regulated. A far store gives 120 ms per call, so a page with 5 calls takes 600 ms. Regional stacks cost about Rs 2.76 crore more a year, so I use a split: personal data local, the rest global. The fallback for a changed law is a home_region field on every tenant.

Staff: I treat residency as a sales and risk question first. I ask legal what is required, and sales how many deals residency has blocked. In the example the break-even is about 8 deals a year. I ship the global store with region tags now, then go regional by customer group. I own the cost case, the data catalogue and the audit. I measure blocked deals, 99th percentile latency by region, and time to onboard a region. I revisit it when a law, a large customer or the deal count changes.

Say it in the interview

I would start with one primary region. I would tag every tenant with a home region and keep personal data in separate tables, so I can split later. I would go regional when blocked deals or law justify about Rs 2.76 crore a year of extra cost. Latency alone loses only about Rs 72 lakh. The risk is a rule that changes late, and the tags are my fallback.

Common mistakes

  • Saying "the law needs everything in the country". Rules differ. Some restrict only some data, and some allow transfers with a safeguard. Ask which data and which rule.
  • Ignoring latency numbers. "It is a bit slower" hides that five calls in a row cost 600 ms.
  • Copying personal data into logs, backups and analytics outside the region. The main database is local, but the copies leak the data.

Sources

Understand the trade-off. Practise explaining your choice.

In an AI mock interview, the interviewer can push on a choice like this one: it changes a number and asks if your answer still holds.