SlideShare une entreprise Scribd logo
1  sur  28
Apex Liberation : The evolution
of Flex Queue
Carolina Ruiz Medina
Principal Developer, Product Innovation team
cruiz@financialforce.com
@CarolEnLaNube
@CodeCoffeeCloud
Stephen Willcock
Director, Product Innovation
swillcock@financialforce.com
@stephenwillcock
Carolina Ruiz Medina
Principal Developer, Product Innovation Team at
FinancialForce.com
cruiz@financialforce.com
@CarolEnLaNube
@CodeCoffeeCloud
Stephen Willcock
Director, Product Innovation at FinancialForce.com
swillcock@financialforce.com
@stephenwillcock
foobarforce.com
About
GREAT ALONE. BETTER TOGETHER.
• Native to Salesforce1™ Platform
since 2009
• Investors include Salesforce Ventures
• 650+ employees, San Francisco based
4
Heavy lifting
• Normal Execution limited by Apex
Governors
• Number of records to process
• CPU Time
• Heap Size
Working Synchronously
Making light work
Making light work
Higher limits in Asynchronous
• @future
• Queueable
• Batch
• Pipeline (pilot)
Execute when there are
available resources
@future
Process a higher
number of records
Increased Governor
Limits in Async
We don’t have job id for @future jobs
as @future does not return anything
The method does not necessarily execute in
the same order is called
We can’t monitor @future jobs
Parameters must be primitive data types
@future - show me the code!
public with sharing class FutureClass {
@future
static void myMethod(String a, Integer i) {
System.debug(’Primitive variable' + a + ' and ' + i+’But I run ASYNCHROUNOUSLY');
// ALL THE LOGIC HERE
}
}
We can track/monitor the batch jobs:
DataBase.executeBatch returns Id
We can only run 5 concurrent jobs
Batch Apex
We can chain batch jobs
Possibility to use iterator and process
different objects (or none)
We cannot reorder or set priorities
Process up to 50M records
Batch Apex - show me the code!
public class UpdateAccountFields implements Database.Batchable<sObject>{
public final String Query; public final String Entity;
public final String Field; public final String Value;
public UpdateAccountFields(String q, String e, String f, String v){
Query=q; Entity=e; Field=f;Value=v;
}
public Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}
public void execute(Database.BatchableContext BC,
List<sObject> scope){
for(Sobject s : scope){s.put(Field,Value);
} update scope;
}
public void finish(Database.BatchableContext BC){
}
}
Simple Batch Apex Examples
Async Limits
Execution Governors
Batch start
Batch execute
Batch finish
@future
Queueable
250,000 method
calls in a 24 hour
period
Scheduled
The Evolution… of Async Apex
The evolution of @future - Queueable
public class AsyncExecutionExample implements Queueable, Database.AllowsCallouts {
public void execute(QueueableContext context) {
Account a = new Account(Name='Acme',Phone='(415) 555-1212');
insert a;
}
}
ID jobID = System.enqueueJob(new AsyncExecutionExample());
AsyncApexJob jobInfo = [SELECT Status,NumberOfErrors FROM AsyncApexJob WHERE
Id=:jobID];
The evolution of @future - Queueable
public class AsyncExecutionExample implements Queueable, Database.AllowsCallouts {
public void execute(QueueableContext context) {
Account a = new Account(Name='Acme',Phone='(415) 555-1212');
insert a;
}
}
ID jobID = System.enqueueJob(new AsyncExecutionExample());
AsyncApexJob jobInfo = [SELECT Status,NumberOfErrors FROM AsyncApexJob WHERE
Id=:jobID];
Supported but
undocumented
The evolution of @future – Enhanced Futures (pilot)
@future (limits=2xHEAP)
public static void myMemoryHog() { }
@future (limits=3xCPU)
public static void myIntenseLogicalProcessing() { }
Blogged June 2014: Bigger Apex Limits with Enhanced Futures
The evolution of Batch Apex…
The evolution of Batch Apex - Flex Queue
Spring 15
Flex Queue
introduced
95 Batch Apex jobs
in the Flex Queue
waiting to be
processed + 5
concurrent Batch
Apex processes
Reorder Flex Queue
items via a Flex
Queue UI
Summer 15
Reorder Flex Queue
items
programmatically
(pilot)
Winter 16
Reorder Flex Queue
items
programmatically
GA
Reordering Flex Queue items programmatically
Summer 15:
Boolean isSuccess = System.moveFlexQueueJob(jobId, positionNumber);
Winter 16:
Boolean isSuccess = FlexQueue.moveBeforeJob(jobToMoveId, jobInQueueId);
Boolean isSuccess = FlexQueue.moveAfterJob(jobToMoveId, jobInQueueId);
Boolean isSuccess = FlexQueue.moveJobToEnd(jobId);
Boolean isSuccess = FlexQueue.moveJobToFront(jobId);
The evolution of Batch Apex - Flex Queue
Show me the code!
Release Notes:
FlexQueue Class
New Methods
Abort Flex Queue jobs and processing jobs in the same way:
system.abortJob(jobId);
The evolution of Batch Apex - Flex Queue
Show me the code!
• Proof of Concept
• Manage Flex Queue jobs
• Lightning Components
Introducing…
BatchMan
Brad Slater
@innovativebrad
Demo
The further evolution of Batch Apex
Spring 15
Flex Queue
introduced
95 Batch Apex jobs
in the Flex Queue
waiting to be
processed + 5
concurrent Batch
Apex processes
Reorder Flex Queue
items via a Flex
Queue UI
Summer 15
Reorder Flex Queue
items
programmatically
(pilot)
Winter 16
Reorder Flex Queue
items
programmatically
GA
???
Programmatically
determine current
Flex Queue order
Queueable jobs in
Flex Queue
What can Flex Queue
Do for us?
1. Queue up to 100 jobs rather than killing any more than 5
2. Batch Apex no longer limited to admins – if you build an App for your users
3. We can implement our own prioritization mechanism
…. Rememeber, with a great power, comes great responsibility
…. Remember, with great power, comes great responsibility
1. Consider the effect of new job status value on existing Batch management
code
2. Consider the possibility of jobs never being processed
3. Processes may be dependent on one another - strategy for chaining jobs in
the Flex Queue
4. Multiple processes managing the Flex Queue (currently no ability to read the
current order)
Recap
1. Having Several Async Processes
1. @future
2. Queueable
3. Batch Jobs
2. What to do now? Which one to use? Always batch?
1. You should use the one that better fits to your necessity …. The power is now
in your hands!!
Thank you

