lander/README.md

47 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2022-11-16 13:05:09 +01:00
# Lander
2023-11-19 13:25:09 +01:00
Lander is an HTTP/1.1 server that acts as a URL shortener, pastebin and
file-sharing service. It's written from the ground up in C, complete with an
HTTP framework built on top of an event loop implementation based on [Build
Your Own Redis with C/C++](https://build-your-own.org/redis/). Lookup of
entries is done using an in-memory trie data structure, and on-disk storage
uses a custom binary database format.
The codebase uses one thirdparty library, namely
[picohttpparser](https://github.com/h2o/picohttpparser) for parsing HTTP
requests.
2022-11-16 13:05:09 +01:00
## The idea
A URL shortener has always been on my list of things I'd like to write myself.
It's simple, yet useful.
for our Algorithms & Datastructures 3 class, we had to implement three
different tries (Patricia trie, ternary trie, and a custom one). Considering
these are efficient string-based search trees, this gave me the idea to use it
as the backend for a URL shortener!
## The name
I gave up giving my projects original names a long time ago, so now I just use
the names of my friends ;p
2023-05-31 20:39:06 +02:00
## Benchmarking
I benchmark this tool using the [`wrk2`](https://github.com/giltene/wrk2)
utility. I've provided two Lua scripts to aid with this. To bench publishing
redirects, use the following:
```sh
wrk2 -s bench/post.lua -t 10 -R 10k -d30s -c32 http://localhost:18080
```
And to bench GET requests:
```sh
wrk2 -s bench/get.lua -t 10 -R 25k -d30s -c32 http://localhost:18080
```
Of course you're free to change the parameters, but the provided Lua files
generate URLs that can be used in the benchmark.