I’m thrilled to share a project that my team has been working on for the past year, one that I am incredibly proud of. Here are some of the key details:
Project Highlights
- High-Performance REST API & Web Services for SDKs: Designed to handle sudden traffic spikes and scale beyond database limits.
- Cloud Deployment: Routinely load tested and deployed across multiple regions with seamless upgrades using robust CI/CD pipelines.
- Automated Testing: Mandatory unit tests for critical APIs and automated component tests.
- Detailed Monitoring: Comprehensive metrics reporting for monitoring and health checks.
- Advanced Logging: Fine-grained, multi-level logging with a log search platform.
- Developer Experience: Streamlined development, integration, testing, and deployment cycles for an excellent developer experience.
APIs vs. Web Services
APIs and web services both facilitate data transfer between applications over the internet, but they are not synonymous. All web services are APIs, but not all APIs are web services. Our focus here is on REST APIs, which are a type of web service.
Understanding REST APIs
REST (Representational State Transfer) is an architectural style for developing web services that can easily communicate with each other. REST is popular due to its simplicity and the fact that it builds upon existing internet standards, specifically HTTP.
Tech Stack Overview
Language: Go
Go’s native concurrency features, such as goroutines, outperform traditional thread management, reducing server costs in a distributed environment.
Database
This depends largely on the application requirements and business logic
MySQL: A versatile, open-source relational database with strong community support. It is highly tunable and scalable.
Redis: Excellent for non-RDBMS data storage, offering persistence and backup capabilities, simplifying scaling issues.
Kafka: Ideal for streaming data and event-driven platforms, serving as both a storage and transportation layer.
Cache
MySQL Query Caching: Limited and suffers from I/O latency. External caching is necessary for higher performance.
In-Memory caching: Suitable for extremely fast lookups.
Redis: Provides in-memory caching with support for complex data structures, scalable for high throughput.
Web Framework: Gin
Gin: offers a strong routing mechanism, middleware support for logging and authentication, and excellent request context handling.
Queue
Redis: Fast enqueue/dequeue operations, ensuring linear processing.
RabbitMQ: Effective for pub/sub solutions.
Kafka: Ideal for event-driven systems, offering high availability and fault tolerance.
Deployment
Kubernetes: Supreme for containerization and orchestration, with excellent management and monitoring support.
AWS: EC2, RDS for MySQL, Elasticache for Redis, MSK for Kafka, and EKS for Kubernetes.
Logging & Monitoring
Elastic Search: Efficient log search and analytics.
Prometheus: Collects and stores metrics as time-series data.
Grafana: Visualizes metrics and creates dashboards for monitoring.
Testing
Go provides robust support for unit testing .
Component Tests: Postman for API collections and Jenkins for automated testing.
Load Testing: Locust and Grafanak6 for load testing various types of applications.
Code Architecture & Developer Experience
- Unit Tests: For critical APIs and services.
- Component Test Coverage: High coverage for all business use cases, including security.
- Load Tests: Routine load tests to benchmark application performance.
- Auto Documentation: For all endpoints and methods, increasing productivity.
- Micro-Service Architecture: Isolates business logic, reduces bugs, and speeds up changes.
- CI/CD Pipeline: Integrated, deployed, and tested continuously.
- IDE: GoLand and k8lens for enhanced productivity.
Tools & Collaboration
- Ticketing & Project Management: Clickup for task descriptions, merge requests, QA & bug tracking, and release notes.
- Communication: Slack for collaboration, with integrations for project management tools and alerting.
Scaling software is an ongoing process, with always more to improve. This is a glimpse into an approach to building a high-performance REST API, a topic that continues to evolve.
I would love to get into the details of choice of these technologies and their implementation details, but it goes deep, hence deserves a series of posts !
Thoughts ? Questions ? Suggestions ?