Contenu connexe

Tendances

Plaλ!
Plaλ!Plaλ!
Plaλ!sihil
 
What's new in c# 8.0
What's new in c# 8.0What's new in c# 8.0
What's new in c# 8.0Moaid Hathot
 
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinC# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinXamarin
 
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge LucaaOS Community
 
Graphs: Fabric of DevOps
Graphs: Fabric of DevOpsGraphs: Fabric of DevOps
Graphs: Fabric of DevOpsNeo4j
 
Continuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket PipelinesContinuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket PipelinesAtlassian
 
REI: Evolving performance engineering for the move to cloud, microservices, c...
REI: Evolving performance engineering for the move to cloud, microservices, c...REI: Evolving performance engineering for the move to cloud, microservices, c...
REI: Evolving performance engineering for the move to cloud, microservices, c...Dynatrace
 
State in stateless serverless functions
State in stateless serverless functionsState in stateless serverless functions
State in stateless serverless functionsAlex Pshul
 
Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!
Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!
Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!Rencore
 
Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...
Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...
Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...Flink Forward
 
Batch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container ServiceBatch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container ServiceAmazon Web Services
 
Fast parallel data loading with the bulk API
Fast parallel data loading with the bulk APIFast parallel data loading with the bulk API
Fast parallel data loading with the bulk APISalesforce Developers
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with ServerlessYan Cui
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowPuppet
 
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of XamarinC# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of XamarinXamarin
 
Azure Durable Functions
Azure Durable FunctionsAzure Durable Functions
Azure Durable FunctionsKarthikeyan VK
 
