Skip to content

Commit

Permalink
Merge pull request #33 from aristotelesbr/development
Browse files Browse the repository at this point in the history
docs: performance guides
  • Loading branch information
aristotelesbr authored Jan 9, 2024
2 parents f15442a + 3b4b575 commit 59a540e
Showing 1 changed file with 42 additions and 13 deletions.
55 changes: 42 additions & 13 deletions guides/performance/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,59 @@ The **Lennarb** is very fast. The following benchmarks were performed on a MacBo

All tests are performed using the **Ruby 3.3.0**

### Requests per second (RPS) - Dinamic routes
## Benchmark numbers

This document contains the benchmarks comparing **Lennarb** with other routers based on Rack. Metrics evaluated include Requests per Second, Initial memory usage and Startup time.

### 1. Requests per Second (RPS)

| Position | Application | 10 RPS | 100 RPS | 1.000 RPS | 10.000 RPS |
| -------- | ----------- | ---------- | ---------- | --------- | ---------- |
| 1 | Lenna | 126.252,36 | 108.086,55 | 87.111,91 | 68.460,64 |
| 2 | Roda | 123.360,37 | 88.380,56 | 66.990,77 | 48.108,29 |
| 3 | Syro | 114.105,38 | 80.909,39 | 61.415,86 | 46.639,81 |
| 4 | Hanami-API | 68.089,18 | 52.851,88 | 40.801,78 | 27.996,00 |

This table ranks the routers by the number of requests they can process per second. Higher numbers indicate better performance.

### 2. Initial memory usage (in KB)

| Position | Application | 10 KB | 100 KB | 1.000 KB | 10.000 KB |
| -------- | ----------- | ------ | ------ | -------- | --------- |
| 1 | Syro | 12,160 | 12,544 | 16,460 | 49,692 |
| 2 | Lenna | 14,464 | 14,720 | 18,232 | 56,812 |
| 3 | Roda | 15,104 | 15,104 | 18,220 | 49,900 |
| 4 | Hanami-API | 15,744 | 16,128 | 20,888 | 64,824 |

This table shows the initial memory usage in KB. Lower values indicate lower memory consumption.

### 3. Startup time (in seconds)

| Position | Application | 10 seg | 100 seg | 1.000 seg | 10.000 seg |
| -------- | ----------- | ------ | ------- | --------- | ---------- |
| 1 | Syro | 0.274 | 0.347 | 0.455 | 0.997 |
| 2 | Lenna | 0.289 | 0.312 | 0.393 | 0.914 |
| 3 | Roda | 0.294 | 0.378 | 0.467 | 0.918 |
| 4 | Hanami-API | 0.445 | 0.550 | 0.808 | 3.074 |

This table shows the startup time in seconds. Lower values indicate faster startup times.


## Graphs

### Requests per second (RPS)

![Benchmarks](static/rps.png)

### Memory usage
### Initial memory usage

![Benchmarks](static/memory.png)

### Runtime startup

![Benchmarks](static/runtime.png)

## Best numbers

| Framework | RPS | Memory usage | Runtime startup |
| ---------- | --- | ------------ | --------------- |
| Lennarb | 1 | 1 | 1 |
| Roda | 2 | 2 | 2 |
| Syro | 3 | 3 | 3 |
| Hanami-API | 5 | 5 | 5 |
| Sinatra | 6 | 6 | 6 |
| Rails | 7 | 6 | 6 |

## Conclusion

These numbers are just a small reference, **Lennarb** is not a framework, it is a router. In my opinion, **Roda** is the best router for Ruby because it has many interesting features, such as a middleware manager, and very good development performance.

0 comments on commit 59a540e

Please sign in to comment.