A basic link shortening service written in go. Please consider as a work-in-progress.
- Edit the config.json file
- Run
./go-link-shortener -config=/path/to/your/config
- Shorten an url with
/api/v1/new/?url=[your.url.com]
- Don't forget to add & escape the https:// part if you really want it (otherwise it will default to http://)
- Use the returned address
If you want to run it as a service, install_or_update.sh
will set up everything in a nice systemd service. Worry free!
- Clone the project
- cd go-link-shortener
- sudo ./install_or_update.sh
There is a minimalist UI to quickly minify links served at /ui
You can test the demo at https://belv.al/ui
On a single vCore machine with 1GB of RAM and behind a Nginx proxy using SSL (so a real scenario).
Using the Apache benchmarking tool:
ab -n 1000 -c 50 https://belv.al/82dbd
(1000 requests, 50 concurrents):
Connection Times (ms)
min mean[+/-sd] median max
Connect: 71 297 41.2 292 460
Processing: 33 53 8.8 52 91
Waiting: 33 52 8.6 51 87
Total: 115 349 42.5 345 508
Percentage of the requests served within a certain time (ms)
50% 345
75% 373
100% 508 (longest request)
ab -n 500 -c 10 https://belv.al/82dbd
(500 requests, 10 concurrents):
Connection Times (ms)
min mean[+/-sd] median max
Connect: 63 89 10.8 88 138
Processing: 19 34 8.6 32 70
Waiting: 18 33 8.6 32 69
Total: 96 123 13.1 123 178
Percentage of the requests served within a certain time (ms)
50% 123
75% 131
100% 178 (longest request)
I ran tests without Nginx and timings were below 70ms so it's quite fast.