# shortener **Repository Path**: practical-code/shortener ## Basic Information - **Project Name**: shortener - **Description**: 基于 GO 的短链接服务 - **Primary Language**: Go - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-22 - **Last Updated**: 2026-07-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # shortener **[中文](https://gitee.com/lineCode-GO/shortener/blob/master/README.md)/[英文](https://gitee.com/lineCode-GO/shortener/blob/master/README.en.md)** #### 介绍 基于 GO 的短链接服务 #### 软件架构 ![软件架构图](https://easyimage.qsjob.fun/i/2025/05/23/swvefo.png) #### 安装教程 1. git clone https://gitee.com/lineCode-GO/shortener.git 2. go mod tidy 3. go run main.go #### 功能列表 1. 支持短链接生成 2. 支持短链接跳转 3. 支持短链接统计 4. 支持短链码唯一性 5. 支持短链码长度自定义 6. 支持短链访问统计 #### pprof 性能分析 1. 启动 pprof 服务 2. 访问 URL_ADDRESS2. 访问 http://localhost:9000/debug/pprof/ 3. 选择 profile 进行分析 * CPU分析(30秒采样): ```bash go tool pprof -http=:9000 URL_ADDRESSgo tool pprof -http=:9000 http://localhost:9000/debug/pprof/profile ``` * 内存分析: ```bash go tool pprof http://localhost:9000/debug/pprof/heap ``` * Goroutine分析: ```bash go tool pprof http://localhost:9000/debug/pprof/goroutine ``` * 压力测试时分析: ```bash wrk -t4 -c100 -d30s http://localhost:9000/ # 同时另开终端执行 watch -n 1 'go tool pprof -top http://localhost:9000/debug/pprof/heap' ``` * 生成分析文件: ```bash # 生成CPU profile curl -o cpu.prof http://localhost:9000/debug/pprof/profile # 生成内存profile curl -o mem.prof http://localhost:9000/debug/pprof/heap ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request