SlideShare a Scribd company logo
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

More Related Content

What's hot (19)

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.0
Moaid 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 Xamarin
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
aOS Community
 
Graphs: Fabric of DevOps
Graphs: Fabric of DevOpsGraphs: Fabric of DevOps
Graphs: Fabric of DevOps
Neo4j
 
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
Atlassian
 
State in stateless serverless functions
State in stateless serverless functionsState in stateless serverless functions
State in stateless serverless functions
Alex 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
 
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
Salesforce Developers
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with Serverless
Yan Cui
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
Puppet
 
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
Xamarin
 
Presentation tim numann
Presentation tim numannPresentation tim numann
Presentation tim numann
TechDivision GmbH
 
Azure Durable Functions
Azure Durable FunctionsAzure Durable Functions
Azure Durable Functions
Karthikeyan VK
 
Modern software testing and processes 2019
Modern software testing and processes 2019Modern software testing and processes 2019
Modern software testing and processes 2019
Karim Fanadka
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
Simon 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 app
React Conf Brasil
 
Into the cloud
Into the cloudInto the cloud
Into the cloud
Tomas Riha
 
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.0
Moaid 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 Xamarin
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
aOS Community
 
Graphs: Fabric of DevOps
Graphs: Fabric of DevOpsGraphs: Fabric of DevOps
Graphs: Fabric of DevOps
Neo4j
 
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
Atlassian
 
State in stateless serverless functions
State in stateless serverless functionsState in stateless serverless functions
State in stateless serverless functions
Alex 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
 
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
Salesforce Developers
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with Serverless
Yan Cui
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
Puppet
 
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
Xamarin
 
Azure Durable Functions
Azure Durable FunctionsAzure Durable Functions
Azure Durable Functions
Karthikeyan VK
 
Modern software testing and processes 2019
Modern software testing and processes 2019Modern software testing and processes 2019
Modern software testing and processes 2019
Karim Fanadka
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
Simon 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 app
React Conf Brasil
 
Into the cloud
Into the cloudInto the cloud
Into the cloud
Tomas Riha
 

Similar to 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
CarolEnLaNube
 
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
WinOps 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 2015
Samuel De Rycke
 
Salesforce asynchronous apex
Salesforce asynchronous apexSalesforce asynchronous apex
Salesforce asynchronous apex
Badan Singh Pundeer
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
vfabro
 
Spring Batch Performance Tuning
Spring Batch Performance TuningSpring Batch Performance Tuning
Spring Batch Performance Tuning
Gunnar Hillert
 
Salesforce Summer 14 Release
Salesforce Summer 14 ReleaseSalesforce Summer 14 Release
Salesforce Summer 14 Release
Jyothylakshmy 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 Application
Jonathan Katz
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & Promises
Knoldus Inc.
 
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 Python
gturnquist
 
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
Toshiaki Maki
 
Serverless in-action
Serverless in-actionServerless in-action
Serverless in-action
Assaf Gannon
 
slides.pptx
slides.pptxslides.pptx
slides.pptx
abcabc794064
 
Autosys Trainer CV
Autosys Trainer CVAutosys Trainer CV
Autosys Trainer CV
DS gupta
 
Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmers
Salesforce Developers
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
Amit Chaudhary
 
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Salesforce Developers
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong Foundations
Salesforce Developers
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
David Helgerson
 
Apex Flex Queue: Batch Apex Liberated
Apex Flex Queue: Batch Apex LiberatedApex Flex Queue: Batch Apex Liberated
Apex Flex Queue: Batch Apex Liberated
CarolEnLaNube
 
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
WinOps 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 2015
Samuel De Rycke
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
vfabro
 
Spring Batch Performance Tuning
Spring Batch Performance TuningSpring Batch Performance Tuning
Spring Batch Performance Tuning
Gunnar Hillert
 
Salesforce Summer 14 Release
Salesforce Summer 14 ReleaseSalesforce Summer 14 Release
Salesforce Summer 14 Release
Jyothylakshmy 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 Application
Jonathan Katz
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & Promises
Knoldus Inc.
 
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 Python
gturnquist
 
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
Toshiaki Maki
 
Serverless in-action
Serverless in-actionServerless in-action
Serverless in-action
Assaf Gannon
 
Autosys Trainer CV
Autosys Trainer CVAutosys Trainer CV
Autosys Trainer CV
DS gupta
 
Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmers
Salesforce Developers
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
Amit Chaudhary
 
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Salesforce Developers
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong Foundations
Salesforce Developers
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
David Helgerson
 

Recently uploaded (20)

AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
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
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
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
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
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
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
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
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
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
 
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
 
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
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
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
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
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
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
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
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
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
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
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
 
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
 
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
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 

Apex Liberation - the evolution of Flex Queue (DF15)

  • 1. Apex Liberation : The evolution of Flex Queue Carolina Ruiz Medina Principal Developer, Product Innovation team [email protected] @CarolEnLaNube @CodeCoffeeCloud Stephen Willcock Director, Product Innovation [email protected] @stephenwillcock
  • 2. Carolina Ruiz Medina Principal Developer, Product Innovation Team at FinancialForce.com [email protected] @CarolEnLaNube @CodeCoffeeCloud
  • 3. Stephen Willcock Director, Product Innovation at FinancialForce.com [email protected] @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!!