SlideShare a Scribd company logo
Farmington Hills Salesforce Developer User Group
Salesforce Apex Hours :- HyperBatch
#SalesforceApexHours
#FarmingtonHillsSFDCDug
Who am I ?
Amit Chaudhary
• Active on Salesforce Developer Community
• Blogging at http://amitsalesforce.blogspot.in/
• Co-Organizer of :- FarmingtonHillsSFDCDug
• @amit_sfdc
• Amit.salesforce21@gmail.com
Our Speaker
Daniel Peter
• Salesforce MVP
• 22x Certified
• Bay Area Salesforce Dev Group Leader
• Lead Application Engineer, Kenandy
• dan@danpeter.com
• @danieljpeter
Apex Database.Batchable
Why HyperBatch? Speed!
Case study: Account / Contact Batches
• Prerequisite: 121K Accounts already in the system
• CreateContactsBatch: Creates 3 Contacts for each Account with a random “probability” field for
each. 363k Contacts total.
• UpdateAccountsBatch: For each Account, update the highest and lowest probability on the
Account by querying the child Contacts. Get the overall highest and lowest probability across all
the Accounts.
• DeleteContactsBatch: Delete all of the Contacts in the system. Keep a running total of how many
get deleted.
Why HyperBatch? Speed!
CreateContactsBatch
▶ Using traditional Apex Database.Batchable: 45 mins
Why HyperBatch? Speed!
UpdateContactsBatch
▶ Using traditional Apex Database.Batchable: 10 mins
Why HyperBatch? Speed!
DeleteContactsBatch
▶ Using traditional Apex Database.Batchable: 33 mins total (got row lock errors, had to run twice)
Why HyperBatch? Speed!
CreateContactsHyperBatch
▶ Using HyperBatch:
▶ 2 mins 12 seconds
Why HyperBatch? Speed!
UpdateContactsHyperBatch
▶ Using HyperBatch:
▶ 55 seconds
Why HyperBatch? Speed!
DeleteContactsHyperBatch
▶ Using HyperBatch:
▶ 3 mins 15 seconds
▶ RowLock / retry
▶ 9500 Batch Size
Why HyperBatch? Speed!
Operation Database.Batchable HyperBatch Difference Percentage
CreateContacts 45 1.4 43.6 3.2%
UpdateContacts 10 0.9 9.1 9.9%
DeleteContacts 33 3.25 29.8 10.9%
Total 88 5.55 82.5 6.7%
Why HyperBatch? Speed!
Summary
▶ Running all 3 example batch jobs takes only 6 mins instead of 88 mins.
▶ You save 82 mins.
▶ It only takes 6.7% of the time!
Why HyperBatch? User Experience
Traditional Apex Batch HyperBatch
Why HyperBatch? Concurrency
▶ Asynchronous
▶ Apex Batch
▶ 5 running per org
▶ HyperBatch
▶ Not subject to 50 job per transaction limit (each request is a new transaction)
▶ Synchronous
▶ Apex Batch
▶ N/A
▶ HyperBatch
▶ 10 long running per org, unlimited otherwise
Why HyperBatch? Concurrency
Why HyperBatch? Concurrency
Row lock behavior
▶ Apex Batch: default is a failed batch execution. Retry logic can be built, but it will likely exceed
the transaction limits.
▶ HyperBatch: row locks retry automatically until the transaction succeeds. Each re-attempt gets a
new context!
How it Works - Summary
• HyperBatch interface that mimics the Database.Batchable interface.
• Browser orchestration for selecting jobs and running them on-demand.
• Lightning Design System, Visualforce (Lightning Components would be a data bottleneck).
• AJAX toolkit for PK chunking the query locator.
• Wrapping requests in unique identifiers for closed loop execution – JavaScript function binding.
• Each execute can return some state of type Object, it can be anything.
• Async
• Parallel remote actions fire the qeueables for the batch executions methods. (Not serial!)
• JavaScript polls for the status of the qeueables, waiting for them to complete.
• Execute state is stored in a custom object, and a list of them is returned to the finish() method, then they are deleted.
• Sync
• Parallel remote actions fire the synchronous transactions. (Not serial!)
• Execute state is returned synchronously and stored in JavaScript in the browser until they are all complete.
How it Works - Interface
How it Works – Asynchronous Architecture
How it Works – Synchronous Architecture
synchronous vs. asynchronous governor limits
Synchronous Asynchronous
SOQL Queries 100 200
Heap Size 6MB 12MB
CPU Time 10 seconds 60 seconds
Demo
New Features
• Synchronous mode
• Batch Size Control
• Test Methods
Roadmap
• Throttle requests (x number of open connections)
• Enhance the user interface
• Support custom iterators instead of just query locator
• Support simple data operations like update a field or delete records without having to write Apex
• Chunk in 2 dimensions: (Parent Id, then Record Id) to avoid row lock errors
• Sequence batches in series (run a batch after a batch)
Resources
• Salesforce Developer Blogs
• “Data Chunking Techniques for Massive Orgs“ by Daniel Peter
(https://developer.salesforce.com/blogs/developer-relations/2015/11/pk-chunking-techniques-massive-
orgs.html)
• “French Touch Dreamin’ – The first community-led event in France” by Philippe Ozil
(https://developer.salesforce.com/blogs/developer-relations/2016/11/french-touch-dreamin-first-
community-led-event-france.html)
• Presentation from Forcelandia 2016: “PK Chunking – Divide and conquer massive objects in
Salesforce” (http://www.slideshare.net/danieljpeter/forcelandia-2016-pk-chunking)
• GitHub repo: HyperBatch (https://github.com/danieljpeter/HyperBatch)
Thank You
Thank you for attending the session.
Follow Farmington Hills SFDC Developer Group
Twitter Hashtag
#FarmingtonHillsSFDCDug
Meetup.com
https://www.meetup.com/Farmington-Hills-Salesforce-Developer-Meetup/
Facebook Page
https://www.facebook.com/FarmingtonHillsSfdcdug/?ref=bookmarks

More Related Content

What's hot

Dive in burpsuite
Dive in burpsuiteDive in burpsuite
Dive in burpsuite
Nadim Kadiwala
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
Jiangjie Qin
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
Kasun Indrasiri
 
Making the big data ecosystem work together with python apache arrow, spark,...
Making the big data ecosystem work together with python  apache arrow, spark,...Making the big data ecosystem work together with python  apache arrow, spark,...
Making the big data ecosystem work together with python apache arrow, spark,...
Holden Karau
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
Haris456
 
Facebook Messages & HBase
Facebook Messages & HBaseFacebook Messages & HBase
Facebook Messages & HBase
强 王
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
Jiangjie Qin
 
Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)
Ferran Galí Reniu
 
How to Performance-Tune Apache Spark Applications in Large Clusters
How to Performance-Tune Apache Spark Applications in Large ClustersHow to Performance-Tune Apache Spark Applications in Large Clusters
How to Performance-Tune Apache Spark Applications in Large Clusters
Databricks
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in Scala
Knoldus Inc.
 
Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...
Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...
Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...
Till Rohrmann
 
Teradata utilities-fast export
Teradata utilities-fast exportTeradata utilities-fast export
Teradata utilities-fast exportSatti Kumar
 
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
confluent
 
MyRocks introduction and production deployment
MyRocks introduction and production deploymentMyRocks introduction and production deployment
MyRocks introduction and production deployment
Yoshinori Matsunobu
 
Apache Arrow Flight Overview
Apache Arrow Flight OverviewApache Arrow Flight Overview
Apache Arrow Flight Overview
Jacques Nadeau
 
Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...
Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...
Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...
confluent
 
Spark on yarn
Spark on yarnSpark on yarn
Spark on yarn
datamantra
 
Fight with Metaspace OOM
Fight with Metaspace OOMFight with Metaspace OOM
Fight with Metaspace OOM
Leon Chen
 
Where is my bottleneck? Performance troubleshooting in Flink
Where is my bottleneck? Performance troubleshooting in FlinkWhere is my bottleneck? Performance troubleshooting in Flink
Where is my bottleneck? Performance troubleshooting in Flink
Flink Forward
 

What's hot (20)

Dive in burpsuite
Dive in burpsuiteDive in burpsuite
Dive in burpsuite
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
 
Making the big data ecosystem work together with python apache arrow, spark,...
Making the big data ecosystem work together with python  apache arrow, spark,...Making the big data ecosystem work together with python  apache arrow, spark,...
Making the big data ecosystem work together with python apache arrow, spark,...
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
 
Facebook Messages & HBase
Facebook Messages & HBaseFacebook Messages & HBase
Facebook Messages & HBase
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
 
Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)Yarn by default (Spark on YARN)
Yarn by default (Spark on YARN)
 
How to Performance-Tune Apache Spark Applications in Large Clusters
How to Performance-Tune Apache Spark Applications in Large ClustersHow to Performance-Tune Apache Spark Applications in Large Clusters
How to Performance-Tune Apache Spark Applications in Large Clusters
 
Tomcatx performance-tuning
Tomcatx performance-tuningTomcatx performance-tuning
Tomcatx performance-tuning
 
Logging with Logback in Scala
Logging with Logback in ScalaLogging with Logback in Scala
Logging with Logback in Scala
 
Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...
Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...
Dynamic Scaling: How Apache Flink Adapts to Changing Workloads (at FlinkForwa...
 
Teradata utilities-fast export
Teradata utilities-fast exportTeradata utilities-fast export
Teradata utilities-fast export
 
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
Performance Tuning RocksDB for Kafka Streams' State Stores (Dhruba Borthakur,...
 
MyRocks introduction and production deployment
MyRocks introduction and production deploymentMyRocks introduction and production deployment
MyRocks introduction and production deployment
 
Apache Arrow Flight Overview
Apache Arrow Flight OverviewApache Arrow Flight Overview
Apache Arrow Flight Overview
 
Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...
Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...
Why My Streaming Job is Slow - Profiling and Optimizing Kafka Streams Apps (L...
 
Spark on yarn
Spark on yarnSpark on yarn
Spark on yarn
 
Fight with Metaspace OOM
Fight with Metaspace OOMFight with Metaspace OOM
Fight with Metaspace OOM
 
Where is my bottleneck? Performance troubleshooting in Flink
Where is my bottleneck? Performance troubleshooting in FlinkWhere is my bottleneck? Performance troubleshooting in Flink
Where is my bottleneck? Performance troubleshooting in Flink
 

Similar to Salesforce Apex Hours :- Hyper batch

Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Daniel Peter
 
HyperBatch
HyperBatchHyperBatch
HyperBatch
Daniel Peter
 
Hyperbatch danielpeter-161117095610
Hyperbatch danielpeter-161117095610Hyperbatch danielpeter-161117095610
Hyperbatch danielpeter-161117095610
Sandeep Dobariya
 
HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017
Daniel Peter
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster Websites
Craig Walker
 
Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)
Klas Berlič Fras
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
Jonathan Klein
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Panagiotis Kanavos
 
SenchaCon Roadshow Irvine 2017
SenchaCon Roadshow Irvine 2017SenchaCon Roadshow Irvine 2017
SenchaCon Roadshow Irvine 2017
Speedment, Inc.
 
Asynchronous apex
Asynchronous apexAsynchronous apex
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
Sumitkumar Shingavi
 
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
Amazon Web Services
 
SFDC Batch Apex
SFDC Batch ApexSFDC Batch Apex
SFDC Batch Apex
Sujit Kumar
 
Next Gen Big Data Analytics with Apache Apex
Next Gen Big Data Analytics with Apache Apex Next Gen Big Data Analytics with Apache Apex
Next Gen Big Data Analytics with Apache Apex
DataWorks Summit/Hadoop Summit
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
Jonathan Klein
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Malin Weiss
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Speedment, Inc.
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
Roger Xia
 

Similar to Salesforce Apex Hours :- Hyper batch (20)

Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017
 
HyperBatch
HyperBatchHyperBatch
HyperBatch
 
Hyperbatch danielpeter-161117095610
Hyperbatch danielpeter-161117095610Hyperbatch danielpeter-161117095610
Hyperbatch danielpeter-161117095610
 
HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster Websites
 
Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
 
SenchaCon Roadshow Irvine 2017
SenchaCon Roadshow Irvine 2017SenchaCon Roadshow Irvine 2017
SenchaCon Roadshow Irvine 2017
 
Asynchronous apex
Asynchronous apexAsynchronous apex
Asynchronous apex
 
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
 
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
AWS re:Invent 2016: How Fulfillment by Amazon (FBA) and Scopely Improved Resu...
 
SFDC Batch Apex
SFDC Batch ApexSFDC Batch Apex
SFDC Batch Apex
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Next Gen Big Data Analytics with Apache Apex
Next Gen Big Data Analytics with Apache Apex Next Gen Big Data Analytics with Apache Apex
Next Gen Big Data Analytics with Apache Apex
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 
Fixing_Twitter
Fixing_TwitterFixing_Twitter
Fixing_Twitter
 

More from Amit Chaudhary

Platform cache
Platform cachePlatform cache
Platform cache
Amit Chaudhary
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
Amit Chaudhary
 
Empower admins with the power of salesforce dx, git and cicd pipeline
Empower admins with the power of salesforce dx, git and cicd pipelineEmpower admins with the power of salesforce dx, git and cicd pipeline
Empower admins with the power of salesforce dx, git and cicd pipeline
Amit Chaudhary
 
Marketing cloud development
Marketing cloud developmentMarketing cloud development
Marketing cloud development
Amit Chaudhary
 
Salesforce Apex Hours : Node red for salesforce
Salesforce Apex Hours : Node red for salesforceSalesforce Apex Hours : Node red for salesforce
Salesforce Apex Hours : Node red for salesforce
Amit Chaudhary
 
Modular application development using unlocked packages
Modular application development using unlocked packagesModular application development using unlocked packages
Modular application development using unlocked packages
Amit Chaudhary
 
Einstein Next Best Action (NBA)
Einstein Next Best Action (NBA)Einstein Next Best Action (NBA)
Einstein Next Best Action (NBA)
Amit Chaudhary
 
Pardot basics
Pardot basicsPardot basics
Pardot basics
Amit Chaudhary
 
Lightning web components
Lightning web componentsLightning web components
Lightning web components
Amit Chaudhary
 
Lightning web components
Lightning web componentsLightning web components
Lightning web components
Amit Chaudhary
 
Lightning Locker Services
Lightning Locker ServicesLightning Locker Services
Lightning Locker Services
Amit Chaudhary
 
Salesforce apex hours heroku connect - deep dive
Salesforce apex hours   heroku connect - deep diveSalesforce apex hours   heroku connect - deep dive
Salesforce apex hours heroku connect - deep dive
Amit Chaudhary
 
Salesforce apex hours :- azure active directory seamless single sign-on with...
Salesforce apex hours  :- azure active directory seamless single sign-on with...Salesforce apex hours  :- azure active directory seamless single sign-on with...
Salesforce apex hours :- azure active directory seamless single sign-on with...
Amit Chaudhary
 
Salesforce DX for Non-Scratch Org
Salesforce DX for Non-Scratch OrgSalesforce DX for Non-Scratch Org
Salesforce DX for Non-Scratch Org
Amit Chaudhary
 
Einstein Analytics Part 2
Einstein Analytics Part 2Einstein Analytics Part 2
Einstein Analytics Part 2
Amit Chaudhary
 
Einstein Analytics
Einstein Analytics Einstein Analytics
Einstein Analytics
Amit Chaudhary
 
Demystifying the salesforce reports api
Demystifying the salesforce reports apiDemystifying the salesforce reports api
Demystifying the salesforce reports api
Amit Chaudhary
 
Salesforce apex hours Einstein platform services
Salesforce apex hours   Einstein platform servicesSalesforce apex hours   Einstein platform services
Salesforce apex hours Einstein platform services
Amit Chaudhary
 
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDVSalesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Amit Chaudhary
 
Einstein bots
Einstein botsEinstein bots
Einstein bots
Amit Chaudhary
 

More from Amit Chaudhary (20)

Platform cache
Platform cachePlatform cache
Platform cache
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
 
Empower admins with the power of salesforce dx, git and cicd pipeline
Empower admins with the power of salesforce dx, git and cicd pipelineEmpower admins with the power of salesforce dx, git and cicd pipeline
Empower admins with the power of salesforce dx, git and cicd pipeline
 
Marketing cloud development
Marketing cloud developmentMarketing cloud development
Marketing cloud development
 
Salesforce Apex Hours : Node red for salesforce
Salesforce Apex Hours : Node red for salesforceSalesforce Apex Hours : Node red for salesforce
Salesforce Apex Hours : Node red for salesforce
 
Modular application development using unlocked packages
Modular application development using unlocked packagesModular application development using unlocked packages
Modular application development using unlocked packages
 
Einstein Next Best Action (NBA)
Einstein Next Best Action (NBA)Einstein Next Best Action (NBA)
Einstein Next Best Action (NBA)
 
Pardot basics
Pardot basicsPardot basics
Pardot basics
 
Lightning web components
Lightning web componentsLightning web components
Lightning web components
 
Lightning web components
Lightning web componentsLightning web components
Lightning web components
 
Lightning Locker Services
Lightning Locker ServicesLightning Locker Services
Lightning Locker Services
 
Salesforce apex hours heroku connect - deep dive
Salesforce apex hours   heroku connect - deep diveSalesforce apex hours   heroku connect - deep dive
Salesforce apex hours heroku connect - deep dive
 
Salesforce apex hours :- azure active directory seamless single sign-on with...
Salesforce apex hours  :- azure active directory seamless single sign-on with...Salesforce apex hours  :- azure active directory seamless single sign-on with...
Salesforce apex hours :- azure active directory seamless single sign-on with...
 
Salesforce DX for Non-Scratch Org
Salesforce DX for Non-Scratch OrgSalesforce DX for Non-Scratch Org
Salesforce DX for Non-Scratch Org
 
Einstein Analytics Part 2
Einstein Analytics Part 2Einstein Analytics Part 2
Einstein Analytics Part 2
 
Einstein Analytics
Einstein Analytics Einstein Analytics
Einstein Analytics
 
Demystifying the salesforce reports api
Demystifying the salesforce reports apiDemystifying the salesforce reports api
Demystifying the salesforce reports api
 
Salesforce apex hours Einstein platform services
Salesforce apex hours   Einstein platform servicesSalesforce apex hours   Einstein platform services
Salesforce apex hours Einstein platform services
 
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDVSalesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
 
Einstein bots
Einstein botsEinstein bots
Einstein bots
 

Recently uploaded

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 

Recently uploaded (20)

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 

Salesforce Apex Hours :- Hyper batch

  • 1. Farmington Hills Salesforce Developer User Group Salesforce Apex Hours :- HyperBatch #SalesforceApexHours #FarmingtonHillsSFDCDug
  • 2. Who am I ? Amit Chaudhary • Active on Salesforce Developer Community • Blogging at http://amitsalesforce.blogspot.in/ • Co-Organizer of :- FarmingtonHillsSFDCDug • @amit_sfdc • Amit.salesforce21@gmail.com
  • 3. Our Speaker Daniel Peter • Salesforce MVP • 22x Certified • Bay Area Salesforce Dev Group Leader • Lead Application Engineer, Kenandy • dan@danpeter.com • @danieljpeter
  • 5. Why HyperBatch? Speed! Case study: Account / Contact Batches • Prerequisite: 121K Accounts already in the system • CreateContactsBatch: Creates 3 Contacts for each Account with a random “probability” field for each. 363k Contacts total. • UpdateAccountsBatch: For each Account, update the highest and lowest probability on the Account by querying the child Contacts. Get the overall highest and lowest probability across all the Accounts. • DeleteContactsBatch: Delete all of the Contacts in the system. Keep a running total of how many get deleted.
  • 6. Why HyperBatch? Speed! CreateContactsBatch ▶ Using traditional Apex Database.Batchable: 45 mins
  • 7. Why HyperBatch? Speed! UpdateContactsBatch ▶ Using traditional Apex Database.Batchable: 10 mins
  • 8. Why HyperBatch? Speed! DeleteContactsBatch ▶ Using traditional Apex Database.Batchable: 33 mins total (got row lock errors, had to run twice)
  • 9. Why HyperBatch? Speed! CreateContactsHyperBatch ▶ Using HyperBatch: ▶ 2 mins 12 seconds
  • 10. Why HyperBatch? Speed! UpdateContactsHyperBatch ▶ Using HyperBatch: ▶ 55 seconds
  • 11. Why HyperBatch? Speed! DeleteContactsHyperBatch ▶ Using HyperBatch: ▶ 3 mins 15 seconds ▶ RowLock / retry ▶ 9500 Batch Size
  • 12. Why HyperBatch? Speed! Operation Database.Batchable HyperBatch Difference Percentage CreateContacts 45 1.4 43.6 3.2% UpdateContacts 10 0.9 9.1 9.9% DeleteContacts 33 3.25 29.8 10.9% Total 88 5.55 82.5 6.7%
  • 13. Why HyperBatch? Speed! Summary ▶ Running all 3 example batch jobs takes only 6 mins instead of 88 mins. ▶ You save 82 mins. ▶ It only takes 6.7% of the time!
  • 14. Why HyperBatch? User Experience Traditional Apex Batch HyperBatch
  • 15. Why HyperBatch? Concurrency ▶ Asynchronous ▶ Apex Batch ▶ 5 running per org ▶ HyperBatch ▶ Not subject to 50 job per transaction limit (each request is a new transaction) ▶ Synchronous ▶ Apex Batch ▶ N/A ▶ HyperBatch ▶ 10 long running per org, unlimited otherwise
  • 17. Why HyperBatch? Concurrency Row lock behavior ▶ Apex Batch: default is a failed batch execution. Retry logic can be built, but it will likely exceed the transaction limits. ▶ HyperBatch: row locks retry automatically until the transaction succeeds. Each re-attempt gets a new context!
  • 18. How it Works - Summary • HyperBatch interface that mimics the Database.Batchable interface. • Browser orchestration for selecting jobs and running them on-demand. • Lightning Design System, Visualforce (Lightning Components would be a data bottleneck). • AJAX toolkit for PK chunking the query locator. • Wrapping requests in unique identifiers for closed loop execution – JavaScript function binding. • Each execute can return some state of type Object, it can be anything. • Async • Parallel remote actions fire the qeueables for the batch executions methods. (Not serial!) • JavaScript polls for the status of the qeueables, waiting for them to complete. • Execute state is stored in a custom object, and a list of them is returned to the finish() method, then they are deleted. • Sync • Parallel remote actions fire the synchronous transactions. (Not serial!) • Execute state is returned synchronously and stored in JavaScript in the browser until they are all complete.
  • 19. How it Works - Interface
  • 20. How it Works – Asynchronous Architecture
  • 21. How it Works – Synchronous Architecture
  • 22.
  • 23. synchronous vs. asynchronous governor limits Synchronous Asynchronous SOQL Queries 100 200 Heap Size 6MB 12MB CPU Time 10 seconds 60 seconds
  • 24. Demo
  • 25. New Features • Synchronous mode • Batch Size Control • Test Methods
  • 26. Roadmap • Throttle requests (x number of open connections) • Enhance the user interface • Support custom iterators instead of just query locator • Support simple data operations like update a field or delete records without having to write Apex • Chunk in 2 dimensions: (Parent Id, then Record Id) to avoid row lock errors • Sequence batches in series (run a batch after a batch)
  • 27. Resources • Salesforce Developer Blogs • “Data Chunking Techniques for Massive Orgs“ by Daniel Peter (https://developer.salesforce.com/blogs/developer-relations/2015/11/pk-chunking-techniques-massive- orgs.html) • “French Touch Dreamin’ – The first community-led event in France” by Philippe Ozil (https://developer.salesforce.com/blogs/developer-relations/2016/11/french-touch-dreamin-first- community-led-event-france.html) • Presentation from Forcelandia 2016: “PK Chunking – Divide and conquer massive objects in Salesforce” (http://www.slideshare.net/danieljpeter/forcelandia-2016-pk-chunking) • GitHub repo: HyperBatch (https://github.com/danieljpeter/HyperBatch)
  • 28. Thank You Thank you for attending the session.
  • 29. Follow Farmington Hills SFDC Developer Group Twitter Hashtag #FarmingtonHillsSFDCDug Meetup.com https://www.meetup.com/Farmington-Hills-Salesforce-Developer-Meetup/ Facebook Page https://www.facebook.com/FarmingtonHillsSfdcdug/?ref=bookmarks