Starting My API Gateway Project

Introduction

My name is Rawn Kelly, and I'm a Computer Science Major attending Florida State University. Whether you've come to this blog as a recruiter or are just interested in software development, thank you for taking the time to read through a bit of my journey. I was born and raised in Florida, but I've always loved how the internet allows people to transcend their physical location and connect. That somewhat brings me to the purpose of this blog as I document the process of building an API Gateway in C++.

 Project Overview and Motivation

In modern microservices architectures, API Gateways serve as the crucial entry point for client requests, handling everything from request routing to load balancing. I chose to build an API Gateway because it presents fascinating challenges in concurrent programming, caching strategies, and system design. This project allows me to demonstrate my understanding of distributed systems while implementing performance-critical components in C++.

Initial Steps

The foundation of my API Gateway consists of three core components:

LRU Cache System

I implemented a thread-safe Least Recently Used (LRU) cache to optimize response times for frequently requested endpoints. The cache uses a combination of a hash map for O(1) lookups and a doubly-linked list for maintaining access order. This required careful consideration of:

Thread safety using mutex locks

Efficient pointer management for the linked list

Memory cleanup during eviction

Cache size management

Thread Pool Management

To handle concurrent requests efficiently, I implemented a thread pool that:

Maintains a configurable number of worker threads

Uses condition variables for thread synchronization

Implements a task queue for work distribution

Ensures proper resource cleanup during shutdown

Load Balancing

The initial implementation includes a round-robin load balancer that:

Distributes requests across multiple backend servers

Maintains thread safety during backend selection

Allows for dynamic backend configuration

Next Steps

As I continue developing this API Gateway, I plan to enhance it with:

Advanced load balancing strategies (weighted round-robin, least connections)

Circuit breaker implementation for fault tolerance

Request rate limiting and throttling

Metrics collection and monitoring

More sophisticated routing rules and path-based routing

Conclusion

Thank you for joining me at the start of this journey. Stay tuned for detailed updates as I progress through building a high-performance API-Gateway in C++. I look forward to sharing more with you soon!

Popular posts from this blog

Orderbook Update 2: Implementing the Matching Engine

Starting My Order book Project