shawty

command module
v0.0.0-...-e7eb364 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 8 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package handlers provides HTTP request handlers.
Package handlers provides HTTP request handlers.
Package storages allows multiple implementation on how to store short URLs.
Package storages allows multiple implementation on how to store short URLs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL