SkillAgentSearch skills...

Pysnowflake

Twitter Snowflake Server implemented in Python and Tornado for HTTP based ID generation

Install / Use

/learn @koblas/Pysnowflake
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

pysnowflake

pysnowflake is a Python implementation of Twitter's snowflake service - https://github.com/twitter/snowflake

This is based on the pysnowflak python trift service that Erans did - https://github.com/erans/pysnowflake

Our use case wasn't thrift oriented but HTTP based, so this is a service that runs under the Tornado web framework. Which makes it possible to only have one depenancy (tornado).

Due to various reasons this implementation does not reach the performance indicated in the original Snowflake implementation, however it is good enough in most cases and can be combined with the help of a software load balancer such as HAProxy to run multiple processes to get higher performance.

Installation

  • Install Tornado
  • Run the service

Usage

usage: pysnowflake.py [--debug] [--port=9000] [--datacenter=DC_ID] [--worker=WORKER_ID]

Python based Snowflake server over HTTP

See the original snowflake server docs for a detailed description, but the bottom line is unique numbers will insure unique identifers generated. WORKER_ID is the identifier for this process DATACENTER_ID is the identifier for this datacenter

API (aka URLs):

/id/<USERAGENT>    -- get a unique ID, <USERAGENT> is provided for metrics purposes
/timestamp/        -- get the current timestamp for this host
/datacenter/       -- get the data center identifier for this process
/worker/           -- get the data center identifier for this process

Issues

Please report any issues via github issues

Related Skills

View on GitHub
GitHub Stars25
CategoryDevelopment
Updated4mo ago
Forks9

Languages

Python

Security Score

72/100

Audited on Nov 4, 2025

No findings