SlideShare une entreprise Scribd logo
1  sur  14
Salesforce Admin Group,Trichy
Deep study
on Asynchronous Apex
Kadhar Basha J
Salesforce Admin Group, Trichy
Trailblazer Community Group Leader
Sundaravel J
Salesforce Admin Group, Trichy
Trailblazer Community Group Co-Leader
Salesforce Admin Group,Trichy
Salesforce Admin Group,Trichy
Speaker
Mohamed Javith Shet Mohamad
Today’s Agenda
• Introduction
• Asynchronous Apex
• Scenarios
• Demo
• Questions & Answers
Synchronous Apex
• Occurring at the same time.
• Quick and Immediate actions.
• Transactions are immediate and serial.
• Normal Governor Limits
Asynchronous Apex
• Not occurring at the same time.
• Executes when resources are available.
• Not immediate.
• Higher Governor Limits.
Governor Limits
Description Synchronous Limit Asynchronous Limit
Total number of SOQL queries
issued
100 200
Total number of records
retrieved by SOQL queries
50000 50000
Total number of records
retrieved by
Database.getQueryLocator
10000 10000
Total number of SOSL queries
issued
20 20
Total number of records
retrieved by a single SOSL query
2000 2000
Total number of DML
statements issued
150 150
Total heap size 6 MB 12 MB
Maximum CPU time on the
Salesforce servers
10000 ms 60000 ms
Example scenario
Update a record Trigger will fire
Need to insert more
than 10000 or query
50000 records
Use asynchronous
apex
Transaction
completes. But
asynchronous apex
may still be running.
Types
Future Apex
• @future annotation at the start of method.
• Always method should be public static and return type should be void.
• The specified parameters must be primitive data types, arrays of primitive data
types, or collections of primitive data types; future methods can’t take objects as
arguments.
• Future methods won’t necessarily execute in the same order they are called. In
addition, it’s possible that two future methods could run concurrently, which
could result in record locking if the two methods were updating the same record.
• You’re limited to 50 future calls per Apex invocation, and there’s an additional
limit on the number of calls in a 24-hour period.
• Cannot call another future method from a future method.
Batch Apex
• Has a different syntax.
• Every transaction starts with a new set of governor limits.
• If one batch fails to process successfully, all other successful batch transactions
aren’t rolled back.
• Start, Execute and Finish are the 3 methods.
• Can track the progress of batch in the apex job page in setup.
• 5 batch jobs at a given time
• You can call another batch from batch or queue but not future method.
• What happens when more than 5 batch jobs are invoked?
Queueable Apex
• Similar to future apex.
• Accepts non primitive datatypes too.
• Can call another queue. (Only one)
• Progress can be tracked in apex batch jobs page.
• You can add up to 50 jobs to the queue with System.enqueueJob in a single
transaction.
Schedulable Apex
• Runs apex class at a specified time and frequency.
• Can be scheduled in UI or using cron jobs.
• Scheduled jobs can be tracked from scheduled jobs page in setup.
• You can only have 100 scheduled Apex jobs at one time
Note: Always asynchronous apex should be executed within startTest() and
stopTest().
Asynchronous Apex .pptx
Asynchronous Apex .pptx

Contenu connexe

Similaire à Asynchronous Apex .pptx

Processing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxProcessing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptx
Pankaj Goyal
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
vfabro
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
Nexcess.net LLC
 
Secrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archsSecrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archs
Tarik Essawi
 

Similaire à Asynchronous Apex .pptx (20)

Processing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxProcessing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptx
 
Processing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxProcessing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptx
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Episode 18 - Asynchronous Apex
Episode 18 - Asynchronous ApexEpisode 18 - Asynchronous Apex
Episode 18 - Asynchronous Apex
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance Strategy
 
Scaling tappsi
Scaling tappsiScaling tappsi
Scaling tappsi
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
 
Performance Tuning and Optimization
Performance Tuning and OptimizationPerformance Tuning and Optimization
Performance Tuning and Optimization
 
Building an Experimentation Platform in Clojure
Building an Experimentation Platform in ClojureBuilding an Experimentation Platform in Clojure
Building an Experimentation Platform in Clojure
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Secrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archsSecrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archs
 
Performance tuning Grails applications
Performance tuning Grails applicationsPerformance tuning Grails applications
Performance tuning Grails applications
 
Entity framework advanced
Entity framework advancedEntity framework advanced
Entity framework advanced
 
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSalesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
 
OpenERP Performance Benchmark
OpenERP Performance BenchmarkOpenERP Performance Benchmark
OpenERP Performance Benchmark
 
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysql
 
Critical section operating system
Critical section  operating systemCritical section  operating system
Critical section operating system
 

Plus de KadharBashaJ

A Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptxA Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptx
KadharBashaJ
 
Tour to docgen lightning experience
Tour to docgen lightning experienceTour to docgen lightning experience
Tour to docgen lightning experience
KadharBashaJ
 

Plus de KadharBashaJ (20)

A Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptxA Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptx
 
