How Zomato Brews Espresso with Go and Chromium
Zomato is slowly turning into a tech company and is not just remaining as another food delivery app. From changing its name to Eternal and releasing its AI-first Nugget platform, the company is increasingly vocal about its tech stack and changing the game in the industry. Last month, the engineering team released Espresso, an open-source, high-performance PDF generation tool purpose-built to handle increasing demands, which include order receipts and invoices to operational reports at scale. “In pursuit of a more tailored and efficient approach, we decided to develop our in-house PDF generation solution,” the company said in its official blog. Espresso is also available on GitHub under the MIT license. To make Espresso usable by everyone, Zomato built a lightweight front-end tool. This interface allows internal teams to modify or create PDF templates with real-time visual feedback, accelerating iteration and reducing developer dependency. Source: Zomato Blog Go, Headless Chromium, and HTML Templates To meet the goals, the team leaned into technologies they knew would scale. Go was selected for its concurrency-friendly nature and raw performance, and it paired well with Rod, a Go library designed to interface with headless Chromium browsers. This gave Zomato full control over HTML-to-PDF rendering, along with the flexibility to manage layout and styling directly from HTML templates. For digital signing, the team integrated the digitorus/pdf library, enabling cryptographic signing natively in Go. To show that security wasn’t an afterthought, Zomato implemented digital certificate signing using custom certificates, ensuring every document’s integrity and authenticity. Especially for PDFs carrying sensitive data, this layer of trust was vital. Espresso went blazing fast. Several engineering decisions helped achieve this. One of them was going with pre-paint rendering where PDFs are generated before Chromium completes its paint step, shaving off critical milliseconds. Performance was further optimised by tweaking Chromium’s startup behavior. Also, images from HTML templates were preloaded and encoded as dataURIs, skipping unnecessary browser fetches during rendering. By combining rendering and signing in a single Go application, Espresso avoids writing temporary files, reducing disk I/O and speeding up the process. What do the benchmarks say? Espresso renders and digitally signs each PDF in under 200 milliseconds, making it highly responsive even under heavy loads. Designed with concurrency at its core, Espresso can also handle peak loads of up to 120,000 requests per minute without flinching. This capability has made it the go-to solution for Zomato’s high-volume operations, where real-time performance is critical. For Zomato, from order receipts and invoices to operational reports, PDFs power many of the company’s daily interactions and backend systems. However, as the business scaled, their aging PDF pipeline, built on a PHP-based library, started to buckle under pressure. Complex, multi-page documents with heavy graphical elements triggered latency issues, especially during traffic spikes. Zomato’s original PHP-based PDF tool was functional but increasingly sluggish. In one of the most demanding use cases, Espresso processed and signed 1.6 million PDFs in just 19 minutes—averaging around 1,400 PDFs per second. This was achieved by scaling the service to 100 containers running on AWS ECS, with each container configured with four vCPUs and 4 GB of memory. Most notably, the new system dramatically reduced infrastructure requirements. Compared to the legacy setup, Espresso cut server costs by 90%, while simultaneously improving output quality and reliability. As usage intensified and documents became more complex, the need for a robust, low-latency solution became impossible to ignore. The engineering team set out with a clear mandate: build something that could generate and sign PDFs faster, more reliably, and with minimal infrastructure overhead. And they did it. Zomato is Finally Becoming an AI Company But not just PDF creators. Zomato, or Eternal, has embraced AI increasingly over the past few months. In February, Zomato CEO Deepinder Goyal announced the launch of Nugget, an AI-native, no-code customer support platform designed to help businesses scale their support operations efficiently. Developed over three years as an internal tool, Nugget handles over 15 million monthly support interactions for Zomato, Blinkit, and Hyperpure. The platform, now open to businesses worldwide, boasts a 90% adoption rate among companies that have tested it. All this follows Goyal’s earlier reluctance towards generative AI. In August 2024, the company announced a ban on AI-generated images of restaurant menus to build consumer trust in the platform. This initiative received a positive response from consumers online. On the other hand, Zomato’s competitor, Swiggy, had a different approach when it came to embracing AI. It launched a free AI-fuelled photoshoot feature that helps restaurants click realistic images of the food items, resembling a professionally shot photo. In a 2022 interview with AIM, Zomato had confirmed that the company is heavily investing in AI and analytics to give a customised experience for its consumers and partners. Zomato had appointed Vaibhav Bhutani to lead its generative AI initiatives in December 2022. He then built the team at Eternal, which led to the company releasing its Zomato AI Buddy in September 2o23. Going beyond the limitations of traditional chatbots, Zomato AI Buddy stands as an intelligent and intuitive foodie companion, dedicated to understanding and satisfying users’ ever-changing preferences, dietary requirements, and even their current moods. But then Bhutani left and joined Zepto as the VP of product. Even though Zomato still does not allow the use of generative AI images in its menu, the push towards AI is clearly visible now, at least in chatbots, assistants, and copilots.
Also, Zomato is finally becoming an AI company.
To make Espresso usable by everyone, Zomato built a lightweight front-end tool and also made it available on GitHub.
[]
["TPU", "AWS", "AI", "chatbots", "ML", "RAG", "Aim", "generative AI", "analytics", "copilots"]
["AI", "ML", "analytics", "generative AI", "Aim", "RAG", "copilots", "chatbots", "AWS", "TPU"]
Mohit writes about AI in simple, explainable, and often funny words. He's especially passionate about chatting with those building AI for Bharat, with the occasional detour into AGI.