All Projects → intenthq → Icicle

intenthq / Icicle

Licence: mit
A distributed, k-sortable unique ID generation system using Redis and Lua.

Programming Languages

java
68154 projects - #9 most used programming language
scala
5932 projects
lua
6591 projects

Labels

Projects that are alternatives of or similar to Icicle

Redisearch Php
PHP client library for RediSearch.
Stars: ✭ 154 (-3.14%)
Mutual labels:  redis
Nodebb
Node.js based forum software built for the modern web
Stars: ✭ 12,303 (+7637.74%)
Mutual labels:  redis
Netease Cloud Music Community
参照网易云音乐云村做的一个小程序社区,后端技术栈为Java,SpringBoot,MySQL,Redis,前端技术栈为uni-app。欢迎吐槽。
Stars: ✭ 157 (-1.26%)
Mutual labels:  redis
Scriptspider
一个java版本的分布式的通用爬虫,可以插拔各个组件(提供默认的)
Stars: ✭ 155 (-2.52%)
Mutual labels:  redis
Enqueue Dev
Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
Stars: ✭ 1,977 (+1143.4%)
Mutual labels:  redis
Packages
Enhances Composer Satis with webhook integrations to GitHub and GitLab
Stars: ✭ 157 (-1.26%)
Mutual labels:  redis
Jusic Serve
一起听歌吧(同步点歌听歌),多房间版本也已开源
Stars: ✭ 153 (-3.77%)
Mutual labels:  redis
Study
全栈工程师学习笔记;Spring登录、shiro登录、CAS单点登录和Spring boot oauth2单点登录;Spring data cache 缓存,支持Redis和EHcahce; web安全,常见web安全漏洞以及解决思路;常规组件,比如redis、mq等;quartz定时任务,支持持久化数据库,动态维护启动暂停关闭;docker基本用法,常用image镜像使用,Docker-MySQL、docker-Postgres、Docker-nginx、Docker-nexus、Docker-Redis、Docker-RabbitMQ、Docker-zookeeper、Docker-es、Docker-zipkin、Docker-ELK等;mybatis实践、spring实践、spring boot实践等常用集成;基于redis的分布式锁;基于shared-jdbc的分库分表,支持原生jdbc和Spring Boot Mybatis
Stars: ✭ 159 (+0%)
Mutual labels:  redis
Oneinstack
OneinStack - A PHP/JAVA Deployment Tool
Stars: ✭ 1,983 (+1147.17%)
Mutual labels:  redis
Redis Cuckoofilter
Hashing-function agnostic Cuckoo filters for Redis
Stars: ✭ 158 (-0.63%)
Mutual labels:  redis
Spring Boot Vue Bank
我,请始皇[打钱]是一个前后端分离的工具人系统,项目采用 SpringBoot+Go+Vue 开发,项目加入常见的企业级应用所涉及到的技术点,例如 Redis、RabbitMQ 等(主要是多用用工具多踩踩坑)。
Stars: ✭ 157 (-1.26%)
Mutual labels:  redis
Springboot
用springboot + springmvc + mybatis + maven搭建成框架,基于Jersey, Swagger,SwaggerUi的restful API
Stars: ✭ 157 (-1.26%)
Mutual labels:  redis
Portara
Portara directive is a rate limiter / throttler for GraphQL
Stars: ✭ 158 (-0.63%)
Mutual labels:  redis
Modernarchitectureshop
The Microservices Online Shop is an application with a modern software architecture that is cleanly designed and based on.NET lightweight technologies. The shop has two build variations. The first variant is the classic Microservices Architectural Style. The second one is with Dapr. Dapr has a comprehensive infrastructure for building highly decoupled Microservices; for this reason, I am using Dapr to achieve the noble goal of building a highly scalable application with clean architecture and clean code.
Stars: ✭ 154 (-3.14%)
Mutual labels:  redis
Easy
开源的Java开发脚手架,工作经验总结,springboot,springcloud,基于tk-mybatis代码反向生成,基于redis(redisson)注解形式加分布式锁等,计划将用该脚手架抄袭jeesite和ruoyi还有基于vue的后台权限管理系统做一套开源的后台管理和cms系统,域名服务器已买好,脚手架还在继续更新中,更新完毕开始更新easysite
Stars: ✭ 160 (+0.63%)
Mutual labels:  redis
Fastapi Celery
Minimal example utilizing fastapi and celery with RabbitMQ for task queue, Redis for celery backend and flower for monitoring the celery tasks.
Stars: ✭ 154 (-3.14%)
Mutual labels:  redis
Codis
Proxy based Redis cluster solution supporting pipeline and scaling dynamically
Stars: ✭ 12,285 (+7626.42%)
Mutual labels:  redis
Zkudid
Generate and save permanent UDID with IDFV and keychain in iOS device.
Stars: ✭ 159 (+0%)
Mutual labels:  uuid
Spring Boot Examples
个人学习 SpringBoot2.x 写的一些示例程序,目前正在持续更新中.....
Stars: ✭ 159 (+0%)
Mutual labels:  redis
Nginx
NGINX Accelerated! This is a Docker image that creates a high performance (FAST!), optimized image for NGINX for use with Redis and PHP-FMP. Deliver sites and applications with performance, reliability, security, and scale. This NGINX server offers advanced performance, web and mobile acceleration, security controls, application monitoring, and management.
Stars: ✭ 157 (-1.26%)
Mutual labels:  redis

