Skip to content

About

This is my masters thesis project that is about optimizing http2 network traffic by reducing header bytes and increasing HPACK efficiency

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

2,558 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimizing network traffic by reducing metadata in microservices that use JWT and GRPC

Note: This is a modified version of Google's microservices-demo extended for academic research on JWT compression optimization. See ATTRIBUTION.md for details.

Overview

This repository demonstrates JWT compression techniques in a microservices architecture:

  • JWT Authentication: Token-based authentication across services
  • JWT Compression: Optional compression feature that splits JWT into multiple headers for better HTTP/2 HPACK caching
  • Performance Testing: Comprehensive benchmarking tools to measure compression benefits

Thesis

Thesis is publicly available here

Research Focus

This project investigates the performance impact of JWT compression in microservices environments, specifically:

  • Network bandwidth reduction through header optimization
  • HTTP/2 HPACK caching efficiency with split JWT headers
  • Latency improvements under high concurrent load
  • Scalability characteristics with compressed vs. uncompressed tokens

Prerequisites

The following tools should already be available in your Github Codespace (at least 4core and 16GB ram):

  • kubectl - Kubernetes CLI
  • jq - JSON processor
  • tshark - Network analysis
  • git - Version control
  • minikube - Lightweight Kubernetes

Step-by-Step Instructions

Step 1: Enable JWT Compression and Run Test

sudo apt update && sudo apt upgrade
minikube start
minikube ssh "sudo apt-get update && sudo apt-get install -y tcpdump"

Install skaffold for linux x86_64

curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && sudo install skaffold /usr/local/bin/ && rm skaffold && skaffold version

Install k6 and tcpdump

curl -L https://github.com/grafana/k6/releases/download/v0.51.0/k6-v0.51.0-linux-amd64.tar.gz -o k6.tar.gz && tar -xzf k6.tar.gz && sudo mv k6-v0.51.0-linux-amd64/k6 /usr/local/bin/ && rm -rf k6.tar.gz k6-v0.51.0-linux-amd64 && k6 version

Install tshark

sudo DEBIAN_FRONTEND=noninteractive apt-get installsudo DEBIAN_FRONTEND=noninteractive apt-get install
sudo apt-get update && sudo apt-get install -y tcpdump

Enable JWT compression across all services:

./enable_jwt_compression.sh

This will take a little while.

What this does:

  • Updates YAML manifests to set ENABLE_JWT_COMPRESSION=true
  • Deploys changes using skaffold run
  • Rebuilds and restarts all affected pods

Step 2: Verify Pods are Running

Before running the test, confirm all pods are healthy:

kubectl get pods

If pods are not ready, wait a few more minutes and check again.

Step 3: Run JWT Compression Test (Enabled)

The default settings for the test is for 512kb Dynamic Table size and for 200 Users

Run the load test with JWT compression enabled:

./run-jwt-compression-test.s

What this does:

  • Starts network packet capture (tcpdump)
  • Runs k6 load test simulating user journeys
  • Captures performance metrics
  • Saves results to a timestamped directory

Step 4: Disable JWT Compression and Run Test

Now disable JWT compression:

./disable_jwt_compression.sh

Step 5: Verify Pods are Running

Verify all pods restarted successfully:

kubectl get pods

Wait for all pods to be Running with 1/1 ready.

Step 6: Run JWT Compression Test (Disabled)

Run the load test again with JWT compression disabled:

./run-jwt-compression-test.sh

Step 7: Compare Results

Now compare the performance between both tests:

Edit the script first to set your test directories at the top:

# Edit these lines with your actual directory names
ENABLED_DIR="jwt-compression-on-results-20251017_143022"
DISABLED_DIR="jwt-compression-off-results-20251017_144530"
./compare-jwt-compression-enhanced.sh

What the comparison shows:

  1. K6 Load Test Results

    • Iterations, request rate
    • Data sent/received
    • Response times (avg, p95, p99)
    • Failed requests and checks
  2. Performance Improvements

    • Bandwidth savings (upload/download)
    • Response time differences
    • Network traffic reduction
  3. Network Traffic Analysis

    • Total packets and bytes
    • HTTP/2 traffic patterns
    • JWT header usage
  4. JWT Header Analysis

    • Compression ON: 4 headers (~744 bytes first request, ~470 bytes cached)
    • Compression OFF: 1 header (~900+ bytes every request)
  5. Summary

    • Overall bandwidth savings percentage
    • Performance improvements
    • Key benefits

Troubleshooting

Pods Not Starting

# Check pod status and events
kubectl describe pod <pod-name>

# Check logs
kubectl logs <pod-name>

# Restart deployment
kubectl rollout restart deployment <service-name>

Test Script Fails

# Ensure scripts are executable
chmod +x *.sh

# Check if k6 is installed
k6 version

# Verify network tools
which tcpdump tshark

Skaffold Errors

# Check Skaffold configuration
skaffold diagnose

# Clean and rebuild
skaffold delete
skaffold run

Comparison Script Issues

# Verify test result directories exist
ls -la jwt-compression-*-results-*/

# Check if jq is installed
jq --version

# Manually check results
cat jwt-compression-on-results-*/k6-summary.json | jq .

Last updated: December 14, 2025

About

This is my masters thesis project that is about optimizing http2 network traffic by reducing header bytes and increasing HPACK efficiency

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages