Git Product home page Git Product logo

go-link-shortener's Introduction

go-link-shortener

A basic link shortening service written in go. Please consider as a work-in-progress.

How-To

  1. Edit the config.json file
  2. Run ./go-link-shortener -config=/path/to/your/config
  3. 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://)
  4. Use the returned address

A more permanent installation

If you want to run it as a service, install_or_update.sh will set up everything in a nice systemd service. Worry free!

  1. Clone the project
  2. cd go-link-shortener
  3. sudo ./install_or_update.sh

UI

There is a minimalist UI to quickly minify links served at /ui

ui

You can test the demo at https://belv.al/ui

Benchmarks

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.

Requirements

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.