Winter'23 Release Updates.pptx
Winter'23 Release Updates.pptxWinter'23 Release Updates.pptx
Winter'23 Release Updates.pptx
 
Review on Data Security.pptx
Review on Data Security.pptxReview on Data Security.pptx
Review on Data Security.pptx
 
Flow With Aura.pptx
Flow With Aura.pptxFlow With Aura.pptx
Flow With Aura.pptx
 
Conga composer
Conga composerConga composer
Conga composer
 
Flow builder series i
Flow builder series iFlow builder series i
Flow builder series i
 
Tour to docgen lightning experience
Tour to docgen lightning experienceTour to docgen lightning experience
Tour to docgen lightning experience
 
Winter 22 features
Winter 22 featuresWinter 22 features
Winter 22 features
 
DocuSign Power Form
DocuSign Power FormDocuSign Power Form
DocuSign Power Form
 
Formstack
FormstackFormstack
Formstack
 
Publish and subscribe platform events using flows
Publish and subscribe platform events using flowsPublish and subscribe platform events using flows
Publish and subscribe platform events using flows
 
Multi language support for salesforce community portal
Multi language support for salesforce community portalMulti language support for salesforce community portal
Multi language support for salesforce community portal
 
Simplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning schedulerSimplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning scheduler
 
How to crack Admin and Advanced Admin
How to crack Admin and Advanced AdminHow to crack Admin and Advanced Admin
How to crack Admin and Advanced Admin
 
How to crack java script certification
How to crack java script certificationHow to crack java script certification
How to crack java script certification
 
Master tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problemsMaster tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problems
 
Low code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex codeLow code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex code
 
Qa mockup interview for automation testing
Qa mockup interview for automation testingQa mockup interview for automation testing
Qa mockup interview for automation testing
 
Qa mock up interview for manual testing
Qa mock up interview for manual testingQa mock up interview for manual testing
Qa mock up interview for manual testing
 
Docu sign integration with salesforce beginner learning series integration...
Docu sign integration with salesforce   beginner learning series  integration...Docu sign integration with salesforce   beginner learning series  integration...
Docu sign integration with salesforce beginner learning series integration...
 

Dernier

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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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
 
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
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Asynchronous Apex .pptx

  • 1. Salesforce Admin Group,Trichy Deep study on Asynchronous Apex
  • 2. Kadhar Basha J Salesforce Admin Group, Trichy Trailblazer Community Group Leader Sundaravel J Salesforce Admin Group, Trichy Trailblazer Community Group Co-Leader Salesforce Admin Group,Trichy
  • 4. Today’s Agenda • Introduction • Asynchronous Apex • Scenarios • Demo • Questions & Answers
  • 5. Synchronous Apex • Occurring at the same time. • Quick and Immediate actions. • Transactions are immediate and serial. • Normal Governor Limits Asynchronous Apex • Not occurring at the same time. • Executes when resources are available. • Not immediate. • Higher Governor Limits.
  • 6. Governor Limits Description Synchronous Limit Asynchronous Limit Total number of SOQL queries issued 100 200 Total number of records retrieved by SOQL queries 50000 50000 Total number of records retrieved by Database.getQueryLocator 10000 10000 Total number of SOSL queries issued 20 20 Total number of records retrieved by a single SOSL query 2000 2000 Total number of DML statements issued 150 150 Total heap size 6 MB 12 MB Maximum CPU time on the Salesforce servers 10000 ms 60000 ms
  • 7. Example scenario Update a record Trigger will fire Need to insert more than 10000 or query 50000 records Use asynchronous apex Transaction completes. But asynchronous apex may still be running.
  • 9. Future Apex • @future annotation at the start of method. • Always method should be public static and return type should be void. • The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types; future methods can’t take objects as arguments. • Future methods won’t necessarily execute in the same order they are called. In addition, it’s possible that two future methods could run concurrently, which could result in record locking if the two methods were updating the same record. • You’re limited to 50 future calls per Apex invocation, and there’s an additional limit on the number of calls in a 24-hour period. • Cannot call another future method from a future method.
  • 10. Batch Apex • Has a different syntax. • Every transaction starts with a new set of governor limits. • If one batch fails to process successfully, all other successful batch transactions aren’t rolled back. • Start, Execute and Finish are the 3 methods. • Can track the progress of batch in the apex job page in setup. • 5 batch jobs at a given time • You can call another batch from batch or queue but not future method. • What happens when more than 5 batch jobs are invoked?
  • 11. Queueable Apex • Similar to future apex. • Accepts non primitive datatypes too. • Can call another queue. (Only one) • Progress can be tracked in apex batch jobs page. • You can add up to 50 jobs to the queue with System.enqueueJob in a single transaction.
  • 12. Schedulable Apex • Runs apex class at a specified time and frequency. • Can be scheduled in UI or using cron jobs. • Scheduled jobs can be tracked from scheduled jobs page in setup. • You can only have 100 scheduled Apex jobs at one time Note: Always asynchronous apex should be executed within startTest() and stopTest().