We’ve reduced post-trade processing times from between 6 and 10 hours to 2 or 3 minutes with AWS Lambda.
Kailash Nadh Chief Technology Officer, Zerodha

Indian fintech company Zerodha offers online trading services in stock, commodities, mutual funds, bonds, and currency. Launched in 2010, the company has more than 1 million clients placing millions of trades each day. Zerodha was one of the first discount brokerages in India. It charges 20 rupees (US$0.29) per trade or 0.01% of the trade’s value, whichever is lower, and does not take brokering fees. In 2018, the company became the largest retail stock brokerage in India, according to the National Stock Exchange of India.

While Zerodha handles 2 to 3 million trades a day on average, this figure can easily double on the back of breaking financial news. Because Zerodha leased on-premises servers at a hosted data center, the company experienced issues scaling its architecture to meet trading highs and lows, and, as a result, it had to overprovision its IT. Kailash Nadh, chief technology officer at Zerodha, says, “Most of our capacity could go unused for days or weeks during non-peak periods. It was like a very expensive insurance policy.”

When Zerodha learned that AWS was expanding its Asia-Pacific Region to Mumbai, it gave the company the opportunity to use the AWS Cloud. In 2016, Zerodha moved its IT infrastructure from on-premises to the Amazon Web Services (AWS) Cloud to scale to its fluctuating trading volumes and comply with India financial regulations that limit data sharing across geographic locations. At this point, Zerodha was using Amazon Simple Storage Service (Amazon S3) to store large documents. Says Nadh, “We were very satisfied with Amazon S3, which was eight times more cost-effective than our on-premises storage. Furthermore, the relationship we had built with AWS around Amazon S3 gave us a lot of confidence to carry out a full migration.”

Zerodha managed its migration internally—building applications for its website, mobile app, and backend processing by using a modular design. This modularity was also what made it easier to migrate to the AWS Cloud. “Because our software is stateless [where data travels independently of other data], it was easy to run on an internet-based cloud environment,” says Nadh. In total, Zerodha migrated all its IT onto the AWS Cloud except for a few on-premises servers used for live feeds from India’s stock exchanges. “If the Indian regulations had allowed us to, we would have migrated those servers too,” adds Nadh.

Apart from Zerodha’s website and mobile app, the company’s business-critical trading and post-trading platforms are also running on the AWS Cloud. Amazon Elastic Compute Cloud Auto Scaling (Amazon EC2 Auto Scaling) dynamically scales up and down the number of Amazon Elastic Compute Cloud (Amazon EC2) instances supporting the platforms, based on parameters such as central processing unit (CPU) utilization.

Approximately 500,000 customers log on to Zerodha concurrently when the Indian Stock Exchange opens in the morning. Currently, Amazon EC2 Auto Scaling ramps up the number of Amazon EC2 instances supporting the trading platform during this period. The number of supporting instances is automatically scaled back down when trading traffic decreases.

Once the stock exchange closes, Zerodha runs all accounting and settlement processes on its post-trading platform. This involves checking and updating files for about 500,000 customers overnight. “The work requires processing more than 10 billion data points and presenting the information back to customers, as well as financial authorities, in specific formats,” says Nadh. “At the same time, we’re updating analytical reports for our customers, which show their trading performance over weeks, months, and years. That requires recomputing their historical data with that day’s results.”

Before using AWS, Zerodha used a proprietary system designed for post-trade processing. The system, which processed data sequentially, took around 10 hours to complete the job. This is now done using AWS Lambda, which lets Zerodha run its software without provisioning or managing servers and completes processing tasks in parallel. “We’ve reduced post-trade processing times from between 6 and10 hours to 2 or 3 minutes with AWS Lambda,” says Nadh.

The company has reduced the costs of its IT by 50 percent by migrating to AWS. It no longer has to overprovision because it can align processing power with trading activity. Zerodha has also cut the time and expense of managing its IT because much of the AWS infrastructure comes as a managed service. The administration required is done much faster. Says Nadh, “It could take two days to install a firewall at the on-premises site, but now it takes 2 minutes with AWS.”

Zerodha is now able to deliver a better level of service to its customers. The company has reduced network latency by 65 percent—from 200 milliseconds to 70 milliseconds. Furthermore, it has increased the availability of its services, reducing the risk of interruptions to trading while the stock exchange is open. Comments Nadh, “We can provide faster and more resilient services to our customers, helping us retain our leading position in the market.”