Technology

Big Tech Engineer Vivek Kumar Spills the Beans on How to Build Scalable and Performant Backend Architectures

Vivek Kumar, a full-stack engineer at a FAANG company, has dedicated his career to building high-performance backend architectures. With a degree from IIT Bombay and over 8 years of experience in international companies, Vivek sits down for an exclusive interview to share his insights on designing backend systems capable of supporting millions of users. Deeply committed to sustainable serverless solutions, he highlights critical practices such as transitioning to microservices, leveraging tools like Redis and Elasticsearch, and balancing future scalability with real-time performance. In this interview, Vivek offers invaluable tips for engineers aspiring to create scalable, efficient systems.

What inspired your focus on backend development, scalability, and efficient API design in the early stages of your career?

Vivek Kumar: When I first started my career as a fresher in 2014 with Quikr, Mumbai, India, I got a project which needed fronted experience in PHP but I couldn’t much appreciate it. But working in this project helped me see the complexity and challenges involved with the backend system. I was attracted to the challenge of building scalable systems that could handle massive amounts of data while also managing many user requests in parallel efficiently.

A system’s ability to scale has a direct impact on user experience, if the system fails to efficiently handle multiple requests simultaneously, it either breaks the system impacting the user experience or leads to enormous amounts of investment. Due to these challenging tradeoffs, I got excited to work as backend developer. Quickly I managed to change my team and started as a fresh backend developer in early 2015. 

As I gained more experience, I started to realize that behind every successful product, there is a strong backend architecture. I learnt that a successful system’s responsibility is not to just make processes run but also ensure that those processes run even at peak times under pressure. 

This made me passionate to learn more and work in backend development and API design. I love the challenge of solving complex problems and building systems that could perform reliably even at peak times.API design is one of the building blocks of a strong backend system because APIs connect different systems and applications at the backend. 

Designing and building scalable systems is my passion as a software engineer. I enjoy solving complex challenges, optimizing systems for performance. 

What principles guide you when designing APIs for performance and scalability in high-demand environments?

Vivek Kumar: When I design APIs for high-demand environments, I stick to a few practical principles that I’ve learned in my last 10 years and most of time it worked well:

  1. Keep Things Simple: We should design API as simple as possible so that it would be easy for developers to understand and integrate. The API name should make sense with its core functionality.  I always make sure we have very clear documentation 
  2. Make Them Efficient: We need to also make sure our API is high performing. We should get a careful review of its architecture with a peer colleague and try to optimise queries and cache the data if feasible  
  3. Think About Growth: We should always think about growth of our product and how it can impact a new API. We should design an API so that it can scale horizontally with product growth. If we end up developing something which doesn’t meet performance requirements from product growth we might need to have a hacky fix and re-design complete architecture again.  
  4. Use Caching Wisely: As previously mentioned, always use caching if possible. It makes a huge difference in response times. It reduces server load and ensures users get faster results, which is always a win.
  5. Write Smarter Database Queries: We should always focus on API queries and make sure they are well optimised and use required indices. Don’t hesitate to change the schema of database if needed!
  6. Set Limits to Protect the System: We should also think of a generosity rate limit for APIs and ability to throttle requests if API can’t sustain the load. It will protect the system from scripting attacks and will also help to provide good user experience for some users vs breaking it for all. 
  7. Set Up Alert on Metrics: Just because an API is live doesn’t mean the job is done. We should monitor its performance regularly to catch bottlenecks or areas that need improvement. It’s always better to set up alerts on some key metrics and define its priority. 
  8. Adapt Versioning: Things change, and APIs need to adapt. I use versioning to make sure updates don’t break anything for existing users, so transitions are smooth.

These are the steps I follow to build APIs that perform well under pressure while being easy for developers to use. Over time, I’ve seen how sticking to these principles makes a big difference, both for the system and for the people using it.

At Algorythma, you scaled Swoo to support over 11 million users. What specific architectural changes or optimizations had the most significant impact?

Vivek Kumar: During my tenure at Algorithma, we did multiple architectural changes to scale Swoo to support over 11 million users. I think these are most prominent changes: 

Migrating to Microservices Architecture

One of the most impactful architectural changes was transitioning to a microservices architecture from our initial monolithic architecture which used to handle users, search, authentication etc. as a single service. This allowed us to scale individual components independently, distributing tasks across multiple services and effectively managing the increasing load. It also helped to create a small team to focus on individual service which improved productivity and ownership. 

Aggressive Caching Strategy with Redis

We adopted an aggressive caching strategy using Redis to reduce latency and enhance response times. It helped to reduce the load on our backend database, including MySQL and Elasticsearch. We also had live Trivia and Bingo game and we adapted to use only cache for some of API during live game and update the backend database asynchronously via Kafka

Optimizing Elasticsearch Architecture and Queries

With our product growth, we started facing issues with our homepage and search feature which was mainly served from Elasticsearch. It forced us to improve overall search system of Swoo app. To improve the performance of our search system, we:

  • Optimised the JVM configuration of the elastic cluster to suit our requirements. Load testing helped us to find the best jvm configuration.
  • Increased the shards and replica for hot elastic search indices to scale the queries horizontally.
  • Optimized hot search queries to reduce the load on Elasticsearch
  • Cached frequently accessed queries on home page for a short duration to further reduce the load on Elasticsearch cluster
  • Increased number of nodes for Elasticsearch cluster to suite our product growth 

Migration to Golang for Gaming Service

Initially, our gaming service was developed using a different technology stack. However, as we scaled, we realized the importance of migrating it to Golang. The migration enabled us to take advantage of Golang’s lightweight goroutines, which significantly improved the service’s performance and scalability. Additionally, the low boot time of Golang made it easier to set up auto-scaling during live game time which helped to save $$$.

