All Projects → rpcxio → Did

rpcxio / Did

Licence: mit
高性能的ID生成器, 基于rpcx和Memcached协议提供网络服务调用

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Did

Go Katsubushi
ID generator server
Stars: ✭ 118 (-1.67%)
Mutual labels:  snowflake, memcached
Gosnowflake
Go Snowflake Driver
Stars: ✭ 108 (-10%)
Mutual labels:  snowflake
Cucache
Fast PUT/GET/DELETE in-memory key-value store for lookaside caching
Stars: ✭ 63 (-47.5%)
Mutual labels:  memcached
Sonyflake Rs
🃏 A distributed unique ID generator inspired by Twitter's Snowflake.
Stars: ✭ 91 (-24.17%)
Mutual labels:  snowflake
Redissnowflake
Twitter's Snowflake based ID generation as a redis module
Stars: ✭ 66 (-45%)
Mutual labels:  snowflake
Snow Stamp
Get the timestamp from a Discord snowflake ❄
Stars: ✭ 95 (-20.83%)
Mutual labels:  snowflake
Finagle
A fault tolerant, protocol-agnostic RPC system
Stars: ✭ 8,126 (+6671.67%)
Mutual labels:  memcached
Snowflake
java edition of [Twitter Snowflake](https://github.com/twitter/snowflake), a network service for generating unique ID numbers at high scale with some simple guarantees.
Stars: ✭ 114 (-5%)
Mutual labels:  snowflake
Shade
Memcached client for Scala
Stars: ✭ 107 (-10.83%)
Mutual labels:  memcached
Node Cached
A simple caching library for node.js, inspired by the Play cache API
Stars: ✭ 85 (-29.17%)
Mutual labels:  memcached
Memcache Info
Simple and efficient way to show information about Memcache.
Stars: ✭ 84 (-30%)
Mutual labels:  memcached
Sql Runner
Run templatable playbooks of SQL scripts in series and parallel on Redshift, PostgreSQL, BigQuery and Snowflake
Stars: ✭ 68 (-43.33%)
Mutual labels:  snowflake
Fastapi Plugins
FastAPI framework plugins
Stars: ✭ 104 (-13.33%)
Mutual labels:  memcached
Php memcached dll
windows php-memcached dll files
Stars: ✭ 65 (-45.83%)
Mutual labels:  memcached
Memcached exporter
Exports metrics from memcached servers for consumption by Prometheus.
Stars: ✭ 109 (-9.17%)
Mutual labels:  memcached
Ansible Role Memcached
Ansible Role - Memcached
Stars: ✭ 54 (-55%)
Mutual labels:  memcached
Snowflake
A simple to use Go (golang) package to generate or parse Twitter snowflake IDs
Stars: ✭ 1,314 (+995%)
Mutual labels:  snowflake
Butterfly
🔥 蝴蝶--【简单】【稳定】【好用】的 Python web 框架🦋 除 Python 2.7,无其他依赖; 🦋 butterfly 是一个 RPC 风格 web 框架,同时也是微服务框架,自带消息队列通信机制实现分布式
Stars: ✭ 82 (-31.67%)
Mutual labels:  memcached
Id Generator
id-generator部署即使用的ID生成器, 支持HTTP、Dubbo、Spring Cloud方式.
Stars: ✭ 112 (-6.67%)
Mutual labels:  snowflake
Dogpile.cache
dogpile.cache is a Python caching API which provides a generic interface to caching backends of any variety
Stars: ✭ 106 (-11.67%)
Mutual labels:  memcached

分布式ID生成器服务

基于twitter snowflake的算法实现的ID生成器高性能的健壮的可容错的网络服务。

它提供了:

  • 可配置的节点bit数和最大序列数
  • 可以批量获取ID
  • 基于rpcx提供网络服务,可以提供一组服务节点
  • 基于rpcx,可以提供分布式的、容错的网络服务

snowflake算法的实现基于bwmarrin/snowflake, 额外提供了批量获取ID的方法。

例子

server

server 提供了一个简单的服务节点,你可以提供多个服务节点以便提供高可用性。

你还可以配置插件,使用ZooKeeper、Etcd、Consul、Nacos等作为注册中心,配置插件进行trace监控,设置黑白名单等操作,这些微服务的特性通过rpcx来实现。

client实现远程调用ID生成器的服务,这个例子采用服务地址硬编码的方式实现。如果你的服务使用了etcd、nacos等服务中心,你可以配置client使用注册中心自动获取服务节点。

客户端的例子演示了获取单个ID和获取批量ID的方法。

memcached 协议访问

除了使用 rpcx访问外,你还可以通过memcached协议获取id。

  • get id\r\n: 获取一个id
  • gets 100\r\n: 一次获取100个id

性能

单个节点每秒可以产生400万左右的ID。

BenchmarkGenerate-4                 	 4918761	       244 ns/op	   4097826 ids/s	     115 B/op	       1 allocs/op
BenchmarkGenerateBatch-4            	   49309	     24472 ns/op	   4086058 ids/s	   10811 B/op	     104 allocs/op
BenchmarkGenerate_Parallel-4        	 4903029	       244 ns/op	   4093939 ids/s	      88 B/op	       0 allocs/op
BenchmarkGenerateBatch_Parallel-4   	   49328	     24402 ns/op	   4097864 ids/s	   12904 B/op	     126 allocs/op

使用网络服务获取ID

1、256个client并发,每次只获取1个ID, ID的产生速度是 12万个ID/秒

./bclient -addr 10.41.15.225:8972 -n 100000
total IDs: 25600000, duration: 3m31.581592489s, id/s: 120993

2、如果采用批量获取,尽量减少网络消耗,256个client并发,每次只获取100个ID, ID的产生速度是 297万个ID/秒

./bclient -addr 10.41.15.225:8972 -n 1000000 -b 100
total IDs: 256000000, duration: 1m26.178942509s, id/s: 2970563
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].