India’s Leading Domain & Web Hosting Provider

  • Chat
    Live Chat 24 X 7 online support
  • Contact NTSPL Hosting support
    Call Now +91 - 8260003333
Microsoft AzureApparel retailRetail, E-commerce & Consumer

Apparel retailer serves 6 million loyalty members from Cosmos DB at 8 ms p99 reads

Fashion and apparel chain, 280 stores, app and web storefront, 6 million loyalty members · Pan-India · 10 weeks

Amazon Web Services
01

As-is situation

The loyalty program ran on a MySQL database behind the POS and mobile app, storing member profiles, points ledger and tier rules in rigid tables. Each new campaign type, such as birthday multipliers or partner vouchers, needed a schema change and a two-week release. During end-of-season sales, POS terminals waited 2-4 seconds for points balance, and at peak the database hit 100 percent CPU, forcing stores to issue paper vouchers. Marketing could not run real-time offers because the app read balances from a nightly batch extract, and the CRM team exported member data to spreadsheets to build segments.

  • POS points-balance lookup of 2-4 seconds during end-of-season sales
  • Schema change and two-week release for every new campaign type
  • App showing balances from a nightly extract, up to 24 hours stale
  • Database CPU at 100 percent during sale peaks, forcing paper voucher fallback
02

Selected Microsoft Azure services and architecture

NTSPL modelled the loyalty domain in Cosmos DB for NoSQL in Central India with a members container partitioned by memberId and a transactions container with a hierarchical key of memberId and yearMonth, keeping each logical partition well under 20 GB. Campaign rules are stored as versioned JSON documents, so new campaign types need no schema change. Autoscale is set to a 40,000 RU/s maximum on transactions, dropping to 4,000 overnight. The change feed triggers Azure Functions that recompute tier status and push offers to the app within seconds. South India is a read region with service-managed failover; session consistency keeps each member's view correct.

POS and mobile app → API Management → Cosmos DB for NoSQL (Central India, autoscale) → change feed → Azure Functions → offer push to app; South India read region
Azure Cosmos DB for NoSQLCosmos DB change feedHierarchical partition keysAzure FunctionsAzure API ManagementAzure Monitor
03

Implementation approach

Weeks 1-2 · Access pattern modellingCatalogued POS, app and campaign queries and chose partition keys so 95 percent of reads are point reads.
Weeks 3-6 · Build and load testBuilt containers, indexing policy and change feed functions, then replayed the previous sale's peak at 2x volume.
Weeks 7-9 · Dual write and backfillBackfilled 6 million members and 3 years of ledger while POS dual-wrote to MySQL and Cosmos DB.
Week 10 · Switch readsSwitched POS and app reads to Cosmos DB store by store over five days, then retired MySQL writes.
04

Measured results

POS points-balance p99 read latency
2-4 s→8 ms
Time to launch a new campaign type
About 2 weeks→1-2 days
Balance freshness in app
Up to 24 hours→Under 5 s
Paper voucher fallbacks in sale season
About 1,200 stores-hours→0

Operational improvements

  • Marketing ships new campaign rules as JSON documents without a database release
  • Sale-day capacity is handled by autoscale with no pre-scaling ticket
  • Store teams no longer run a paper voucher fallback procedure
05

Cost considerations

RU consumption drove cost, so the indexing policy excludes free-text and image fields and most reads are point reads at about 1 RU. Autoscale was chosen over provisioned throughput because traffic swings 8-10x between night and sale afternoons. Multi-region writes were rejected as unnecessary; a South India read region gives DR at lower cost.

06

Return on investment

ROI indicator

Real-time offers lifted loyalty-linked repeat purchases by an estimated 4-7 percent in the first sale season, worth an indicative INR 2-3.5 crore in incremental gross margin. Cosmos DB running cost of about INR 3-4 lakh a month is offset several times over, and campaign launches no longer queue behind database releases.

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.