Client-Server Posting System: REST vs gRPC Study

A client-server posting system that implements both REST and gRPC to compare performance, scalability, and data transfer efficiency

Tech Stack: Node.js, REST APIs, gRPC, Docker, JavaScript

Type: Solo Backend Project


Overview

This project explores the design of a client-server posting system while comparing the performance of REST and gRPC communication. The goal was to evaluate how different protocols handle data transfer, scalability, and request load under various conditions.


Key Features

Dual API Implementation (REST & gRPC) 🔄
Implemented the same system using both REST endpoints and gRPC services to enable direct performance comparison.

Performance Testing & Analysis 📊
Ran experiments to evaluate throughput, latency, and scalability under different request loads and data sizes.

Scalability Exploration
Tested how the system behaves with multiple clients and increasing request rates to understand real-world performance limits.


Technical Details

  • Built client-server architecture using Node.js
  • Implemented REST APIs for standard HTTP communication
  • Implemented gRPC services for high-performance communication
  • Designed experiments to test:
    • Request throughput
    • Data transfer efficiency
    • System behaviour under load
  • Collected and analyzed results using structured test cases

Results

Load SizeReqsCCRESTgRPCResults
Low 100100.0063 sec0.0024 secgRPC resulted in lower latency 
Moderate500500.0284 sec0.0052 secREST again had higher latency with some spiked in data 
High10001000.0415 sec0.0068 secgRPC scaled better with a consistently lower average and smaller overall increases 

Throughput 

  • Both implementations had 100% success rates across all tests 
  • gRPC had higher throughput given its lower serialization with Protocol Buffers. 

Network and Node Failure 

  • REST requests resulted in higher latency when using the simulated network latency compared to the latency results of gRPC. 
  • Both REST and gRPC handled node failure with successfully reconnecting to the restarted server. 

Strengths and Weaknesses 

REST STRENGTHS:

  • Simplicity and widely compatible 
  • More user friendly, easier readability 

REST WEAKNESSES: 

  • Higher average latency, and higher latency growth rate compared to gRPC. 
  • Higher overhead with use of HTTP and JSON serialization. 

gRPC STRENGTHS: 

  • Higher efficiency.
  • Better performance with increasing payload sizes. 

GRPC WEAKNESSES: 

  • More complex setup compared to REST. 
  • Limited compatibility. 

Conclusion 

  • gRPC offers a higher-performance, scalable system for systems where efficiency and throughput are prioritized. 
  • REST may be preferred for systems that prioritize simplicity, and more readable debugging communication. 


Challenges & Solutions

Challenge: Understanding and implementing gRPC alongside REST

Solution:

Learned gRPC concepts and built parallel implementations to directly compare behavior and performance


Challenge: Designing meaningful performance experiments

Solution:

Created controlled test scenarios (varying request rates, data sizes, and repetitions) to ensure reliable and comparable results


What I Learned

  • Key differences between REST and gRPC architectures
  • How to design and evaluate performance experiments
  • Understanding scalability and system bottlenecks
  • Experience with client-server system design

Discover more from kelseyhkeller

Subscribe now to keep reading and get access to the full archive.

Continue reading