SlideShare a Scribd company logo
Rate Limits &
Performance
Handling Rate limits, boosting
performance
Gustavo Moreira
<Presenter>
Agenda
● API best practices
● What are rate limits?
● How to handle rate limits?
Best Practices
Some simple things to speed up your applications
Batch operations together
● Requests to the API have certain costs
○ Network transfer, serialisation, auth, etc.
● Batching operations into a single request
● mutate methods accept operation arrays
Group operations by target
● Multiple operations on the same
AdGroup/Campaign are faster
● Subsequent edits can cause
CONCURRENT_MODIFICATION errors
○ Backend can take time to do its work
○ Try all edits to AdGroups/Campaigns at once
Only update what you need
● Updating an object?
○ Only send the values that will change!
○ Sending all other values wastes time
■ System validation
■ DB storing
■ etc.
A couple of other things...
● Compress your traffic with
gzip
○ User-Agent: has "gzip"
○ Accept-Encoding: "gzip"
● Use partial failure
○ Tells API to serialise those ops
that succeeded
○ Returns list of those that failed
Defining Rate Limits
Rate Limits
● Not fixed
● Vary on server load
● Vary per feature area
● Will change over time
● Differs per AdWords Service
Limit based on Access Level
● This limit doesn't fluctuate
● The access level can be Basic or Standard
Standard: More than 10K
Basic: 10K operations per day
operations per day allowed
Rate Limit Errors
● RATE_EXCEEDED
○ wait retryAfterSeconds seconds
● CONCURRENT_MODIFICATIONS
○ Exponential backoff, few retries only
● UNEXPECTED_INTERNAL_API_
ERROR
○ Exponential back off, few retries only
○ Report the issue to your CSR or forum
How to Handle
Rate Limits
Basic Example
ApiError[] errorArray = apiException.getErrors();
for (ApiError apiError : errorArray) {
if (apiError instanceof RateExceededError) {
int seconds = ((RateExceededError) apiError)
.getRetryAfterSeconds();
// wait the amount of seconds the server asked
Thread.sleep(seconds * 1000);
}
}
Basic Example - Explained
● Any request can generate a
RateExceededError
● Handle these errors!
● Best strategy: wait and retry
● Even more important when
doing multiple requests
Important points - Basic Solution
● Synchronous solution to the problem
● Blocks the thread until it succeeds, or fails
completely
● No control over request rate speed
● Very difficult to group operations
A More Advanced Solution
● Message Queues
○ The perfect solution to distribute load and do
throttling
○ Very good out of the box solutions available
■ ActiveMQ, RabbitMQ, … etc.
○ A lot of tools / client libraries to handle the
communication layer
Message Queues - Cont.
● More control over the rates and limits
● Better break down into specialized modules
● Let’s take a look to three possible
approaches to the problem...
1. Single Queue
Consume
rs
Queue
Producer
Producer
Producer
Consume
rs
Throttling
Producers will create tasks to
be executed using the API, and
add them to the queue
Consumers will retrieve the
messages/tasks from the queue
with a controlled rate limit
X
Error
Consumers
Logging
Pros & Cons
● Pros:
○ Very easy to implement
○ Only one control point to change rate speed
○ Easy to handle errors
● Cons:
○ Only one control point to change rate speed
○ Hard to group operations
○ Tasks can take too long to be executed
○ Not all MQs deal with message priority
2. Single Queue with Selectors
Queue
Producers
Producers
Producers
Producers
Consumer
Consumer
Consumer
Consumer
Throttling
Producers will create specific tasks
to be executed, and add them to
the queue with a specific header
Each specific consumer can group
the operations, and execute within
your own rate limit using selectors
X
X
X
X
Error
Pros & Cons
● Pros:
○ Group operations by type
○ Some control over throttling depending on type
○ More efficient - better parallel access to the API
● Cons:
○ Only one queue - difficult to administer
○ No main control on how fast the API is called
○ Managing all the pieces can be difficult
○ Operation logging might be complicated
3. Multiple Queues
Queues
Producers
Producers
Producers
Producers
Consumer
Consumer
Consumer
ConsumerThrottling
X
X
X
X
Error
Executors
Throttling
Logging
Producers just
spawn a lot of tasks
Consumers just group the tasks
Executors do the request
Pros & Cons
● Pros:
○ Total control over rate limits
○ Very robust - very easy to add new parts
○ Complete picture on what is happening with the
queues
○ Easy to scale based on demand
○ If done properly, easy to do maintenance!
○ Super efficient - Parallel grouping; Parallel access to
the API
● Cons:
○ Hard to implement properly - experience required
Message Queues - Takeaway
● Complexity of your platform dictates the
best solution
● You can combine parts of other solutions!
● It is a complex subject, but will
save you in the long run
● Invest a lot in monitoring. A lot!
● There is no silver bullet...
Resources
● API Best Practices - https://developers.
google.
com/adwords/api/docs/guides/bestpractic
es
● ActiveMQ - http://activemq.apache.org/
● RabbitMQ - http://www.rabbitmq.com/
Ad

