This project implements a performance benchmarking system for various middleware technologies in Go. The primary benchmark uses a Fibonacci calculation function as the test workload, which provides an excellent test case as its computational complexity increases with larger input numbers.
app/
: Main application directory containing all middleware implementations and benchmarkstcp/
: TCP implementation of client-server architectureudp/
: UDP implementation of client-server architecturerpc/
: RPC implementation using Go's built-in RPC packagemqtt/
: MQTT implementation using the Paho MQTT clientrabbitmq/
: RabbitMQ implementation using AMQPutils/
: Shared utility functionsbenchmark/
: Contains Jupyter notebooks with benchmark analysisrun_all_experiments.sh
: Script to run all experiments across different middleware implementations
The core function used for benchmarking is the recursive Fibonacci calculation:
func fibonacci(n int) int {
if n <= 1 {
return n
}
return fibonacci(n-1) + fibonacci(n-2)
}
This function is ideal for benchmarking because:
- It has exponentially increasing complexity as input size grows
- It's CPU-intensive, which helps measure processing capabilities
- The function is deterministic, making results reproducible
- Different middleware technologies can be compared using the same workload
- Make sure you have Docker and Docker Compose installed on your system
- To run all experiments at once:
cd app chmod +x run_all_experiments.sh ./run_all_experiments.sh
- To run experiments for a specific middleware:
cd app/<middleware-name> docker compose build docker compose up -d server docker compose up client -d --scale client=<number-of-clients>
The benchmark results are stored in CSV files in the data/
directory within each middleware implementation folder. Each CSV file contains:
- Input: The Fibonacci number to calculate
- Output: The calculated Fibonacci value
- timeTaken: Time taken for the request/response cycle in milliseconds
The app/benchmark/
directory contains Jupyter notebooks that can be used to analyze the benchmark results. These notebooks provide visualizations and comparative analysis of the different middleware technologies.
To view the analysis:
- Install Jupyter Notebook on your system
- Navigate to the benchmark directory:
cd app/benchmark jupyter notebook
- Open the
main.ipynb
file to see the analysis
Each middleware implementation follows the same pattern:
- A server that listens for client requests
- A client that sends numbers to calculate Fibonacci values
- The server calculates and returns results
- The client measures and records the time taken
The project currently supports these middleware technologies:
- TCP: Direct socket communication using TCP
- UDP: Connectionless communication using UDP
- RPC: Remote Procedure Call using Go's built-in rpc package
- MQTT: Message Queuing Telemetry Transport protocol
- RabbitMQ: Advanced Message Queuing Protocol implementation
- Go 1.18+
- Docker and Docker Compose
- For analytics: Python with Jupyter Notebook
[Insert your license information here]