{"id":29631106,"url":"https://github.com/llllllxy/tiny-id","last_synced_at":"2026-05-09T09:02:19.505Z","repository":{"id":236456732,"uuid":"792649013","full_name":"llllllxy/tiny-id","owner":"llllllxy","description":"一个轻量、灵活、高性能的分布式 ID 生成器系统","archived":false,"fork":false,"pushed_at":"2025-01-09T06:42:06.000Z","size":2936,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-09T07:46:34.688Z","etag":null,"topics":["id","idgenerator","mysql","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/llllllxy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-27T07:00:08.000Z","updated_at":"2025-01-09T06:42:09.000Z","dependencies_parsed_at":"2024-04-27T08:21:10.855Z","dependency_job_id":"ca3b6616-13a6-40ed-a896-fa3116f2bd7c","html_url":"https://github.com/llllllxy/tiny-id","commit_stats":null,"previous_names":["llllllxy/tiny-id"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/llllllxy/tiny-id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llllllxy%2Ftiny-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llllllxy%2Ftiny-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llllllxy%2Ftiny-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llllllxy%2Ftiny-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/llllllxy","download_url":"https://codeload.github.com/llllllxy/tiny-id/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llllllxy%2Ftiny-id/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266287824,"owners_count":23905461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["id","idgenerator","mysql","spring-boot"],"created_at":"2025-07-21T11:08:12.046Z","updated_at":"2026-05-09T09:02:19.493Z","avatar_url":"https://github.com/llllllxy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiny ID\n# 一个轻量、灵活、高性能的分布式 ID 生成器系统\n\n![Java](https://img.shields.io/badge/java-17-green.svg?style=flat-square)\n![SpringBoot](https://img.shields.io/badge/springboot-3.1.12-green.svg?style=flat-square)\n\u003ca href=\"https://github.com/llllllxy/tiny-id/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/llllllxy/tiny-id?style=flat-square\u0026logo=GitHub\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/llllllxy/tiny-id/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/llllllxy/tiny-id?style=flat-square\u0026logo=GitHub\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/llllllxy/tiny-id/watchers\"\u003e\u003cimg src=\"https://img.shields.io/github/watchers/llllllxy/tiny-id?style=flat-square\u0026logo=GitHub\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/llllllxy/tiny-id/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/llllllxy/tiny-id.svg?style=flat-square\u0026logo=GitHub\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/llllllxy/tiny-id/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/llllllxy/tiny-id.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href='https://gitee.com/leisureLXY/tiny-id/stargazers'\u003e\u003cimg src='https://gitee.com/leisureLXY/tiny-id/badge/star.svg?theme=dark' alt='star'\u003e\u003c/img\u003e\u003c/a\u003e\n\u003ca href='https://gitee.com/leisureLXY/tiny-id/members'\u003e\u003cimg src='https://gitee.com/leisureLXY/tiny-id/badge/fork.svg?theme=dark' alt='fork'\u003e\u003c/img\u003e\u003c/a\u003e\n\n## 简介 \nTiny ID 是一个基于SpringBoot+MySQL的轻量级、灵活、高性能的分布式ID生成器系统。\n\n- Java语言开发，天然具有跨平台的优点。\n- 架构简单，仅依赖于Java和MySQL数据库。\n- 支持集群环境分布式部署，可部署多个节点。\n- 同时支持 `数据库号段` 和 `snowflake雪花算法` 两种生成模式，可自由根据需求进行选择。\n- `snowflake雪花算法` 模式，支持服务启动时自动分配数据中心ID和机器ID，无需手动配置。\n- 通过http方式访问生成id，简洁灵活，方便业务系统接入。\n- 提供控制台管理功能，支持数据监控、雪花ID节点查看，流水号管理等功能，界面操作友好。\n\n## 架构\n![架构图](src/main/resources/static/images/readme/架构图.png)\n\n## 性能\n测试环境：windows 4核心、16G内存\n\n1. 数据库号段模式\n在将步长(step)设置成100时，使用 `Apache JMeter (5.5)` 进行压测，吞吐量可达 12000/sec 以上。原理上号段步长(step)设置的越长，则生成性能越高。\n\n2. snowflake雪花算法模式\n使用 `Apache JMeter (5.5)` 进行压测，吞吐量可达 15000/sec 以上。\n\n\n## 调用方式\n\n1. 数据库号段模式调用\n\n| 请求地址                | 请求方式           |  输入参数  |  返回结果 |\n|-------------------|--------------|--------------|--------------|\n| /api/segment/get/{idCode}  | GET 或 POST         |  idCode为流水号唯一标识  |  返回示例：{\"code\": 0, \"msg\": \"获取成功！\",\"data\": \"QB_2024_000000001\"}   |\n| /api/segment/batch/{idCode}/{batchSize}   | GET 或 POST   |   idCode为流水号唯一标识，batchSize为批量大小  |  返回示例：{\"code\": 0, \"msg\": \"获取成功！\",\"data\": [\"QB_2024_000000001\", \"QB_2024_000000002\"]}    |\n\n\n2. snowflake雪花算法模式调用\n\n| 请求地址                | 请求方式           |  输入参数  |  返回结果 |\n|-------------------|--------------|--------------|--------------|\n| /api/snowflake/get  | GET 或 POST |   无 |  返回示例：{\"code\": 0, \"msg\": \"获取成功！\",\"data\": 1763100524001140738}    |\n| /api/snowflake/batch/{batchSize}  | GET 或 POST |  batchSize为批量大小   |   返回示例：{\"code\": 0, \"msg\": \"获取成功！\",\"data\": [1763100524001140738, 1763453297234317313]}  |\n\n## 主要技术选型\n\n1、后端：\n- Java 17\n- SpringBoot 3.1.12\n\n2、前端：\n- Layui 2.8.11\n- jQuery 2.1.4\n\n## 运行环境\n- Jdk17\n- MySQL5.6+\n\n## 运行启动教程\n1. 新建`MySQL`数据库并导入`resources/init`文件夹下的数据库初始化脚本\n2. 修改配置文件中`application.yml`中数据库连接信息\n3. 运行启动类`TinyIdApplication`，即可正常启动项目\n4. 管理后台登录地址：`http://localhost:9999`  初始账户密码 `admin / 123456`\n\n## 控制台功能\n1、仪表盘\n- 查看当前系统内雪花ID节点数量和流水号数量\n- 查看流水号访问量Top25\n\n2、雪花ID节点\n- 查看当前系统内所有雪花ID节点信息列表，包括节点IP、节点端口、数据中心ID、机器ID、创建时间、刷新时间等信息\n- 支持根据节点IP模糊查询\n\n3、流水号管理\n- 查看当前系统内所有流水号信息列表\n- 在线新增流水号、修改流水号、删除流水号、流水号包括以下属性：\n    - 流水号标识编码：流水号唯一标识编码，只能由英文、数字和下划线组成，通过http调用时需传递此参数\n    - 流水号名称：流水号的名称\n    - 流水号步长：号段的步长，即每次预生成的ID数量\n    - 流水号长度：流水号的总字符个数\n    - 流水号前缀：拼接在流水号前的内容，如 QQ_00000001，QQ_00000002\n    - 流水号后缀：拼接在流水号后的内容，如 00000001_QQ，00000002_QQ\n      - 额外说明：\n        - 前缀和后缀支持时间格式替换，如下所示（示例，前缀为 ID_[yyyy]_，则生成的ID会是ID_2024_00000001这种形式的）\n        - 假设当前时间为2024年2月25日3时11分23秒，如果前缀或后缀包含下列字符串\n        - [yyyy]：生成的流水号将该字符串替换为2024\n        - [yy]：生成的流水号将该字符串替换为24\n        - [MM]：生成的流水号将该字符串替换为02\n        - [dd]：生成的流水号将该字符串替换为25\n        - [HH]：生成的流水号将该字符串替换为03\n        - [mm]：生成的流水号将该字符串替换为11\n        - [ss]：生成的流水号将该字符串替换为23\n\n\n## 控制台功能界面展示\n登录\n![登录](src/main/resources/static/images/readme/登录.png)\n\n首页\n![首页](src/main/resources/static/images/readme/首页.png)\n\n仪表盘\n![仪表盘](src/main/resources/static/images/readme/仪表盘.png)\n\n雪花ID节点\n![雪花ID节点](src/main/resources/static/images/readme/雪花ID节点.png)\n\n流水号管理\n![流水号管理](src/main/resources/static/images/readme/流水号管理.png)\n\n流水号管理-新增\n![流水号管理-新增](src/main/resources/static/images/readme/流水号管理-新增.png)\n\n流水号管理-编辑\n![流水号管理-编辑](src/main/resources/static/images/readme/流水号管理-编辑.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllllllxy%2Ftiny-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllllllxy%2Ftiny-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllllllxy%2Ftiny-id/lists"}