---
title: "Unleash the Power of oha: Website Performance Testing Made Simple"
description: "Learn how to use oha for website load testing. Simple guide with practical examples to measure your site's performance, throughput, and response times. Includes installation and basic usage."
date: 2025-02-10
categories: ["tools"]
tags: ["free-tools","load-tests"]
---

import YouTubeEmbed from "../../layouts/components/widgets/YouTubeEmbed.astro";


Website performance is crucial for user experience and SEO. In this guide, you'll learn how to use oha, a lightweight HTTP load testing tool, to measure your website's performance under load. Whether you're a developer or site owner, these tests will help you understand your site's capabilities.

## What is oha?

![oha](../../assets/images/25/02/oha.webp)


[oha](https://github.com/hatoo/oha) (おはよう) is:
- A modern, lightweight HTTP load testing tool
- Written in Rust for optimal performance
- Perfect for quick website performance testing
- Features real-time visualization of results

Key benefits:
| Feature | Benefit |
|---------|----------|
| Speed | Fast execution with minimal resource usage |
| Simplicity | Single command operation |
| Visual Output | Real-time metrics display |
| Detailed Reports | Comprehensive performance statistics |


<YouTubeEmbed
  url="https://www.youtube.com/embed/iVcvbmY0pk8"
  label="Unleash the Power of oha: Website Performance Testing Made Simple"
/>

## Installation
Choose your operating system and follow these simple steps:

### Linux:
```bash
cargo install oha
```

### MacOS:
```bash
brew install oha
```

### Windows:
```bash
winget install hatoo.oha
```

## Basic Usage

### Simple Test Command:
```bash
oha https://yourwebsite.com
```

### Common Options Table:
| Option | Description | Example |
|--------|-------------|---------|
| -n | Total requests | oha -n 200 https://site.com |
| -c | Concurrent users | oha -c 50 https://site.com |
| -q | Requests per second | oha -q 100 https://site.com |
| --no-tui | Disable visual interface | oha --no-tui https://site.com |

### Understanding Test Results

Let's analyze a typical output:
```sh
Summary:
  Success rate: 100.00%
  Total:        0.6689 secs
  Slowest:      0.4123 secs
  Fastest:      0.0733 secs
  Average:      0.1557 secs
  Requests/sec: 299.0098
```

Key Metrics Explained:
| Metric | What It Means | Good Values |
|--------|---------------|-------------|
| Success rate | Percentage of successful requests | Should be close to 100% |
| Average time | Mean response time | Under 1 second |
| Requests/sec | Throughput capacity | Depends on your needs |
| Slowest | Worst response time | Should not be more than 3x average |

### Response Time Distribution
The percentile breakdown shows how your site performs across all requests:
- 50th percentile (median): Normal user experience
- 90th percentile: Slower but acceptable responses
- 99th percentile: Worst-case scenarios


**Real Output:**

```sh
╰─❯ oha https://www.bitdoze.com
Summary:
  Success rate: 100.00%
  Total:        0.6689 secs
  Slowest:      0.4123 secs
  Fastest:      0.0733 secs
  Average:      0.1557 secs
  Requests/sec: 299.0098

  Total data:   2.08 MiB
  Size/request: 10.64 KiB
  Size/sec:     3.11 MiB

Response time histogram:
  0.073 [1]   |
  0.107 [144] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.141 [5]   |■
  0.175 [0]   |
  0.209 [0]   |
  0.243 [0]   |
  0.277 [0]   |
  0.311 [5]   |■
  0.345 [15]  |■■■
  0.378 [18]  |■■■■
  0.412 [12]  |■■

Response time distribution:
  10.00% in 0.0803 secs
  25.00% in 0.0847 secs
  50.00% in 0.0935 secs
  75.00% in 0.3010 secs
  90.00% in 0.3617 secs
  95.00% in 0.3813 secs
  99.00% in 0.4108 secs
  99.90% in 0.4123 secs
  99.99% in 0.4123 secs


Details (average, fastest, slowest):
  DNS+dialup:   0.0811 secs, 0.0488 secs, 0.1036 secs
  DNS-lookup:   0.0001 secs, 0.0000 secs, 0.0005 secs

Status code distribution:
  [200] 200 responses
```

## Basic Testing Scenarios

1. **Quick Health Check**
```bash
oha -n 100 https://yoursite.com
```
Purpose: Quick overview of site performance

2. **Load Testing**
```bash
oha -n 1000 -c 50 https://yoursite.com
```
Purpose: Simulate multiple concurrent users

3. **Stress Testing**
```bash
oha -n 2000 -c 100 -q 200 https://yoursite.com
```
Purpose: Find performance limits


## Real-World Testing Examples

### 1. Testing API Endpoints
```bash
oha -n 500 -c 50 -m POST -T "application/json" -d '{"key":"value"}' https://api.yoursite.com/endpoint
```

API Testing Parameters:
| Parameter | Description | Usage |
|-----------|-------------|--------|
| -m POST | HTTP method | For API calls |
| -T | Content type | Specify data format |
| -d | Request body | Send data |

### 2. Simulating Peak Traffic
```bash
oha -n 2000 -c 100 --disable-keepalive https://yoursite.com
```

Peak Traffic Settings:
- Higher concurrent connections (-c)
- Disabled keepalive for realism
- Larger number of requests (-n)

## Interpreting Results

### Performance Metrics Table
| Metric | Good | Warning | Critical |
|--------|------|---------|-----------|
| Response Time | < 1s | 1-3s | > 3s |
| Success Rate | > 99% | 95-99% | < 95% |
| Requests/sec | Site-specific | 20% drop | > 30% drop |

### Common Issues and Solutions

1. **High Response Times**
- Possible Causes:
  - Server resources maxed out
  - Database bottlenecks
  - Unoptimized code
- Solutions:
  - Implement caching
  - Optimize database queries
  - Scale server resources

2. **Failed Requests**
- Possible Causes:
  - Server timeout
  - Rate limiting
  - Network issues
- Solutions:
  - Increase timeout values
  - Adjust rate limits
  - Check network configuration

## Best Practices for Load Testing

### Do's and Don'ts

✅ Do:
- Start with small tests
- Test during low-traffic periods
- Monitor server resources
- Test regularly
- Document results

❌ Don't:
- Test production without warning
- Run tests from production servers
- Ignore error rates
- Test single endpoints only



## Comparing oha with k6

[k6](https://k6.io) is a modern load testing tool by Grafana Labs that uses JavaScript for creating test scenarios. Unlike oha's simple command-line approach, k6 allows you to write complex testing scripts that can simulate real user behaviors.


### Feature Comparison

| Feature | oha | k6 |
|---------|-----|-----|
| Ease of Use | ★★★★★ | ★★★☆☆ |
| Scripting Required | No | Yes |
| Real-time Metrics | Basic | Advanced |
| Learning Curve | Minimal | Moderate |
| CI/CD Integration | Limited | Extensive |

### When to Use Each Tool

Use oha for:
- Quick performance checks
- Simple HTTP testing
- Immediate results
- Command-line operations

Use k6 for:
- Complex user scenarios
- Detailed performance analysis
- CI/CD pipeline integration
- Custom test scripts



## Conclusion

Website load testing with oha provides a straightforward and efficient way to measure and understand your site's performance under various conditions. Through this guide, we've explored how to install and use oha, interpret its results, and apply best practices for effective load testing.

Remember that regular testing, careful documentation of results, and gradual scaling of test parameters are key to maintaining optimal website performance. Whether you're managing a small blog or a complex web application, oha's simplicity and powerful features make it an excellent choice for routine performance monitoring and load testing. As you implement these testing practices, focus on establishing baseline metrics, monitoring changes over time, and using the insights gained to continuously improve your website's performance and user experience.