Load Balancing and Autoscaling

To ensure that our system could handle sudden spikes in traffic, we implemented load balancing and autoscaling via AWS ALB. This allowed us to dynamically allocate resources based on demand and make sure to run the optimal server required. It also help to reduce server costs.

Continuous Monitoring and Performance Tuning

We established a process for continuous monitoring of API performance via Jenkins which used to run regularly during low load time. It helped us to identify areas for improvement and fixed the issues before it can impact the real users.

Your toolkit includes technologies like Elasticsearch, Redis, and Firebase. How have these tools shaped your approach to solving scalability and efficiency challenges?

Vivek Kumar: As a seasoned developer, I’ve had the privilege of working with a variety of tools that have significantly impacted my approach to solving scalability and efficiency challenges. In this section, I’ll highlight mainly three essential tools in my toolkit: Elasticsearch, Redis, and Firebase.

Elasticsearch: Efficient Search and Data Management:

Elasticsearch is something I have extensively used for most of my employers. Every different use case taught me something new. It helped me to understand how important it is for scaled system to have optimized queries, proper indexing and optimal configuration for cluster like number of nodes, replica and shards. 

Its distributed architecture has helped me to scale search functionality horizontally, making it an ideal solution for handling large volumes of data.

Redis: High-Performance In Memory Caching

Redis is also something I have used for most of my career and for all of my employers. 

Redis always helped me to optimize the API for performance and reduce the load on the backend server. Redis helped me to understand how important it is to use caching for application and its immediate boost in performance. It also helped me to implement something very creative like I used redis to reducing API race condition for Swoo live games

Firebase: Serverless Architecture and Real-Time Data Synchronization

I used Firebase a lot during my tenure at Swoo. It helped us with real time communication between backend and client APP(Android/iOS/Desktop) for multiple use cases. 

It has shown me the benefits of serverless architectures and the importance of abstracting away infrastructure concerns. Its real-time database and cloud functions have enabled me to build scalable, event-driven systems.

With the increasing popularity of Microservices and serverless architectures, how has your approach to scalability and API design evolved over the years?

Vivek Kumar: As the software development continues to evolve, my approach to backend architecture and API design has also undergone significant changes. 

When I started my career, I usually tried to design an API which can work with current use cases without thinking much from a future perspective but as I grew as a developer I realised the importance of thinking for possible future use cases. How  my API will behave if we see huge product growth and use adoptions. Will this be able to handle the required scalability and performance in future? Will this be an easy to scale API as needed in future or we need to redesign? How can we develop it quickly to launch in the market?  

With the increasing popularity of Microservices and serverless architectures,  these future perspectives started getting industry standard solutions. 

I also want to share one example when I got the privilege to  lead one of key projects at Swoo to migrate giant monolithic services into many small micro services. It helped me to understand what it takes to do this and how it can be beneficial to  break down large applications into smaller, independent services that can be scaled and maintained separately. It reduced the bottlenecks of one service over others. It also helped to find different experts which can help to optimise particular service.

What advice would you give to aspiring software engineers who want to excel in building scalable and efficient systems?

Vivek Kumar: This is my advice for aspiring engineers who want to excel in building scalable and efficient systems:

Master the Fundamentals

To build scalable and efficient systems, I would advise to have a solid understanding of distributed systems, scalability principles, and performance optimization techniques. They should also have a good understanding of algorithms and data structures thoroughly, as they form the foundation of efficient system design.

Learn Essential Tools and Technologies

It is essential to understand high level of some of most used technologies and tools in industry like cloud computing, microservices, containerization tools like Docker and Kubernetes, search engines like Elasticsearch, in-memory caching solutions like Redis, relational databases like MySQL, and NoSQL databases like HBase and Cassandra. These technologies will help you to understand how to build efficient and scalable systems.

Study Successful Systems and Learn from Others

It is also very important to analyze and understand an already built successful system and get the grasp of what it takes to build something similar. It helped to learn from experienced engineers. Also try to understand the trade-offs and decisions made during the design process, and apply those lessons to your own projects.

Focus on Clean, Maintainable Code

Write clean, maintainable code that is easy to understand and modify. Prioritize testing, monitoring, and observability in your applications to ensure they are reliable and efficient.

Experiment, Prototype, and Iterate

Don’t be afraid to try new approaches and experiment with different technologies. Prototype your ideas, gather feedback, and iterate on your designs to create better systems.

Monitor and Analyze Performance

Develop a habit of monitoring and analyzing the performance of your systems to identify areas for improvement. It is always critical to set up alerts on different metrics and dashboard to flag if something is not working as expected. It will help to further optimise the system

Stay Up-to-Date with Industry Trends

Continuously educate yourself on the latest developments and best practices in software engineering. Stay current with industry trends, attend conferences, and participate in online communities to stay ahead of the curve.

If you could influence one major trend in software scalability or API design, what would it be and why?

Vivek Kumar: If I could influence one major trend in software scalability or API design, it would be to prioritize Serverless Architecture Adoption with a Focus on Sustainability.

With increased demand for scalable software, Serverless architectures have evolved as a promising solution. But, the current trend of adopting serverless architectures often overlooks the importance of sustainability.

I would like to influence the industry to adopt a more sustainable approach to serverless architecture adoption, focusing on:

  1. Energy Efficiency
  2. Resource Optimization
  3. Scalability
  4. Security
  5. Monitoring and Feedback

By adopting sustainability in serverless architecture, we can create more efficient, scalable, and environmentally friendly systems that meet the demands of modern applications.

Comments
To Top

Pin It on Pinterest

Share This