Skip to content

simbayippy/OrbitalxTikTok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orbital API Gateway

This is an implementation of an API gateway, built using cloudwego's Hertz and Kitex libraries. It routes requests to appropriate RPC servers simulating microservices, and employs caching and rate limiting strategies.

In addition to completing the main assignment, the additional assignment has also been worked on and fulfilled. This repository contains the work as well as benchmark results of the API Gateway.

Read our full documentation here

Prerequisites

Make sure that your Nacos server is running before continuing.

Getting Started (API Gateway)

Follow the steps below to set up the API Gateway HTTP server.

Installation

Clone the repository to your local machine:
git clone https://github.com/simbayippy/OrbitalxTiktok.git

Navigate into the api gateway folder: cd OrbitalxTiktok/APIGateway

Build and run the API Gateway: go run .

Usage

This API gateway serves as the single entry point into the system, dealing with HTTP requests from the clients, translating them into the appropriate RPC request formats, and forwarding these to the corresponding RPC servers. The response is then returned back to the client.

It supports the following Generic Calls of Kitex:

  • JSON thrift Generic Call (main deliverable of this project)
  • HTTP Mapping Generic Call
  • Binary Generic Call

As well as a newly implemented Generic Call feature:

  • JSON Protobuf Generic Call

This API Gateway and RPC servers natively support the newly built jsonproto_codec. In the go.mod file, there is the replacement line: replace github.com/cloudwego/kitex => github.com/simbayippy/kitex v1.0.0

For the implementation of my Protobuf codec in the Kitex library, visit here

Getting Started (RPC servers)

Navigate into the RPC folder: cd OrbitalxTiktok/RPCservers

Currently, 4 types of RPC servers have been built to handle the different Generic Calls:

  • JSON Thrift RPC
  • HTTP RPC
  • Binary RPC

and the new addition:

  • JSON proto RPC

To start a server, navigate into its folder and run: go run main.go

Benchmarking

Benchmarking was done using Apache Bench, on the newly created JSON (Proto) Generic Call

Configuration of benchmark:

  • 200,000 requests
  • concurrency level: 100
  • HTTP keep alive enabled: -k flag set
  • JSON file used in request body (1,118 bytes): APIGateway/test/postDataProto.json

Command used:
ab -n 200000 -c 100 -k -p test/postDataProto.json -T 'application/json' http://127.0.0.1:8080/jsonprotoservice/Test

Results:

Time per request across all concurrent requests: 0.026ms

Result

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published