A fast, simple, and flexible URL shortener!
This project was created to benchmark different database providers on .NET 9.
This is a simple URL shortener that supports multiple databases like SQLite, PostgreSQL, MongoDB, and Redis. It also supports optional in-memory caching for extra performance.
Data store provider of your choice and in memory caching is configurable with various methods (appsettings.json, env variables, run command args).
Vertical slices are used to separate the different functionalities, making it easier to manage and extend the application.
This is not an ideal scenario for running load tests because the test runner itself used almost 70% of my machine's CPU, therefore bottlenecking the actual server and database performance capabilities.
It's recommended to run the load tests in a production-identical environment with distributed load testing clients.
CPU: Intel Core i3 Gen 3
RAM: 16 GB DDR3
| Provider | Caching | Request count | Request Rate(/s) | Avg(ms) | Min | Med(ms) | Max(s) | p(90)(ms) | p(95)(ms) |
|---|---|---|---|---|---|---|---|---|---|
| REDIS | - | 184036 | 1022.224157 | 186.22 | 990.5µs | 81.78 | 16.06 | 369.03 | 581.52 |
| REDIS | [x] | 338744 | 1881.802881 | 101.82 | 0s | 47.84 | 18.81 | 191.28 | 324.06 |
| MongoDB | - | 124354 | 691.067722 | 276.82 | 2.52ms | 229.53 | 7.51 | 559.79 | 632.68 |
| MongoDB | [x] | 564963 | 3141.443458 | 59.77 | 0s | 47.47 | 1.35 | 136.17 | 161.4 |
| SQLite | - | 148670 | 826.333448 | 231.32 | 1.51ms | 168.27 | 6.06 | 523.91 | 605.12 |
| SQLite | [x] | 510948 | 2840.007337 | 66.05 | 0s | 56.22 | 1.25 | 144.13 | 169.12 |
| Postgres | - | 69503 | 386.121974 | 498.18 | 3.52ms | 371.07 | 12.2 | 1.05s | 1.21s |
| Postgres | [x] | 482986 | 2684.005171 | 69.73 | 0s | 60.55 | 1.76 | 150.93 | 176.06 |