Modern software testing and processes 2019
Modern software testing and processes 2019Modern software testing and processes 2019
Modern software testing and processes 2019Karim Fanadka
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsSimon Su
 
James Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL appJames Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL appReact Conf Brasil
 

Tendances (20)

Plaλ!
Plaλ!Plaλ!
Plaλ!
 
What's new in c# 8.0
What's new in c# 8.0What's new in c# 8.0
What's new in c# 8.0
 
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinC# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
 
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
 
Graphs: Fabric of DevOps
Graphs: Fabric of DevOpsGraphs: Fabric of DevOps
Graphs: Fabric of DevOps
 
Continuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket PipelinesContinuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket Pipelines
 
REI: Evolving performance engineering for the move to cloud, microservices, c...
REI: Evolving performance engineering for the move to cloud, microservices, c...REI: Evolving performance engineering for the move to cloud, microservices, c...
REI: Evolving performance engineering for the move to cloud, microservices, c...
 
State in stateless serverless functions
State in stateless serverless functionsState in stateless serverless functions
State in stateless serverless functions
 
Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!
Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!
Provisioning SPFx Solutions to SharePoint Online using PnP, ALM APIs and more!
 
Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...
Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...
Flink Forward Berlin 2018: Lasse Nedergaard - "Our successful journey with Fl...
 
Batch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container ServiceBatch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container Service
 
Fast parallel data loading with the bulk API
Fast parallel data loading with the bulk APIFast parallel data loading with the bulk API
Fast parallel data loading with the bulk API
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with Serverless
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of XamarinC# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
 
Presentation tim numann
Presentation tim numannPresentation tim numann
Presentation tim numann
 
Azure Durable Functions
Azure Durable FunctionsAzure Durable Functions
Azure Durable Functions
 
Modern software testing and processes 2019
Modern software testing and processes 2019Modern software testing and processes 2019
Modern software testing and processes 2019
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
 
James Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL appJames Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL app
 

Similaire à Apex Liberation - the evolution of Flex Queue (DF15)

Apex Flex Queue: Batch Apex Liberated
Apex Flex Queue: Batch Apex LiberatedApex Flex Queue: Batch Apex Liberated
Apex Flex Queue: Batch Apex LiberatedCarolEnLaNube
 
WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Samuel De Rycke
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and awaitvfabro
 
Spring Batch Performance Tuning
Spring Batch Performance TuningSpring Batch Performance Tuning
Spring Batch Performance TuningGunnar Hillert
 
Salesforce Summer 14 Release
Salesforce Summer 14 ReleaseSalesforce Summer 14 Release
Salesforce Summer 14 ReleaseJyothylakshmy P.U
 
Building a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management ApplicationBuilding a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management ApplicationJonathan Katz
 
Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...
Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...
Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...Amazon Web Services
 
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...Amazon Web Services
 
Managing the Continuous Delivery of Code to AWS Lambda
Managing the Continuous Delivery of Code to AWS LambdaManaging the Continuous Delivery of Code to AWS Lambda
Managing the Continuous Delivery of Code to AWS LambdaAmazon Web Services
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & PromisesKnoldus Inc.
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Amazon Web Services
 
Spring batch for large enterprises operations
Spring batch for large enterprises operations Spring batch for large enterprises operations
Spring batch for large enterprises operations Ignasi González
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAmazon Web Services
 
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1tServerless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1tToshiaki Maki
 

Similaire à Apex Liberation - the evolution of Flex Queue (DF15) (20)

Apex Flex Queue: Batch Apex Liberated
Apex Flex Queue: Batch Apex LiberatedApex Flex Queue: Batch Apex Liberated
Apex Flex Queue: Batch Apex Liberated
 
WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release Pipelines
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015
 
Salesforce asynchronous apex
Salesforce asynchronous apexSalesforce asynchronous apex
Salesforce asynchronous apex
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
 
Spring Batch Performance Tuning
Spring Batch Performance TuningSpring Batch Performance Tuning
Spring Batch Performance Tuning
 
Salesforce Summer 14 Release
Salesforce Summer 14 ReleaseSalesforce Summer 14 Release
Salesforce Summer 14 Release
 
Building a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management ApplicationBuilding a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management Application
 
Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...
Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...
Releasing Software Quickly and Reliably With AWS CodePipeline by Mark Mansour...
 
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
 
Managing the Continuous Delivery of Code to AWS Lambda
Managing the Continuous Delivery of Code to AWS LambdaManaging the Continuous Delivery of Code to AWS Lambda
Managing the Continuous Delivery of Code to AWS Lambda
 
Introduction to AWS Batch
Introduction to AWS BatchIntroduction to AWS Batch
Introduction to AWS Batch
 
Introduction to AWS Batch
Introduction to AWS BatchIntroduction to AWS Batch
Introduction to AWS Batch
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & Promises
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
 
Spring batch for large enterprises operations
Spring batch for large enterprises operations Spring batch for large enterprises operations
Spring batch for large enterprises operations
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
Introduction to AWS Batch
Introduction to AWS BatchIntroduction to AWS Batch
Introduction to AWS Batch
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for Government
 
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1tServerless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
 

Dernier

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.pptxRustici Software
 
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 FresherRemote DBA Services
 
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 WorkerThousandEyes
 
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, ...Angeliki Cooney
 
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...apidays
 
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, Adobeapidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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 ModelDeepika Singh
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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​Bhuvaneswari Subramani
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
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 educationjfdjdjcjdnsjd
 
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 SavingEdi Saputra
 
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...DianaGray10
 
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 connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
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 2024Victor Rentea
 

Dernier (20)

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
 
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
 
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
 
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, ...
 
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...
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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​
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
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
 
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...
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 

Apex Liberation - the evolution of Flex Queue (DF15)

  • 1. Apex Liberation : The evolution of Flex Queue Carolina Ruiz Medina Principal Developer, Product Innovation team cruiz@financialforce.com @CarolEnLaNube @CodeCoffeeCloud Stephen Willcock Director, Product Innovation swillcock@financialforce.com @stephenwillcock
  • 2. Carolina Ruiz Medina Principal Developer, Product Innovation Team at FinancialForce.com cruiz@financialforce.com @CarolEnLaNube @CodeCoffeeCloud
  • 3. Stephen Willcock Director, Product Innovation at FinancialForce.com swillcock@financialforce.com @stephenwillcock foobarforce.com
  • 4. About GREAT ALONE. BETTER TOGETHER. • Native to Salesforce1™ Platform since 2009 • Investors include Salesforce Ventures • 650+ employees, San Francisco based 4
  • 5. Heavy lifting • Normal Execution limited by Apex Governors • Number of records to process • CPU Time • Heap Size Working Synchronously
  • 7. Making light work Higher limits in Asynchronous • @future • Queueable • Batch • Pipeline (pilot)
  • 8. Execute when there are available resources @future Process a higher number of records Increased Governor Limits in Async We don’t have job id for @future jobs as @future does not return anything The method does not necessarily execute in the same order is called We can’t monitor @future jobs Parameters must be primitive data types
  • 9. @future - show me the code! public with sharing class FutureClass { @future static void myMethod(String a, Integer i) { System.debug(’Primitive variable' + a + ' and ' + i+’But I run ASYNCHROUNOUSLY'); // ALL THE LOGIC HERE } }
  • 10. We can track/monitor the batch jobs: DataBase.executeBatch returns Id We can only run 5 concurrent jobs Batch Apex We can chain batch jobs Possibility to use iterator and process different objects (or none) We cannot reorder or set priorities Process up to 50M records
  • 11. Batch Apex - show me the code! public class UpdateAccountFields implements Database.Batchable<sObject>{ public final String Query; public final String Entity; public final String Field; public final String Value; public UpdateAccountFields(String q, String e, String f, String v){ Query=q; Entity=e; Field=f;Value=v; } public Database.QueryLocator start(Database.BatchableContext BC){ return Database.getQueryLocator(query); } public void execute(Database.BatchableContext BC, List<sObject> scope){ for(Sobject s : scope){s.put(Field,Value); } update scope; } public void finish(Database.BatchableContext BC){ } } Simple Batch Apex Examples
  • 12. Async Limits Execution Governors Batch start Batch execute Batch finish @future Queueable 250,000 method calls in a 24 hour period Scheduled
  • 13. The Evolution… of Async Apex
  • 14. The evolution of @future - Queueable public class AsyncExecutionExample implements Queueable, Database.AllowsCallouts { public void execute(QueueableContext context) { Account a = new Account(Name='Acme',Phone='(415) 555-1212'); insert a; } } ID jobID = System.enqueueJob(new AsyncExecutionExample()); AsyncApexJob jobInfo = [SELECT Status,NumberOfErrors FROM AsyncApexJob WHERE Id=:jobID];
  • 15. The evolution of @future - Queueable public class AsyncExecutionExample implements Queueable, Database.AllowsCallouts { public void execute(QueueableContext context) { Account a = new Account(Name='Acme',Phone='(415) 555-1212'); insert a; } } ID jobID = System.enqueueJob(new AsyncExecutionExample()); AsyncApexJob jobInfo = [SELECT Status,NumberOfErrors FROM AsyncApexJob WHERE Id=:jobID]; Supported but undocumented
  • 16. The evolution of @future – Enhanced Futures (pilot) @future (limits=2xHEAP) public static void myMemoryHog() { } @future (limits=3xCPU) public static void myIntenseLogicalProcessing() { } Blogged June 2014: Bigger Apex Limits with Enhanced Futures
  • 17. The evolution of Batch Apex…
  • 18. The evolution of Batch Apex - Flex Queue Spring 15 Flex Queue introduced 95 Batch Apex jobs in the Flex Queue waiting to be processed + 5 concurrent Batch Apex processes Reorder Flex Queue items via a Flex Queue UI Summer 15 Reorder Flex Queue items programmatically (pilot) Winter 16 Reorder Flex Queue items programmatically GA
  • 19. Reordering Flex Queue items programmatically Summer 15: Boolean isSuccess = System.moveFlexQueueJob(jobId, positionNumber); Winter 16: Boolean isSuccess = FlexQueue.moveBeforeJob(jobToMoveId, jobInQueueId); Boolean isSuccess = FlexQueue.moveAfterJob(jobToMoveId, jobInQueueId); Boolean isSuccess = FlexQueue.moveJobToEnd(jobId); Boolean isSuccess = FlexQueue.moveJobToFront(jobId); The evolution of Batch Apex - Flex Queue Show me the code! Release Notes: FlexQueue Class New Methods
  • 20. Abort Flex Queue jobs and processing jobs in the same way: system.abortJob(jobId); The evolution of Batch Apex - Flex Queue Show me the code!
  • 21. • Proof of Concept • Manage Flex Queue jobs • Lightning Components Introducing… BatchMan Brad Slater @innovativebrad
  • 22. Demo
  • 23. The further evolution of Batch Apex Spring 15 Flex Queue introduced 95 Batch Apex jobs in the Flex Queue waiting to be processed + 5 concurrent Batch Apex processes Reorder Flex Queue items via a Flex Queue UI Summer 15 Reorder Flex Queue items programmatically (pilot) Winter 16 Reorder Flex Queue items programmatically GA ??? Programmatically determine current Flex Queue order Queueable jobs in Flex Queue
  • 24. What can Flex Queue Do for us? 1. Queue up to 100 jobs rather than killing any more than 5 2. Batch Apex no longer limited to admins – if you build an App for your users 3. We can implement our own prioritization mechanism
  • 25. …. Rememeber, with a great power, comes great responsibility
  • 26. …. Remember, with great power, comes great responsibility 1. Consider the effect of new job status value on existing Batch management code 2. Consider the possibility of jobs never being processed 3. Processes may be dependent on one another - strategy for chaining jobs in the Flex Queue 4. Multiple processes managing the Flex Queue (currently no ability to read the current order)
  • 27. Recap 1. Having Several Async Processes 1. @future 2. Queueable 3. Batch Jobs 2. What to do now? Which one to use? Always batch? 1. You should use the one that better fits to your necessity …. The power is now in your hands!!