+55 21 3828-2384 +55 21 99573-2384 contato@kxc.com.br Careers

Case study

Chatuba Construção

A SQL Server ERP moved from a physical server to Amazon RDS Multi-AZ, with LGPD (Brazil's data privacy law) compliance in place.

99.98%ERP uptime

About the client

Building materials retail chain

Chatuba started in 1962 as a small building materials store in the Baixada Fluminense region of the state of Rio de Janeiro. More than six decades later, the brand has 10 physical stores, with 9 openings after the first, and more than a thousand employees.

In the latest national ranking of building materials retailers in Brazil, Chatuba was named the largest building materials store in Rio de Janeiro. Its portfolio has more than 15,000 items, with solutions for every stage of a construction project, and it serves customers in person and remotely: telesales, specialized support over WhatsApp and e-commerce.

The client's challenge

A leading building materials retail chain in Rio de Janeiro, Chatuba ran an on-premises SQL Server as the foundation of its ERP, which manages inventory, sales, finance and the supply chain across all stores. The legacy infrastructure had these problems:

  • No high availability: SQL Server ran on a physical server. A single failure brought down the ERP at all 10+ stores at once.
  • Slow at peak times: query response times above 200 ms at peak hours, which hurt the point of sale, customers and operators.
  • Fragile backups: backups on local tape, with no restore testing. The actual RPO was estimated at more than 4 hours, and the RTO at 4 to 8 hours.
  • Downtime: about 15 hours of unplanned downtime per month, with an estimated impact of R$ 50,000 (Brazilian reais) or more per incident during high-demand periods, such as home renovation season and Black Friday.
  • No encryption: customer data (such as the CPF, Brazil's individual taxpayer ID) and financial data were not encrypted, which created a risk of noncompliance with the LGPD, Brazil's data protection law.
  • Outdated hardware: equipment more than 6 years old, with no refresh plan and no manufacturer support.

The solution KXC implemented

Phase 1: Assessment and Well-Architected Review

  • A full review of the Microsoft environment with the AWS Well-Architected Review, identifying critical risks in Reliability, Security and Operational Excellence.
  • A 30-day performance baseline (CPU, memory, IOPS, query plans and concurrent users), used to size the RDS instance.
  • A 3-year TCO comparison of on-premises versus AWS, showing 30% savings from eliminating hardware CAPEX and reducing the operational burden.

Phase 2: Migration with AWS DMS

  • The AWS Schema Conversion Tool analyzed 100% of the SQL Server objects and found no incompatibilities. Because the SQL Server engine was kept on RDS, no refactoring was needed.
  • AWS Database Migration Service was configured with Full Load and CDC (Change Data Capture), keeping continuous replication running until cutover.
  • After 7 days of incremental sync, data integrity was validated continuously with row counts and checksums.
  • Cutover took place in a 2-hour overnight window, with the KXC and Chatuba teams together in a war room, and with zero data loss.

Phase 3: AWS infrastructure for SQL Server

  • Database: Amazon RDS for SQL Server Enterprise Edition, a db.r6i.2xlarge instance (8 vCPUs and 64 GB of RAM), running SQL Server 2019 Enterprise. Enterprise Edition was chosen for TDE, compression and advanced high-availability features.
  • Multi-AZ: primary instance in sa-east-1a and a synchronous standby replica in sa-east-1b. Automatic failover takes less than 120 seconds, and the effective RTO is under 5 minutes.
  • Storage: 1 TB of EBS gp3 with 5,000 provisioned IOPS, 40% cheaper than io2 for the IOPS pattern of Chatuba's workload.
  • Application layer: Amazon EC2 with Windows Server 2022 in an Auto Scaling group spread across 2 Availability Zones, behind an Application Load Balancer.
  • Encryption: TDE enabled with an AWS KMS key (CMK), to comply with the LGPD for customer data.

Phase 4: Monitoring and managed operations by KXC

  • Performance: RDS Performance Insights identified 5 stored procedures with full table scans, which were optimized, cutting their execution time by 85%.
  • Monitoring: Amazon CloudWatch with custom SQL Server metrics (deadlocks/sec, batch requests/sec, buffer cache hit ratio and page life expectancy), with alerts integrated into Movidesk.
  • Patching: AWS Systems Manager Patch Manager applies automatic updates to Windows Server and SQL Server in maintenance windows on Sundays at 2 a.m. Brasília time.
  • Backups: AWS Backup with daily RDS snapshots (35-day retention), native .bak files in Amazon S3 and cross-region replication to us-east-1. Restore tests are automated and run every month.
Chatuba Construção architecture diagram, with the official AWS Architecture Icons.
Chatuba Construção architecture diagram, with the official AWS Architecture Icons.

Results

A highly available, secure and scalable environment

The architecture, built on AWS infrastructure, allowed KXC to meet Chatuba's goals as the chain grew. The services' high availability improved results across the whole organization, from senior leadership to salespeople and cashiers.

The project delivered a 60% reduction in infrastructure costs.

Results and key performance indicators (KPIs)

Indicator (KPI) Result Notes
ERP availability (monthly) 99.98% Before, on-premises: 98.5%. Multi-AZ eliminated unplanned downtime.
Average ERP query latency 45 ms Before: 200 ms. A 77% reduction with Performance Insights and index tuning.
RTO (Recovery Time Objective) Under 5 min Automatic Multi-AZ failover. Before: 4 to 8 hours.
RPO (Recovery Point Objective) Under 5 min Transaction log backups every 5 minutes. Before: more than 4 hours (tape).
Unplanned monthly downtime Under 12 min Before: about 15 hours per month. A 98% reduction.
TCO savings (3 years) 30% Compared with the on-premises cost, including hardware, licenses, maintenance and DBA.
Encryption coverage (LGPD) 100% TDE and KMS on RDS, EBS and S3. Before: no encryption at all.
Monthly restore tests 100% passed DBCC CHECKDB with no errors and row counts validated. Average time: 45 minutes.

AWS services used

Migration

  • AWS Database Migration Service
  • AWS Schema Conversion Tool
  • AWS Migration Hub

Database and compute

  • Amazon RDS for SQL Server Enterprise Multi-AZ
  • Amazon EC2 Windows Server 2022
  • Application Load Balancer and Auto Scaling group
  • Amazon S3 (backup storage)

Operations and security

  • Amazon CloudWatch with agent
  • RDS Performance Insights
  • AWS Systems Manager (Patch Manager)
  • AWS Backup (cross-region)
  • AWS KMS (TDE, EBS and S3)
  • AWS CloudTrail and AWS Config
  • Three-tier Amazon VPC

Book a call with one of our specialists

Fill in your details and the service you need. We'll get in touch to find a time that works for you.