India’s Leading Domain & Web Hosting Provider

  • Chat
    Live Chat 24 X 7 online support
  • Contact NTSPL Hosting support
    Call Now +91 - 8260003333
Google CloudUrban mobility and ride-hailingLogistics, Travel & Hospitality

Ride-hailing platform moves trip and payments ledger to Spanner with zero data loss

Ride-hailing and auto-rickshaw aggregator, 22 cities, 1.8 million trips a day · Pan-India · 14 weeks

Amazon Web Services
01

As-is situation

Trips, fares, driver payouts and wallet transactions lived in a sharded MySQL estate of 16 primaries on Compute Engine, split by city. Cross-city riders and drivers broke the sharding model, forcing application-level two-phase commits for wallet transfers. Evening peaks reached 9,500 writes per second and shard primaries in the three largest cities ran above 85% CPU. Resharding to add cities took a six-hour maintenance window. Asynchronous replicas in a second region lagged up to 90 seconds, so the payments team could not guarantee zero loss of settled fares during a regional failure.

  • Application-managed cross-shard transactions causing about 0.04% of wallet transfers to need manual reconciliation
  • Shard primaries above 85% CPU at evening peak in three metros
  • Six-hour maintenance windows for each resharding exercise
  • Up to 90 seconds of replication lag, unacceptable under RBI payment data and settlement expectations
02

Selected Google Cloud services and architecture

NTSPL designed a single Spanner database in dual-region-india1 on Enterprise Plus edition, with the leader in Mumbai and a full replica set in Delhi. Trips use UUIDv4 primary keys with trip events and fare components interleaved beneath them, and wallet ledger entries use a bit-reversed sequence key to avoid hotspots. Cross-city wallet transfers became ordinary read-write transactions. The managed autoscaler scales processing units between 18,000 and 42,000 on CPU utilization. Change streams feed Dataflow into BigQuery for finance reporting, and driver location pings stay in Memorystore rather than the ledger.

Rider and driver apps → GKE trip and wallet services → Spanner dual-region-india1 (Mumbai leader, Delhi replica) → change streams → Dataflow → BigQuery
SpannerSpanner change streamsDataflowBigQueryMemorystore for ValkeyCloud KMS
03

Implementation approach

Weeks 1-4 · Schema and key designRedesigned 41 MySQL tables into a Spanner schema with interleaving and non-sequential keys, and load-tested hotspots with synthetic peak traffic.
Weeks 5-9 · Dual-write and backfillBackfilled two years of trips with Dataflow and ran application dual-writes with nightly reconciliation reports.
Weeks 10-12 · City-by-city read cutoverMoved reads to Spanner for four city groups in sequence while MySQL remained the system of record.
Weeks 13-14 · Write cutover and decommissionSwitched writes to Spanner, kept MySQL read-only for 30 days, then retired the 16 shards.
04

Measured results

Wallet transfers needing manual reconciliation
0.04%→0%
Cross-region recovery point
Up to 90 seconds→Zero (synchronous)
Time to onboard a new city
6-hour resharding window→Configuration change, no downtime
p99 fare-settlement write latency
180 ms→38 ms

Operational improvements

  • No more resharding projects; capacity follows load through the managed autoscaler
  • Finance closes daily settlement from BigQuery without querying production shards
  • Regional failover is handled by Spanner itself instead of a manual MySQL promotion runbook
05

Cost considerations

Enterprise Plus pricing for a dual-region configuration was the main cost driver and was accepted because RPO zero was a business requirement. A three-year committed use discount covers the 18,000 processing-unit floor, with autoscaled capacity above it billed on demand. Driver location data stays in Memorystore to avoid paying Spanner write costs for high-churn, low-value data.

06

Return on investment

ROI indicator

Eliminating reconciliation effort and resharding windows saves an indicative INR 1.2-1.6 crore a year in operations and lost-trip revenue. Spanner costs about 25% more than the self-managed shards on raw infrastructure, but removing three DBA positions' worth of shard maintenance makes the total cost broadly neutral within the first year.

Illustrative scenario: a composite based on typical NTSPL engagement patterns for this industry and service. It does not describe a named customer. The figures are indicative, and actual results depend on the workload, its scale and the commercial terms.