More Related Content

What's hot (20)

NoSQL
NoSQLNoSQL
NoSQL
Radu Potop
 
Building towards a Composite API Framework in Salesforce
Building towards a Composite API Framework in SalesforceBuilding towards a Composite API Framework in Salesforce
Building towards a Composite API Framework in Salesforce
Salesforce Developers
 
Ssrf
SsrfSsrf
Ssrf
Ilan Mindel
 
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
Altinity Ltd
 
Rest API
Rest APIRest API
Rest API
Rohana K Amarakoon
 
Cloud computing stack
Cloud computing stackCloud computing stack
Cloud computing stack
Pedro Alexander Romero Tortosa
 
Troubleshooting Kerberos in Hadoop: Taming the Beast
Troubleshooting Kerberos in Hadoop: Taming the BeastTroubleshooting Kerberos in Hadoop: Taming the Beast
Troubleshooting Kerberos in Hadoop: Taming the Beast
DataWorks Summit
 
MapReduce Paradigm
MapReduce ParadigmMapReduce Paradigm
MapReduce Paradigm
Dilip Reddy
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
Meghaj Mallick
 
Oracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data StreamingOracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data Streaming
Michael Rainey
 
Deadlock
DeadlockDeadlock
Deadlock
Rajandeep Gill
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
n|u - The Open Security Community
 
Seamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive WarehouseSeamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive Warehouse
DataWorks Summit
 
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
NAVER D2
 
4 internet programming
4 internet programming4 internet programming
4 internet programming
soner_kavlak
 
Google File System
Google File SystemGoogle File System
Google File System
Junyoung Jung
 
In-Memory DataBase
In-Memory DataBaseIn-Memory DataBase
In-Memory DataBase
Pridhvi Kodamasimham
 
Protocol Buffers
Protocol BuffersProtocol Buffers
Protocol Buffers
Knoldus Inc.
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
Prem Sanil
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
Aniruddh Bhilvare
 
Building towards a Composite API Framework in Salesforce
Building towards a Composite API Framework in SalesforceBuilding towards a Composite API Framework in Salesforce
Building towards a Composite API Framework in Salesforce
Salesforce Developers
 
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
Altinity Ltd
 
Troubleshooting Kerberos in Hadoop: Taming the Beast
Troubleshooting Kerberos in Hadoop: Taming the BeastTroubleshooting Kerberos in Hadoop: Taming the Beast
Troubleshooting Kerberos in Hadoop: Taming the Beast
DataWorks Summit
 
MapReduce Paradigm
MapReduce ParadigmMapReduce Paradigm
MapReduce Paradigm
Dilip Reddy
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
Meghaj Mallick
 
Oracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data StreamingOracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka A Deep Dive Into Real-Time Data Streaming
Michael Rainey
 
Seamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive WarehouseSeamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive Warehouse
DataWorks Summit
 
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
NAVER D2
 
4 internet programming
4 internet programming4 internet programming
4 internet programming
soner_kavlak
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
Prem Sanil
 

Similar to Rate limits and Performance (20)

Rate limits and performance Talk
Rate limits and performance TalkRate limits and performance Talk
Rate limits and performance Talk
marcwan
 
