Skip to content

0reilly/github-api-rate-limit-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub API Rate Limit Analysis

A comprehensive analysis of GitHub's API rate limiting behavior through systematic testing and visualization.

📊 Overview

This project provides a detailed investigation into how GitHub's API implements rate limiting, including:

  • Response time analysis across different request patterns
  • Rate limit boundary testing to understand limits and behavior
  • Visualizations of API performance and rate limiting patterns
  • Comprehensive report with findings and recommendations

🚀 Features

  • Multiple Test Patterns: Burst, sustained, and varied delay requests
  • Detailed Metrics: Response times, status codes, rate limit headers
  • Data Visualization: Matplotlib charts showing patterns and analysis
  • Boundary Testing: Testing rate limit exhaustion and retry behavior
  • Production Recommendations: Best practices for API consumers

📁 Project Structure

├── scripts/                    # Python testing scripts
│   ├── api_rate_limit_test.py           # Main testing script
│   ├── rate_limit_boundary_test.py      # Boundary testing script
│   └── rate_limit_boundary_test_fixed.py # Fixed boundary testing
├── data/                       # Raw test results
│   ├── api_test_results.json            # Initial test results
│   └── rate_limit_boundary_results.json # Boundary test results
├── visualizations/             # Generated charts
│   ├── api_test_visualizations.png      # Main analysis charts
│   └── rate_limit_boundary_analysis.png # Boundary analysis charts
├── docs/                       # Documentation
│   └── api_rate_limit_summary_report.md # Comprehensive report
└── README.md                   # This file

🛠️ Quick Start

Prerequisites

  • Python 3.8+
  • Required packages: requests, pandas, matplotlib, numpy

Installation

# Clone the repository
git clone https://github.com/0reilly/github-api-rate-limit-analysis.git
cd github-api-rate-limit-analysis

# Install dependencies
pip install requests pandas matplotlib numpy

Running Tests

# Run main API rate limit tests
python scripts/api_rate_limit_test.py

# Run boundary testing
python scripts/rate_limit_boundary_test_fixed.py

📈 Key Findings

Rate Limit Configuration

  • Unauthenticated Limit: 60 requests per hour
  • Rate Limit Headers: Comprehensive headers including remaining, limit, and reset time
  • Error Response: HTTP 403 with clear rate limit information

Performance Characteristics

  • Average Response Time: ~100ms
  • Response Time Range: 56ms - 185ms
  • Performance Consistency: Stable across all request patterns

Rate Limit Behavior

  • First Limit Hit: Request #47 when remaining reached 0
  • Retry Behavior: Partial reset after waiting periods
  • Header Clarity: Excellent documentation in response headers

📊 Visualizations

API Test Visualizations

API Test Visualizations

Analysis:

  • Top Left: Response times remain consistent (~100ms) across all requests
  • Top Right: All requests returned 200 status codes (successful)
  • Bottom Left: Rate limit decreases predictably with each request
  • Bottom Right: Response times follow a normal distribution around 100ms

Rate Limit Boundary Analysis

Rate Limit Boundary Analysis

Analysis:

  • Top Left: Rate limit decreases steadily, with red line showing where limit was hit
  • Top Right: Green dots show successful requests (200), red dots show rate-limited requests (403)
  • Bottom Left: Cumulative requests vs remaining rate limit shows linear consumption
  • Bottom Right: Response times remain stable throughout the test duration

📋 Usage Examples

Basic API Testing

from scripts.api_rate_limit_test import GitHubAPITester

tester = GitHubAPITester()
tester.test_burst_pattern(10)
tester.test_sustained_pattern(10, 1)
results = tester.analyze_results()

Boundary Testing

from scripts.rate_limit_boundary_test_fixed import RateLimitBoundaryTester

tester = RateLimitBoundaryTester()
tester.test_rate_limit_exhaustion(70)
tester.test_retry_after_rate_limit()

🔧 Customization

You can customize the testing by:

  • Modifying request patterns in the scripts
  • Changing the target API endpoint
  • Adjusting delay intervals and request counts
  • Adding additional metrics collection

📝 Report

See the comprehensive analysis report in docs/api_rate_limit_summary_report.md for:

  • Detailed methodology
  • Complete findings
  • Technical insights
  • Production recommendations

🤝 Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for:

  • Additional API endpoints testing
  • Enhanced visualization features
  • New testing methodologies
  • Documentation improvements

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • GitHub for providing a well-documented and reliable API
  • The open-source community for the Python libraries used
  • Contributors and testers who help improve this analysis

About

Comprehensive analysis of GitHub API rate limiting behavior with testing scripts and visualizations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages