Home
Explore
Submit Search
Upload
Login
Signup
Advertisement
Count min sketch
Report
DaeMyung Kang
Follow
(Remote) Data Engineer at Udemy
Jan. 21, 2021
•
0 likes
2 likes
×
Be the first to like this
Show More
•
2,113 views
views
×
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Check these out next
PSR-3 logs using Monolog and Graylog
OCoderFest
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
Altinity Ltd
Amazon Redshift의 이해와 활용 (김용우) - AWS DB Day
Amazon Web Services Korea
Massive service basic
DaeMyung Kang
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
SANG WON PARK
HBase Storage Internals
DataWorks Summit
Making Apache Spark Better with Delta Lake
Databricks
Building a SIMD Supported Vectorized Native Engine for Spark SQL
Databricks
1
of
26
Top clipped slide
Count min sketch
Jan. 21, 2021
•
0 likes
2 likes
×
Be the first to like this
Show More
•
2,113 views
views
×
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Download Now
Download to read offline
Report
Technology
count min sketch
DaeMyung Kang
Follow
(Remote) Data Engineer at Udemy
Advertisement
Advertisement
Advertisement
Recommended
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
Altinity Ltd
3.4K views
•
47 slides
Bloomfilter
DaeMyung Kang
3.6K views
•
35 slides
[215]네이버콘텐츠통계서비스소개 김기영
NAVER D2
7.1K views
•
66 slides
Real-time Data Ingestion from Kafka to ClickHouse with Deterministic Re-tries...
HostedbyConfluent
3K views
•
28 slides
InfluxDB IOx Tech Talks: Query Engine Design and the Rust-Based DataFusion in...
InfluxData
3.4K views
•
55 slides
Elasticsearch for beginners
Neil Baker
14.2K views
•
38 slides
More Related Content
Slideshows for you
(20)
PSR-3 logs using Monolog and Graylog
OCoderFest
•
1.4K views
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
Altinity Ltd
•
9.4K views
Amazon Redshift의 이해와 활용 (김용우) - AWS DB Day
Amazon Web Services Korea
•
26.4K views
Massive service basic
DaeMyung Kang
•
10.9K views
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
SANG WON PARK
•
14.8K views
HBase Storage Internals
DataWorks Summit
•
23.8K views
Making Apache Spark Better with Delta Lake
Databricks
•
5.3K views
Building a SIMD Supported Vectorized Native Engine for Spark SQL
Databricks
•
655 views
카프카, 산전수전 노하우
if kakao
•
3.9K views
Introduction to apache kafka, confluent and why they matter
Paolo Castagna
•
1.7K views
Twitter의 snowflake 소개 및 활용
흥배 최
•
5K views
Producer Performance Tuning for Apache Kafka
Jiangjie Qin
•
43.8K views
MyRocks introduction and production deployment
Yoshinori Matsunobu
•
3.2K views
카프카(kafka) 성능 테스트 환경 구축 (JMeter, ELK)
Hyunmin Lee
•
879 views
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
Altinity Ltd
•
1.3K views
[215] Druid로 쉽고 빠르게 데이터 분석하기
NAVER D2
•
5.3K views
Top 5 Mistakes When Writing Spark Applications
Spark Summit
•
25.5K views
How We Optimize Spark SQL Jobs With parallel and sync IO
Databricks
•
549 views
webservice scaling for newbie
DaeMyung Kang
•
21.5K views
Sharding Methods for MongoDB
MongoDB
•
26.6K views
More from DaeMyung Kang
(20)
Redis
DaeMyung Kang
•
16.5K views
Ansible
DaeMyung Kang
•
3.8K views
Why GUID is needed
DaeMyung Kang
•
4.9K views
How to use redis well
DaeMyung Kang
•
3.8K views
The easiest consistent hashing
DaeMyung Kang
•
2.2K views
How to name a cache key
DaeMyung Kang
•
1.6K views
Integration between Filebeat and logstash
DaeMyung Kang
•
1.8K views
How to build massive service for advance
DaeMyung Kang
•
13.1K views
Data Engineering 101
DaeMyung Kang
•
4.3K views
How To Become Better Engineer
DaeMyung Kang
•
20.4K views
Kafka timestamp offset_final
DaeMyung Kang
•
609 views
Kafka timestamp offset
DaeMyung Kang
•
4.6K views
Data pipeline and data lake
DaeMyung Kang
•
3.2K views
Redis acl
DaeMyung Kang
•
1.8K views
Coffee store
DaeMyung Kang
•
2K views
Scalable webservice
DaeMyung Kang
•
2.1K views
Number system
DaeMyung Kang
•
674 views
Internet Scale Service Arichitecture
DaeMyung Kang
•
3.2K views
Redis From 2.8 to 4.x(unstable)
DaeMyung Kang
•
1.5K views
Redis From 2.8 to 4.x
DaeMyung Kang
•
4.1K views
Advertisement
Recently uploaded
(20)
Red Hat OpenStack 17 저자직강+스터디그룹_5주차
Nalee Jang
•
66 views
AWS Summit Seoul 2023 | AWS의 개발자를 위한 신규 서비스 소개 Amazon CodeCatalyst & Amazon C...
Amazon Web Services Korea
•
66 views
AWS Summit Seoul 2023 |Datadog을 활용한 AWS 서버리스 Observability
Amazon Web Services Korea
•
47 views
AWS Summit Seoul 2023 | Global scale service의 중앙 집중식 Observability 구축
Amazon Web Services Korea
•
57 views
AWS Summit Seoul 2023 | 잘나가는 애플리케이션 성능? 알맞은 스토리지로부터!
Amazon Web Services Korea
•
40 views
AWS Summit Seoul 2023 | MongoDB Atlas와 함께하는 Developer Data Platform
Amazon Web Services Korea
•
41 views
Browser Rendering
Wonjun Hwang
•
0 views
세션 공유용 템플릿_chi23.pdf
JisuRyou
•
104 views
AWS Summit Seoul 2023 | 데이터, 분석 및 AI를 통합하는 단 하나의 레이크하우스, Databricks on AWS 로 ...
Amazon Web Services Korea
•
71 views
Joo-Ho Lee: Topographic-aware wind forecasting system using multi-modal spati...
Network Science Lab, The Catholic University of Korea
•
32 views
2023_한국공간정보통신_회사소개서.pdf
(주)한국공간정보통신
•
3 views
Red Hat OpenStack 17 저자직강+스터디그룹_3주차
Nalee Jang
•
43 views
ChatGPT에 대한 인문학적 이해
Wonjun Hwang
•
41 views
AWS Summit Seoul 2023 | 기업 고객 대상 기계학습 기반 콜센터 도입을 위한 여정
Amazon Web Services Korea
•
30 views
ASP.NET Core와 Azure App Service와의 환상적인 만남
SangHoon Han
•
38 views
AWS Summit Seoul 2023 | 지능화되는 랜섬웨어 위협으로부터 지킬 것인가? 당할 것인가?
Amazon Web Services Korea
•
40 views
MySQL 실행계획
Wonjun Hwang
•
29 views
Kotlin 2.0을 통해 알아보는 코틀린의 미래
Leonardo YongUk Kim
•
25 views
소프트웨어의 계층구조
Wonjun Hwang
•
15 views
AWS Summit Seoul 2023 | 금융 디지털 서비스 혁신을 리딩하는 교보정보통신의 클라우드 마이그레이션 사례 소개
Amazon Web Services Korea
•
50 views
Count min sketch
Count Min Sketch 대충
이해하기 charsyam@naver.com
Count 를 위한
확률적 자료구조
IP가 100만개 정도
되는데 Count를 해야 한다면?
IP 개수에 따른
메모리 할당 양 개수 메모리(Redis 에서 계산) 10000 1.64MB 100000 8.69MB 1000000 77.49MB 2000000 123.64MB IP 개수가 늘어날 수록 메모리 사용량도 늘어난다.
IP는 특정 IP
들이 많을까? 다들 동일한 횟수로 접근할까?
TOP(K)의 Count가 정확해야할
때 Count Min Sketch가 유리
근사한 Count 값을
구하는 것이 목적 계산 시간과 메모리를 적게 사용한다.
필요한 값 d =
몇 개의 hash 함수를 쓸 것인가? w = 메모리 공간을 얼마나 쓸 것인가?
Count Min Sketch 0
1 2 3 4 5 Hash 1 0 0 0 0 0 0 Hash 2 0 0 0 0 0 0 Hash 3 0 0 0 0 0 0 Hash 4 0 0 0 0 0 0 w : 사용하고자 하는 메모리 공간 d 할당되는 메모리는 w * d * 변수크기 만큼 사용된다.
Hash 는 어떤
hash라도 가능 Hash % w 값으로 나오는 값을 사용
Example 1.1.1.1 2.2.2.2 3.3.3.3
4.4.4.4 5.5.5.5 6.6.6.6 Hash 1 1 2 1 3 5 4 Hash 2 5 4 3 5 1 3 Hash 3 2 4 5 1 0 2 Hash 4 1 2 2 3 0 4 다음과 같은 해시결과가 나온다고 하자.
Example 그리고 다음과 같은
데이터셋이 있다고 가정한다. 1.1.1.1 2.2.2.2 1.1.1.1 3.3.3.3 1.1.1.1
Example : 1.1.1.1 0
1 2 3 4 5 Hash 1 0 1 0 0 0 0 Hash 2 0 0 0 0 0 1 Hash 3 0 0 1 0 0 0 Hash 4 0 1 0 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 나온 해시 값의 자리를 1 증가시킨다.
Example : 2.2.2.2 0
1 2 3 4 5 Hash 1 0 1 1 0 0 0 Hash 2 0 0 0 0 1 1 Hash 3 0 0 1 0 1 0 Hash 4 0 1 1 0 0 0 Hash1(2.2.2.2) = 2 Hash2(2.2.2.2) = 4 Hash3(2.2.2.2) = 4 Hash4(2.2.2.2) = 2 나온 해시 값의 자리를 1 증가시킨다.
Example : 1.1.1.1 0
1 2 3 4 5 Hash 1 0 2 1 0 0 0 Hash 2 0 0 0 0 1 2 Hash 3 0 0 2 0 1 0 Hash 4 0 2 1 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 나온 해시 값의 자리를 1 증가시킨다.
Example : 3.3.3.3 0
1 2 3 4 5 Hash 1 0 3 1 0 0 0 Hash 2 0 0 0 1 1 2 Hash 3 0 0 2 0 1 1 Hash 4 0 2 2 0 0 0 Hash1(3.3.3.3) = 1 Hash2(3.3.3.3) = 3 Hash3(3.3.3.3) = 5 Hash4(3.3.3.3) = 2 나온 해시 값의 자리를 1 증가시킨다.
Example : 1.1.1.1 0
1 2 3 4 5 Hash 1 0 4 1 0 0 0 Hash 2 0 0 0 1 1 3 Hash 3 0 0 3 0 1 1 Hash 4 0 3 2 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 나온 해시 값의 자리를 1 증가시킨다.
이제 1.1.1.1 의
개수를 세어보자 0 1 2 3 4 5 Hash 1 0 4 1 0 0 0 Hash 2 0 0 0 1 1 3 Hash 3 0 0 3 0 1 1 Hash 4 0 3 2 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 각 자리의 값 (hash1, 1) = 4, (hash2, 5) = 3, (hash3, 2) = 3, (hash4, 1) = 3 즉 4, 3, 3, 3 중에서 가장 작은 MIN 값은 3 이므로 1.1.1.1의 개수는 3이 된다.
이제 3.3.3.3 의
개수를 세어보자 0 1 2 3 4 5 Hash 1 0 4 1 0 0 0 Hash 2 0 0 0 1 1 3 Hash 3 0 0 3 0 1 1 Hash 4 0 3 2 0 0 0 Hash1(3.3.3.3) = 1 Hash2(3.3.3.3) = 3 Hash3(3.3.3.3) = 5 Hash4(3.3.3.3) = 2 각 자리의 값 (hash1, 1) = 4, (hash2, 3) = 1, (hash3, 5) = 1, (hash4, 2) = 2 즉 4, 1, 1, 2 중에서 가장 작은 MIN 값은 1 이므로 3.3.3.3의 개수는 1이 된다.
W가 10000이고 d
가 4라면 4 * 10000 * 4 해서 160kb 정도만 메모리를 사용 160kb 와 77.49MB 중에 큰 것은?
Count Min Sketch
는 해시의 충돌을 감안하고 고정된 크기에서 특정 값의 개수를 근사치로 구하는 방법
Count Min Sketch 실제
값 <= 근사치 값 이 성립한다. (해시 충돌이 일어나면 다른 것의 값이 더해질 수 있으므로)
w와 d를 늘리면
좀 더 충돌이 줄어드므로 에러 값이 줄어든다.
근사값이지만, 운이 나쁘면
튀는 값이 위의 원리로 나올 수도 있다.
여러 해시값 들
중에 가장 적은 값을 가지 고 있는 해시의 값이 자신의 근사값이 됨.
감사합니다.
Advertisement