Benchmarks
These benchmarks were done locally on my Ryzen 7 mini PC using wrk (I edited /etc/hosts to point the domains to my local IP):
Reads/sec:
$ wrk -t24 -c800 -d30s http://3iq.uk/NF Running 30s test @ http://3iq.uk/NF 24 threads and 800 connections Thread Stats Avg Stdev Max +/- Stdev Latency 5.78ms 7.92ms 115.55ms 88.49% Req/Sec 9.16k 2.38k 59.88k 74.38% 6589850 requests in 30.10s, 22.01GB read Requests/sec: 218947.38 Transfer/sec: 748.98MBWrites/sec:
$ wrk -t24 -c800 -d30s -spost.lua http://system.3iq.uk/submit Running 30s test @ http://system.3iq.uk/submit 24 threads and 800 connections Thread Stats Avg Stdev Max +/- Stdev Latency 38.25ms 35.23ms 293.85ms 51.33% Req/Sec 1.00k 142.66 2.10k 70.68% 718570 requests in 30.07s, 102.65MB read Requests/sec: 23896.89 Transfer/sec: 3.41MB
The VPS that I'm using to host this service though only has a few vcores so will not provide anywhere near that much reads/writes per second.
Memory usage
Without any URLs stored it uses around 180 mibibytes of memory:
Number of temporary URLs: 0 Number of permanent URLs: 10 Memory usage (from systemctl status): 175.5M Actual memory usage (from ps -o rss) (in mibibytes): 178.3M
With 1 million temporary URLs stored (temporary URLs use up more memory than permanent URLs because there is an expiry time associated, plus a copy of the key and expiry time are placed on a priority queue so they can be efficiently removed when they expire):
Number of temporary URLs: 1000642 Number of permanent URLs: 0 Memory usage (from systemctl status): 2.2G Actual memory usage (from ps -o rss) (in mibibytes): 402.2M
Misc
- For this URL shortener I designed and implemented BASE53A, a scheme for generating user-friendly short URLs by remapping (e.g. O is remapped to 0) or exclusion (e.g. both W and VV are excluded) of visually ambiguous characters and pairs, along with a single-character checksum (similar to the ISBN-10 checksum) which I have mathematically proved detects all single-character typos and adjacent transpositions. See my proof and source code here: 1f604.com/checksum
Where is it???
You can find the URL shortener here.Future todo list
- Add a pastebin service
- Automated backups to Cloudflare R2
- Add email verification (not sure if this would actually be useful though)
- Multiple CAPTCHAs to annoy users more
- Investigate SQLite performance compared to log-structured data storage
Click here to go to my home page