Git Product home page Git Product logo

go-short-url's Introduction

短链接跳转系统

构建 & 运行

运行时需要讲config.toml与二进制包放在同一目录下并按照需要进行配置

# 运行
$ ./dev/run.sh
# 发布
$ .scripts/build.sh
$ ./release/linux/short-url

设计要点

  • 通过 Memo 模块防止并发时对数据库并发请求
  • 通过 Cache 对跳转信息进行缓存
  • 通过 statics 先将统计信息存入内存变量再定时同步到 Redis 与 MySQL 降低统计压力
  • 每日持久化 Redis 统计数据到数据库便于后期分析
  • 通过 cookie 记录用户是否访问过该短链(降低系统复杂度)

性能:在阿里云 4C8G 机器上,可以达到 5w QPS

功能

  • 短链接跳转
  • 可选 PV/UV 记录
  • 可选 AccessLog 记录
  • 跳转带上时间戳
  • 指定短链接域名
  • 修改重定向地址
  • 通过 API 生成短链接
  • API 生成短链接域名白名单
  • 活动管理与密钥生成
  • 聚合 PV/UV 到对应的活动(按活动 ID 算 UV)
  • 活动有效期配置与活动关闭
  • 根据活动生成短链接
  • 实时访问记录
  • 访问信息图表功能

go-short-url's People

Contributors

yourtion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-short-url's Issues

萌新关于缓存模块的疑问

作者大大你好,本人是一名自学golang的小白学生,想请教一下作者大大项目里有关mysql优化和redis缓存您的处理思路是什么,有关这些思路有一些系统的好的文章或书籍推荐吗?如果作者大大能不吝赐教,小弟心中无比感谢。

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.