Icicle Build Status Join the chat at https://gitter.im/intenthq/icicle

A distributed, k-sortable unique ID generation system using Redis and Lua.

Icicle is a project to generate 64-bit, k-sortable unique IDs in a distributed fashion by using Redis' Lua scripting.

Implementations of Icicle could be written in any language using just a Redis client library and the Lua script.

Read more about Icicle on the Intent HQ Engineering blog.

Icicle v1.x users: There are some important breaking changes in v2.x! Please read the release notes for more information.

Using Icicle

Setup Your Redis Nodes

You need to have some Redis nodes available and running to use with Icicle. Icicle works on Redis >= v2.6 as it requires Lua support. Redis 3.x is supported and tested. We recommend running at least 2 Redis nodes, allowing for redundancy and better performance.

Once you have the Redis servers up and running, you must assign a logical shard ID to each Redis instance. This is a unique number between 0 and 1023 (inclusive) that is assigned to each node to prevent duplicate IDs:

SET icicle-generator-logical-shard-id 123

Make sure this is unique per node, or you run the risk you will generate duplicate IDs. Icicle will otherwise report an error to you if you set the ID too small or too large.

Configure NTP

To keep your system clock in check, you should install and configure NTP on every Redis node server. You need to run NTP in a mode where it won't move the clock backwards, as Icicle will not guarantee an ID won't be duplicated it does this. See this Stack Overflow post for more information on the behaviour of NTP.

Use The Client Library

With Jedis

A pre-rolled icicle-jedis library is available and using it is really simple. Create yourself an instance of the IcicleIdGenerator class, passing the

JedisIcicle redisServerOne = new JedisIcicle("server-one:6379");
JedisIcicle redisServerTwo = new JedisIcicle("server-two:6379");
JedisIcicle redisServerThree = new JedisIcicle("server-three:6379");
List<JedisIcicle> redises = Arrays.asList(redisServerOne, redisServerTwo, redisServerThree);

RoundRobinRedisPool roundRobinRedisPool = new RoundRobinRedisPool(redises);
IcicleIdGenerator icicleIdGenerator = new IcicleIdGenerator(roundRobinRedisPool);

And now to generate an ID:

Optional<Id> id = icicleIdGenerator.generateId();

Or a batch of IDs;

Optional<List<Id>> ids = icicleIdGenerator.generateIdBatch(10); // Get up to 10 IDs
Optional<List<Id>> ids = icicleIdGenerator.generateIdBatch(); // Get up to 4096 IDs

When requesting a batch of IDs, the generator cannot always return you the amount you asked for (this is a limitation related to our strong uniqueness guarantees) - instead, it will return between 1 and n, where n is the number of IDs you asked for in the batch. You may wish to check how many you actually received, and request more until you have the total you need.

With Another Redis Library

You can use Icicle with any Redis library you please. All you have to do is implement the Redis interface, and you can then use the RoundRobinRedisPool and IcicleIdGenerator classes as above with icicle-jedis.

Structure

We chose to pack our IDs in a 64-bit long, structured as follows:

The ID structure, in the format ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCDDDDDDDDDDDD

  • The first bit is the reserved signed bit (which we chose not to use because some platforms make it difficult to get at and it messes with ordering).
  • Secondly, the timestamp in milliseconds since a custom epoch, 41 bits in total.
  • Next is the logical shard ID, 10 bits in total.
  • Finally, the sequence, 12 bits in total.

Kudos

The name of our project was inspired by a sadly now defunct project from Twitter called "Snowflake", from which we drew much inspiration.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].