SlideShare a Scribd company logo
1 of 43
Download to read offline
How to implement GUID With Python 
charsyam@naver.com
GUID?
Unique ID
When you need Unique ID?
User ID?
User ID? 
Service ID?
User ID? 
Service ID? 
Event ID?
Example
A Long Long Time Ago
Mac Address?
Device ID?
So, we need 
Unique ID!!!
UUID
Universally 
Unique ID
Universally 
Unique ID 
RFC 4122
550e8400-e20b-41d4-a716-446655440000
16 Octet (128bit)
SHA-1(MAC+Time)
BUT …
BUT … 
BUT …
BUT … 
BUT … 
BUT …
UUID is not good 
For Some Services
Why?
Too Big
Can’t order by 
Time
How to get these attributes!!
Research 
Just Google it.
MongoDB
Instagram
Twitter 
SnowFlake
MongoDB 
12 Bytes 
BSON Object
MongoDB
Instagram 
64 bits
Instagram
Instagram 
Logical Shard 
Physical Shard
Slowflake 
64 bits
Snowflake
Snowflake 
Zookeeper
Python-Guoid 
import guoid guid = guoid.SnowFlake(datacenter_id, worker_id) guid.next()
Python-Guoid 
https://github.com/charsyam/python-guoid
Python-Guoid 
Not service 
Just Library
Python-Guoid 
How to get 
Datacenter_id 
Worker_id
Thank you!

More Related Content

Similar to Implement GUID Generation in Python Using Snowflake Algorithm

Puppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops RollsPuppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops RollsPuppet
 
20161215 python pandas-spark四方山話
20161215 python pandas-spark四方山話20161215 python pandas-spark四方山話
20161215 python pandas-spark四方山話Ryuji Tamagawa
 
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015curryon
 
OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition] OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition] Jose Manuel Ortega Candel
 
Road to Republic of IoT - ESP32 Programming and LoRa
Road to Republic of IoT - ESP32 Programming and LoRaRoad to Republic of IoT - ESP32 Programming and LoRa
Road to Republic of IoT - ESP32 Programming and LoRaAndri Yadi
 
Eclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura
 
Mozilla chirimen firefox os dwika v5
Mozilla chirimen firefox os dwika v5Mozilla chirimen firefox os dwika v5
Mozilla chirimen firefox os dwika v5Dwika Sudrajat
 
The internet of (lego) trains
The internet of (lego) trainsThe internet of (lego) trains
The internet of (lego) trainsGrzegorz Duda
 
How to build Open Hardware self-navigating car robot
How to build Open Hardware self-navigating car robotHow to build Open Hardware self-navigating car robot
How to build Open Hardware self-navigating car robotTomáš Jukin
 
iShelf - Inventory management project
iShelf - Inventory management projectiShelf - Inventory management project
iShelf - Inventory management projectFrancescoCassini
 
[Hack.Hydrosphere] Project TIDE
[Hack.Hydrosphere] Project TIDE[Hack.Hydrosphere] Project TIDE
[Hack.Hydrosphere] Project TIDEBulat Lutfullin
 
kinect-based teleoperation of a humanoid robot
kinect-based teleoperation of a humanoid robotkinect-based teleoperation of a humanoid robot
kinect-based teleoperation of a humanoid robothuthayfarabei
 
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...Richard Rowland
 
解密解密
解密解密解密解密
解密解密Tom Chen
 
OSINT tools for security auditing with python
OSINT tools for security auditing with pythonOSINT tools for security auditing with python
OSINT tools for security auditing with pythonJose Manuel Ortega Candel
 
2010 coscup be_android
2010 coscup be_android2010 coscup be_android
2010 coscup be_androidtick
 
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backendAPIsecure_ Official
 
Nagios Conference 2012 - Robert Bolton - Custom SNMP OID Creation
Nagios Conference 2012 - Robert Bolton - Custom SNMP OID CreationNagios Conference 2012 - Robert Bolton - Custom SNMP OID Creation
Nagios Conference 2012 - Robert Bolton - Custom SNMP OID CreationNagios
 

Similar to Implement GUID Generation in Python Using Snowflake Algorithm (20)

Puppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops RollsPuppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops Rolls
 
20161215 python pandas-spark四方山話
20161215 python pandas-spark四方山話20161215 python pandas-spark四方山話
20161215 python pandas-spark四方山話
 
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
 
OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition] OSINT tools for security auditing [FOSDEM edition]
OSINT tools for security auditing [FOSDEM edition]
 
Road to Republic of IoT - ESP32 Programming and LoRa
Road to Republic of IoT - ESP32 Programming and LoRaRoad to Republic of IoT - ESP32 Programming and LoRa
Road to Republic of IoT - ESP32 Programming and LoRa
 
Eclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura Shoot a-pi
Eclipse Kura Shoot a-pi
 
Windows 10 IoT Core
Windows 10 IoT CoreWindows 10 IoT Core
Windows 10 IoT Core
 
Mozilla chirimen firefox os dwika v5
Mozilla chirimen firefox os dwika v5Mozilla chirimen firefox os dwika v5
Mozilla chirimen firefox os dwika v5
 
The internet of (lego) trains
The internet of (lego) trainsThe internet of (lego) trains
The internet of (lego) trains
 
How to build Open Hardware self-navigating car robot
How to build Open Hardware self-navigating car robotHow to build Open Hardware self-navigating car robot
How to build Open Hardware self-navigating car robot
 
iShelf - Inventory management project
iShelf - Inventory management projectiShelf - Inventory management project
iShelf - Inventory management project
 
Developing an Embedded IoT Solution using Mongoose OS.
Developing an Embedded IoT Solution using Mongoose OS.Developing an Embedded IoT Solution using Mongoose OS.
Developing an Embedded IoT Solution using Mongoose OS.
 
[Hack.Hydrosphere] Project TIDE
[Hack.Hydrosphere] Project TIDE[Hack.Hydrosphere] Project TIDE
[Hack.Hydrosphere] Project TIDE
 
kinect-based teleoperation of a humanoid robot
kinect-based teleoperation of a humanoid robotkinect-based teleoperation of a humanoid robot
kinect-based teleoperation of a humanoid robot
 
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
Why "Hello World" is a Massive Operation - From Python code to Stack Virtual ...
 
解密解密
解密解密解密解密
解密解密
 
OSINT tools for security auditing with python
OSINT tools for security auditing with pythonOSINT tools for security auditing with python
OSINT tools for security auditing with python
 
2010 coscup be_android
2010 coscup be_android2010 coscup be_android
2010 coscup be_android
 
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
 
Nagios Conference 2012 - Robert Bolton - Custom SNMP OID Creation
Nagios Conference 2012 - Robert Bolton - Custom SNMP OID CreationNagios Conference 2012 - Robert Bolton - Custom SNMP OID Creation
Nagios Conference 2012 - Robert Bolton - Custom SNMP OID Creation
 

More from DaeMyung Kang

How to use redis well
How to use redis wellHow to use redis well
How to use redis wellDaeMyung Kang
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashingDaeMyung Kang
 
How to name a cache key
How to name a cache keyHow to name a cache key
How to name a cache keyDaeMyung Kang
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash DaeMyung Kang
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advanceDaeMyung Kang
 
Massive service basic
Massive service basicMassive service basic
Massive service basicDaeMyung Kang
 
Data Engineering 101
Data Engineering 101Data Engineering 101
Data Engineering 101DaeMyung Kang
 
How To Become Better Engineer
How To Become Better EngineerHow To Become Better Engineer
How To Become Better EngineerDaeMyung Kang
 
Kafka timestamp offset_final
Kafka timestamp offset_finalKafka timestamp offset_final
Kafka timestamp offset_finalDaeMyung Kang
 
Kafka timestamp offset
Kafka timestamp offsetKafka timestamp offset
Kafka timestamp offsetDaeMyung Kang
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lakeDaeMyung Kang
 
webservice scaling for newbie
webservice scaling for newbiewebservice scaling for newbie
webservice scaling for newbieDaeMyung Kang
 

More from DaeMyung Kang (20)

Count min sketch
Count min sketchCount min sketch
Count min sketch
 
Redis
RedisRedis
Redis
 
Ansible
AnsibleAnsible
Ansible
 
Why GUID is needed
Why GUID is neededWhy GUID is needed
Why GUID is needed
 
How to use redis well
How to use redis wellHow to use redis well
How to use redis well
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashing
 
How to name a cache key
How to name a cache keyHow to name a cache key
How to name a cache key
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advance
 
Massive service basic
Massive service basicMassive service basic
Massive service basic
 
Data Engineering 101
Data Engineering 101Data Engineering 101
Data Engineering 101
 
How To Become Better Engineer
How To Become Better EngineerHow To Become Better Engineer
How To Become Better Engineer
 
Kafka timestamp offset_final
Kafka timestamp offset_finalKafka timestamp offset_final
Kafka timestamp offset_final
 
Kafka timestamp offset
Kafka timestamp offsetKafka timestamp offset
Kafka timestamp offset
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lake
 
Redis acl
Redis aclRedis acl
Redis acl
 
Coffee store
Coffee storeCoffee store
Coffee store
 
Scalable webservice
Scalable webserviceScalable webservice
Scalable webservice
 
Number system
Number systemNumber system
Number system
 
webservice scaling for newbie
webservice scaling for newbiewebservice scaling for newbie
webservice scaling for newbie
 

Implement GUID Generation in Python Using Snowflake Algorithm