BAXTER phase 1b
BAXTER phase 1bBAXTER phase 1b
BAXTER phase 1b
Franck MIKULECZ
 
Training Webinar: Detect Performance Bottlenecks of Applications
Training Webinar: Detect Performance Bottlenecks of ApplicationsTraining Webinar: Detect Performance Bottlenecks of Applications
Training Webinar: Detect Performance Bottlenecks of Applications
OutSystems
 
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
InfluxData
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Startupfest
 
Netflix SRE perf meetup_slides
Netflix SRE perf meetup_slidesNetflix SRE perf meetup_slides
Netflix SRE perf meetup_slides
Ed Hunter
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
slandelle
 
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra TagareActionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
Apache Apex
 
PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux
Neotys
 
iFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with ScyllaiFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with Scylla
ScyllaDB
 
Three Perspectives on Measuring Latency
Three Perspectives on Measuring LatencyThree Perspectives on Measuring Latency
Three Perspectives on Measuring Latency
ScyllaDB
 
Serverless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From ProductionServerless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From Production
Steve Hogg
 
Scaling Monitoring At Databricks From Prometheus to M3
Scaling Monitoring At Databricks From Prometheus to M3Scaling Monitoring At Databricks From Prometheus to M3
Scaling Monitoring At Databricks From Prometheus to M3
LibbySchulze
 
Performance Test Automation With Gatling
Performance Test Automation  With GatlingPerformance Test Automation  With Gatling
Performance Test Automation With Gatling
Knoldus Inc.
 
Gatling
Gatling Gatling
Gatling
Gaurav Shukla
 
Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...
Omid Vahdaty
 
Performance test
Performance testPerformance test
Performance test
Tony Fortunato
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performance
MarkTaylorIBM
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE Architectures
Alexander Penev
 
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ UberKafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
confluent
 
Rate limits and performance Talk
Rate limits and performance TalkRate limits and performance Talk
Rate limits and performance Talk
marcwan
 
Training Webinar: Detect Performance Bottlenecks of Applications
Training Webinar: Detect Performance Bottlenecks of ApplicationsTraining Webinar: Detect Performance Bottlenecks of Applications
Training Webinar: Detect Performance Bottlenecks of Applications
OutSystems
 
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
InfluxData
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Startupfest
 
Netflix SRE perf meetup_slides
Netflix SRE perf meetup_slidesNetflix SRE perf meetup_slides
Netflix SRE perf meetup_slides
Ed Hunter
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
slandelle
 
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra TagareActionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
Apache Apex
 
PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux
Neotys
 
iFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with ScyllaiFood on Delivering 100 Million Events a Month to Restaurants with Scylla
iFood on Delivering 100 Million Events a Month to Restaurants with Scylla
ScyllaDB
 
Three Perspectives on Measuring Latency
Three Perspectives on Measuring LatencyThree Perspectives on Measuring Latency
Three Perspectives on Measuring Latency
ScyllaDB
 
Serverless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From ProductionServerless - DevOps Lessons Learned From Production
Serverless - DevOps Lessons Learned From Production
Steve Hogg
 
Scaling Monitoring At Databricks From Prometheus to M3
Scaling Monitoring At Databricks From Prometheus to M3Scaling Monitoring At Databricks From Prometheus to M3
Scaling Monitoring At Databricks From Prometheus to M3
LibbySchulze
 
Performance Test Automation With Gatling
Performance Test Automation  With GatlingPerformance Test Automation  With Gatling
Performance Test Automation With Gatling
Knoldus Inc.
 
Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...
Omid Vahdaty
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performance
MarkTaylorIBM
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE Architectures
Alexander Penev
 
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ UberKafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
confluent
 
Ad

More from supergigas (18)

Remarketing using customer match
Remarketing using customer matchRemarketing using customer match
Remarketing using customer match
supergigas
 
What's new in reporting
What's new in reporting What's new in reporting
What's new in reporting
supergigas
 
Location aware ad customizers
Location aware ad customizersLocation aware ad customizers
Location aware ad customizers
supergigas
 
GMB API (Google My Business)
GMB API (Google My Business)GMB API (Google My Business)
GMB API (Google My Business)
supergigas
 
