Khatabook serves 10 million monthly active users with a low-latency ledger app on AWS

Security has been an ongoing focus for Khatabook as the business scales and modernizes its operations. Khatabook has recently integrated a range of AWS security services such as Amazon GuardDuty and AWS Web Application Firewall (AWS WAF) to increase its resilience against cyberthreats.
Khatabook-Serves-10-Million-Monthly-Active-Users-with-Low-Latency-Ledger-App-on-AWS

India is a country of small businesses. As of late 2020, 99 percent of businesses in India were classified as micro, small, and medium enterprises (MSMEs). Indian MSMEs are increasingly managing their day-to-day finances through intuitive mobile apps designed to suit their operational requirements. Khatabook, which means “credit ledger” in Hindi, is a leading digital ledger application in India with more than 10 million monthly active users.

Khatabook was launched to address challenges that MSMEs face such as manual data entry and resulting calculation errors, lack of real-time visibility into business transactions, and data loss due to the physical handling of accounting books. Khatabook generates reports, sends reminders to creditors, and facilitates online payments through the Unified Payments Interface (UPI) and QR systems.

Simplicity, language inclusion, and a scalable tech platform have been vital to Khatabook’s success. The user-friendly Khatabook app is available in 13 Indian languages to promote digital adoption across all districts in India. From 2019 to 2021, the business nearly doubled its number of new registrations.

Leveraging Native Data Management Tools

Khatabook chose to run its app on Amazon Web Services (AWS) because of the range of services available, particularly native database engines. Most of its team members were familiar with AWS, which helped them accelerate time to market with little to no learning curve. 

The business uses Amazon Relational Database Service (Amazon RDS) for PostgreSQL to manage its primary relational databases and Amazon DocumentDB for MongoDB workloads. Rajeev Sharma, director of engineering at Khatabook, says, “Because AWS offers a wide range of native tools to manage containers, databases, queueing, and more, we didn’t have to seek external solutions outside of AWS.” Khatabook also takes advantage of Amazon Pinpoint to send reminders and notifications to users via SMS, including completion notifications for end-of-day reports. 

During peak times, typically in the evenings after 7:00, the Khatabook app handles up to 350,000 requests per minute. A few years into operations, the company’s engineers found they were often overprovisioning compute instances to avoid downtime. This practice was inefficient, and peak workloads remained highly unpredictable. “There were several cases when our application went down because we couldn’t predict the load. Developers were on their toes all the time in case something went wrong,” Sharma relates.

Because AWS offers a wide range of native tools to manage containers, databases, queueing, and more, we didn’t have to seek external solutions outside of AWS.”

Rajeev Sharma
Director of Engineering, Khatabook

Automated Scaling with Higher Resource Utilization

In 2020, Khatabook began modernizing its application stack by implementing containers with Kubernetes. Now, workloads are split between container-based applications—which engineers manage using Amazon Elastic Kubernetes Service (Amazon EKS)—and applications running on virtual machines using Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling. In both cases, scaling is automated with provisioning on demand. 

“The number of downtime-related occurrences has gone down significantly, resource utilization has improved, and we’re able to accurately scale our instances whether in Kubernetes, Amazon EC2, or Amazon RDS,” Sharma says. After moving most of its workloads to containers, Khatabook’s overall resource utilization rate increased to 60–70 percent from 20–30 percent. “We can decide how much infrastructure should be used and what the utilization numbers should be to optimize our costs,” adds Sharma.

Removing Manual Deployments Drives Productivity and Reliability

During the transition to containers and throughout its journey as a growing startup, Khatabook has relied on AWS Premium Support. Removing all manual deployments with the help of AWS solutions architects has since increased the Khatabook app’s reliability and developer productivity. Infrastructure tasks are now fully managed by DevOps engineers, which has freed up developers to work on customer-facing applications and core frameworks at Khatabook.

Reducing Latency from 200 to 100 Milliseconds

Higher reliability and fast performance are especially important for the Khatabook app. One of the app’s differentiators is that most of its ledger functions are available offline, with local data storage on users’ devices. This feature helps small businesses in remote areas without reliable network access. 

Whenever users are connected to the internet, data syncs take place regularly to ensure each merchant’s transactions are updated across devices and the Khatabook network. “There are a lot of API calls happening daily, even hourly, to sync merchant records. If the app is slow or unreliable, there’s a chance we could lose valuable financial data,” explains Sharma. After shifting to containerized workloads, Khatabook API response times dropped from about 200 milliseconds to 100 milliseconds or less.

Ensuring Best-Practice Security Standards

Security has been an ongoing focus for Khatabook as the business scales and modernizes its operations. Khatabook has recently integrated a range of AWS security services such as Amazon GuardDuty and AWS Web Application Firewall (AWS WAF) to increase its resilience against cyberthreats. In addition, monitoring services such as Amazon CloudWatch provide DevOps engineers with application insights to detect and mitigate anomalies, either from potential threat vectors or due to operational issues. 

As a fintech, Khatabook follows international best practice guidelines and is currently seeking ISO 20000 and ISO 27001 certifications. “We didn’t have to worry about a lot of the infrastructure requirements on the ISO checklists because we are on AWS. The AWS team and available online artifacts helped us validate certain security parameters immediately,” Sharma says. 

Next on its roadmap, Khatabook plans to pursue more security and compliance certifications and drive further automation and deployment templates. It is also considering new security tools and a robust backup plan on AWS.