SlideShare a Scribd company logo
1 of 20
Download to read offline
Gogolook SQS
lesson learnt
Hello!
I am Kakashi
You can find me at:
Twitter: @kakashiliu
The story is ...
Previous Status
◎ Worker: c3.large * 30~50, spot instance
◎ CPU utilization: less than 20%
◎ Messages: over than 1 billion / per day
SQS 基本介紹
SQS 基本設定 2
◎ First 1 million SQS requests per month are free
◎ $0.476 / per 1 million SQS requests
◎ A single request can have from 1 to 10 messages,
up to maximum total payload of 256 kb
◎ requests including:
CreateQueue, ListQueues, DeleteQueue, SendMessage,
SendMessageBatch, ReceiveMessage, ChangeMessageVisibility,
ChangeMessageVisibilityBatch, DeleteMessage, DeleteMessageBatch,
SetQueueAttributes, GetQueueAttributes, GetQueueUrl, AddPermission,
and RemovePermission.
SQS新政1 : 流程改善
◎ 每個worker每隔1min, 用crontab叫他們復活, 沒事幹就死掉
=> cpu utilization low, cpu loading high
◎ Solution:
利用 while True 加上 SQS long polling (20s) , 沒事做的時候
sleep 60s
◎ 結果: Loading降低, CPU utilization 沒提升很多
SQS新政2 : 斷開鎖鏈
◎ 發現有network bound: 3rd library loggly 沒有使用keep-alive
的方式連接
◎ Solution:
1) python lib 替換 urllib2 為 requests.session
2) 並且使用batch sent log
◎ 結果: 清queue速度快一倍
worker cpu utilization 上升數倍
SQS新政3 : 減少request量
◎ 利用sent message batch的方式, Batch sent 100 messages or
塞滿256kb在發送
◎ Solution:
patch掉原本送queue的function, 並且利用 atexit 去避免
worker被關閉時, 有些message還在 local queue裡面
◎ 結果: sent, receive , delete 量減少99%
SQS新政4 : 調整單機工人數目
◎ Message 多的開多一點 thread去處理
◎ 其中還可以利用 gevent 去避開一些 network bound的問題
Result
◎ Spot instance: 30~50 -> 2
◎ CPU utilization: 20% -> 80%
◎ Message Counts: 1 billion -> 10million
◎ 處理時間
Result
Cost Reduction around 70%
Bonus: SQS alternative
Fluentd (Before)
Fluentd (After)
Traditional Flow
AP server SQS Worker Mongodb
Big Query
Fluentd Flow
AP server
Fluentd
Forwarder
Fluentd
Station
Mongodb
Big Query
Fluentd Flow
AP server
Fluentd
Forwarder
Fluentd
Station
ELB
Fluentd
Station
Fluentd
Station
Fluentd
Station
Thanks!
Any questions?
You can find me at:
@kakashiliu
kakashi@gogolook.com

More Related Content

Viewers also liked

Project Managment
Project ManagmentProject Managment
Project Managment
Koshy Tk
 
Project Management PPT
Project Management PPTProject Management PPT
Project Management PPT
bletindia
 

Viewers also liked (12)

Project Managment Program
Project Managment ProgramProject Managment Program
Project Managment Program
 
Project Managment
Project ManagmentProject Managment
Project Managment
 
Project Managment Thinking
Project Managment ThinkingProject Managment Thinking
Project Managment Thinking
 
Mjedisi
MjedisiMjedisi
Mjedisi
 
ENGLAND PRESENTATION
ENGLAND PRESENTATIONENGLAND PRESENTATION
ENGLAND PRESENTATION
 
Project managment ppt
Project managment pptProject managment ppt
Project managment ppt
 
Project Managment Good Practices
Project Managment Good PracticesProject Managment Good Practices
Project Managment Good Practices
 
England Presentation
England PresentationEngland Presentation
England Presentation
 
Project Management PowerPoint PPT Content Modern Sample
Project Management PowerPoint PPT Content Modern SampleProject Management PowerPoint PPT Content Modern Sample
Project Management PowerPoint PPT Content Modern Sample
 
Project Management PPT
Project Management PPTProject Management PPT
Project Management PPT
 
PMI Project Management Principles
PMI Project Management PrinciplesPMI Project Management Principles
PMI Project Management Principles
 
Fundamentals of Project Management
Fundamentals of Project ManagementFundamentals of Project Management
Fundamentals of Project Management
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Gogolook SQS lesson learnt