• Stars
    star
    307
  • Rank 136,109 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Smallest URL shortener in Go

GoDoc license

Shawty: URL Shortener Service

This service encodes URL in base-36 and store them in filesystem.

It has 3 features: shorten, unshorten, and redirect.

Can I use it in production?

You need to implement a storage that can scale beyond one application server.

Why?

By itself, URL shortening is quite useful.

But this project exists to demonstrate:

  • How concise Go is. cloc shows that this project contains only 125 lines.

  • How slim Go is: 3MB RAM.

  • How comprehensive Go standard library is.

  • How easy it is to get up and running in Go. It took me about 1 hour from start to finish. Writing this README file took longer time.

  • How performant Go is:

    # Command  : ab -n 100000 -c 200 -k http://localhost:8080/dec/1
    # Processor: 2.26 GHz Intel Core 2 Duo  <-- Crummy 6 years old laptop
    
    Concurrency Level:      200
    Time taken for tests:   8.610 seconds
    Complete requests:      100000
    Failed requests:        0
    Non-2xx responses:      100000
    Keep-Alive requests:    100000
    Total transferred:      22400000 bytes
    HTML transferred:       7600000 bytes
    Requests per second:    11614.80 [#/sec] (mean)
    Time per request:       17.219 [ms] (mean)
    Time per request:       0.086 [ms] (mean, across all concurrent requests)
    Transfer rate:          2540.74 [Kbytes/sec] received
    

My other Go libraries

  • Tollbooth: Simple middleware to rate-limit HTTP requests.

  • Gomet: Simple HTTP client & server long poll library for Go. Useful for receiving live updates without needing Websocket.

  • Stopwatch: A small library to measure latency of things. Useful if you want to report latency data to Graphite.

  • LaborUnion: A dynamic worker pool library.

More Repositories

1

tollbooth

Simple middleware to rate-limit HTTP requests.
Go
2,580
star
2

bayes_on_redis

Bayesian classifier on top of Redis
Python
63
star
3

tollbooth_gin

Tollbooth - Gin integration layer
Go
57
star
4

beaker_extensions

Extending beaker (cache & session module) to use No SQL backend.
Python
34
star
5

stopwatch

A small library to measure latency of things.
Go
31
star
6

laborunion

Dynamic Worker Pool Library
Go
27
star
7

gomet

Simple HTTP client & server long poll library for Go
Go
25
star
8

tollbooth_echo

Tollbooth - Echo integration layer
Go
23
star
9

tornado_api

Collection of web service libraries for Tornado web framework
Python
20
star
10

tollbooth_chi

Tollbooth - Chi integration layer
Go
12
star
11

tornado-stripe

Tornado client library for accessing Stripe API
Python
11
star
12

errstack

A very small library to combine errors
Go
9
star
13

tollbooth_fasthttp

Tollbooth - Fasthttp integration layer
Go
6
star
14

.js

Didip's dotjs files
JavaScript
5
star
15

tollbooth_iris

Tollbooth - Iris integration layer
Go
3
star
16

tcsv

Simpler, streamable, more compact, easier to read, gzip friendlier than JSON. Hopefully...
3
star
17

go-urldownloader

Small HTTP daemon that downloads URL content and reupload to S3
Go
3
star
18

mcrouter-hub

An HTTP companion to Facebook's McRouter
Go
3
star
19

jazz

What if you can handle HTTP requests in Javascript in Go?
Go
3
star
20

tollbooth_negroni

Tollbooth - Negroni integration layer
Go
2
star
21

go-nanomsg-examples

Examples on how to use nanomsg in Go language
Go
2
star
22

gravatar-python

Simple Gravatar client library
Python
2
star
23

jquery.html.encode.decode

JQuery plugin for HTML encoding and decoding
JavaScript
2
star
24

tollbooth_httprouter

Tollbooth - HTTPRouter integration layer
Go
2
star
25

jquery.scroll

Cross Browser scrollX, scrollY, scrollMaxX, scrollMaxY
JavaScript
2
star
26

mcrouter-util

Collections of things to make mcrouter easier.
C++
1
star
27

didip.github.io

Didip Blog
HTML
1
star
28

supervisor_remote_logging

Emits supervisor logs to various remote endpoints.
Python
1
star