Uploading HTML5 ads
Uploading HTML5 adsUploading HTML5 ads
Uploading HTML5 ads
supergigas
 
BatchJobService
BatchJobServiceBatchJobService
BatchJobService
supergigas
 
Why use ad words api
Why use ad words apiWhy use ad words api
Why use ad words api
supergigas
 
How to build a platform
How to build a platformHow to build a platform
How to build a platform
supergigas
 
Upgraded URLs
Upgraded URLsUpgraded URLs
Upgraded URLs
supergigas
 
The AdWords api and mobile
The AdWords api and mobileThe AdWords api and mobile
The AdWords api and mobile
supergigas
 
Shopping Campaigns
Shopping CampaignsShopping Campaigns
Shopping Campaigns
supergigas
 
MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts update
supergigas
 
How AdWords UI maps into adwords api
How AdWords UI maps into adwords apiHow AdWords UI maps into adwords api
How AdWords UI maps into adwords api
supergigas
 
Extension Setting Services
Extension Setting ServicesExtension Setting Services
Extension Setting Services
supergigas
 
Effective Reporting
Effective ReportingEffective Reporting
Effective Reporting
supergigas
 
Display Network criteria bidding
Display Network criteria biddingDisplay Network criteria bidding
Display Network criteria bidding
supergigas
 
Dev Token tips
Dev Token tipsDev Token tips
Dev Token tips
supergigas
 
Ad Customizers
Ad CustomizersAd Customizers
Ad Customizers
supergigas
 
Remarketing using customer match
Remarketing using customer matchRemarketing using customer match
Remarketing using customer match
supergigas
 
What's new in reporting
What's new in reporting What's new in reporting
What's new in reporting
supergigas
 
Location aware ad customizers
Location aware ad customizersLocation aware ad customizers
Location aware ad customizers
supergigas
 
GMB API (Google My Business)
GMB API (Google My Business)GMB API (Google My Business)
GMB API (Google My Business)
supergigas
 
Uploading HTML5 ads
Uploading HTML5 adsUploading HTML5 ads
Uploading HTML5 ads
supergigas
 
BatchJobService
BatchJobServiceBatchJobService
BatchJobService
supergigas
 
Why use ad words api
Why use ad words apiWhy use ad words api
Why use ad words api
supergigas
 
How to build a platform
How to build a platformHow to build a platform
How to build a platform
supergigas
 
The AdWords api and mobile
The AdWords api and mobileThe AdWords api and mobile
The AdWords api and mobile
supergigas
 
Shopping Campaigns
Shopping CampaignsShopping Campaigns
Shopping Campaigns
supergigas
 
MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts update
supergigas
 
How AdWords UI maps into adwords api
How AdWords UI maps into adwords apiHow AdWords UI maps into adwords api
How AdWords UI maps into adwords api
supergigas
 
Extension Setting Services
Extension Setting ServicesExtension Setting Services
Extension Setting Services
supergigas
 
Effective Reporting
Effective ReportingEffective Reporting
Effective Reporting
supergigas
 
Display Network criteria bidding
Display Network criteria biddingDisplay Network criteria bidding
Display Network criteria bidding
supergigas
 
Dev Token tips
Dev Token tipsDev Token tips
Dev Token tips
supergigas
 
Ad Customizers
Ad CustomizersAd Customizers
Ad Customizers
supergigas
 
Ad

Recently uploaded (20)

AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 

Rate limits and Performance

  • 1. Rate Limits & Performance Handling Rate limits, boosting performance Gustavo Moreira <Presenter>
  • 2. Agenda ● API best practices ● What are rate limits? ● How to handle rate limits?
  • 3. Best Practices Some simple things to speed up your applications
  • 4. Batch operations together ● Requests to the API have certain costs ○ Network transfer, serialisation, auth, etc. ● Batching operations into a single request ● mutate methods accept operation arrays
  • 5. Group operations by target ● Multiple operations on the same AdGroup/Campaign are faster ● Subsequent edits can cause CONCURRENT_MODIFICATION errors ○ Backend can take time to do its work ○ Try all edits to AdGroups/Campaigns at once
  • 6. Only update what you need ● Updating an object? ○ Only send the values that will change! ○ Sending all other values wastes time ■ System validation ■ DB storing ■ etc.
  • 7. A couple of other things... ● Compress your traffic with gzip ○ User-Agent: has "gzip" ○ Accept-Encoding: "gzip" ● Use partial failure ○ Tells API to serialise those ops that succeeded ○ Returns list of those that failed
  • 9. Rate Limits ● Not fixed ● Vary on server load ● Vary per feature area ● Will change over time ● Differs per AdWords Service
  • 10. Limit based on Access Level ● This limit doesn't fluctuate ● The access level can be Basic or Standard Standard: More than 10K Basic: 10K operations per day operations per day allowed
  • 11. Rate Limit Errors ● RATE_EXCEEDED ○ wait retryAfterSeconds seconds ● CONCURRENT_MODIFICATIONS ○ Exponential backoff, few retries only ● UNEXPECTED_INTERNAL_API_ ERROR ○ Exponential back off, few retries only ○ Report the issue to your CSR or forum
  • 13. Basic Example ApiError[] errorArray = apiException.getErrors(); for (ApiError apiError : errorArray) { if (apiError instanceof RateExceededError) { int seconds = ((RateExceededError) apiError) .getRetryAfterSeconds(); // wait the amount of seconds the server asked Thread.sleep(seconds * 1000); } }
  • 14. Basic Example - Explained ● Any request can generate a RateExceededError ● Handle these errors! ● Best strategy: wait and retry ● Even more important when doing multiple requests
  • 15. Important points - Basic Solution ● Synchronous solution to the problem ● Blocks the thread until it succeeds, or fails completely ● No control over request rate speed ● Very difficult to group operations
  • 16. A More Advanced Solution ● Message Queues ○ The perfect solution to distribute load and do throttling ○ Very good out of the box solutions available ■ ActiveMQ, RabbitMQ, … etc. ○ A lot of tools / client libraries to handle the communication layer
  • 17. Message Queues - Cont. ● More control over the rates and limits ● Better break down into specialized modules ● Let’s take a look to three possible approaches to the problem...
  • 18. 1. Single Queue Consume rs Queue Producer Producer Producer Consume rs Throttling Producers will create tasks to be executed using the API, and add them to the queue Consumers will retrieve the messages/tasks from the queue with a controlled rate limit X Error Consumers Logging
  • 19. Pros & Cons ● Pros: ○ Very easy to implement ○ Only one control point to change rate speed ○ Easy to handle errors ● Cons: ○ Only one control point to change rate speed ○ Hard to group operations ○ Tasks can take too long to be executed ○ Not all MQs deal with message priority
  • 20. 2. Single Queue with Selectors Queue Producers Producers Producers Producers Consumer Consumer Consumer Consumer Throttling Producers will create specific tasks to be executed, and add them to the queue with a specific header Each specific consumer can group the operations, and execute within your own rate limit using selectors X X X X Error
  • 21. Pros & Cons ● Pros: ○ Group operations by type ○ Some control over throttling depending on type ○ More efficient - better parallel access to the API ● Cons: ○ Only one queue - difficult to administer ○ No main control on how fast the API is called ○ Managing all the pieces can be difficult ○ Operation logging might be complicated
  • 23. Pros & Cons ● Pros: ○ Total control over rate limits ○ Very robust - very easy to add new parts ○ Complete picture on what is happening with the queues ○ Easy to scale based on demand ○ If done properly, easy to do maintenance! ○ Super efficient - Parallel grouping; Parallel access to the API ● Cons: ○ Hard to implement properly - experience required
  • 24. Message Queues - Takeaway ● Complexity of your platform dictates the best solution ● You can combine parts of other solutions! ● It is a complex subject, but will save you in the long run ● Invest a lot in monitoring. A lot! ● There is no silver bullet...
  • 25. Resources ● API Best Practices - https://developers. google. com/adwords/api/docs/guides/bestpractic es ● ActiveMQ - http://activemq.apache.org/ ● RabbitMQ - http://www.rabbitmq.com/