SlideShare a Scribd company logo
1 of 22
Download to read offline
HyperBatch
​Daniel PETER
​Lead Applications Engineer, Kenandy
​Salesforce MVP
​Bay Area Salesforce Developer User Group Organizer
​20x certified
​dan@danpeter.com
​@danieljpeter
A Hyper-Fast Batchable Interface for Salesforce
Apex Database.Batchable
​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.
Speed!
Why HyperBatch?
​CreateContactsBatch
​Using traditional Apex Database.Batchable: 45 mins
Speed!
Why HyperBatch?
​UpdateContactsBatch
​Using traditional Apex Database.Batchable: 10 mins
Speed!
Why HyperBatch?
​DeleteContactsBatch
​Using traditional Apex Database.Batchable: 33 mins total (got row lock errors, had to run twice)
Speed!
Why HyperBatch?
​CreateContactsHyperBatch
​Using HyperBatch: 2 mins 12 seconds
Speed!
Why HyperBatch?
​UpdateContactsHyperBatch
​Using HyperBatch: 38 seconds
Speed!
Why HyperBatch?
​DeleteContactsHyperBatch
​Using HyperBatch: 1 min, 11 seconds
Speed!
Why HyperBatch?
Speed!
Why HyperBatch?
Operation Database.Batchable HyperBatch Difference Percentage
CreateContacts 45 2.2 42.8 4.9%
UpdateContacts 10 0.6 9.4 6.3%
DeleteContacts 33 1.2 28 3.6%
Total 88 4 84 4.6%
​Summary
​Running all 3 example batch jobs takes only 4 mins instead of
88 mins.
​You save 84 mins.
​It only takes 4.6% of the time!
Speed!
Why HyperBatch?
User Experience
Why HyperBatch?
​Traditional Apex batch ​HyperBatch
Concurrency
Why HyperBatch?
​Max concurrent jobs processing
​Apex Batch: 5 per org
​HyperBatch: ? 20 / user?
Concurrency
Why HyperBatch?
​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 succeed. Each re-attempt gets a new
context!
Summary
How it works
• 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.
• Parallel remote actions fire the qeueables for the batch executions methods. (Not serial!)
• Wrapping requests in unique identifiers for closed loop execution – JavaScript function binding.
• JavaScript polls for the status of the qeueables, waiting for them to complete.
• Each execute can return some state of type Object, it can be anything. These are stored in a
custom object, and a list of them is returned to the finish() method, then they are deleted.
Interface
How it works
HyperBatch Architecture
Roadmap
• Enhance the user interface
• Test methods
• 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
• 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)
• 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)
Resources
Q & A
​Daniel PETER
​Lead Applications Engineer, Kenandy
​Salesforce MVP
​Bay Area Salesforce Developer User Group Organizer
​20x certified
​dan@danpeter.com
​@danieljpeter
Merci
​Daniel PETER
​Lead Applications Engineer, Kenandy
​Salesforce MVP
​Bay Area Salesforce Developer User Group Organizer
​20x certified
​dan@danpeter.com
​@danieljpeter

More Related Content

What's hot

What's hot (20)

Exploring the Salesforce REST API
Exploring the Salesforce REST APIExploring the Salesforce REST API
Exploring the Salesforce REST API
 
A complete Salesforce implementation guide on how to implement Salesforce
A complete Salesforce implementation guide on how to implement SalesforceA complete Salesforce implementation guide on how to implement Salesforce
A complete Salesforce implementation guide on how to implement Salesforce
 
Salesforce Lightning Process builder
Salesforce Lightning Process builderSalesforce Lightning Process builder
Salesforce Lightning Process builder
 
Data Warehouse Best Practices
Data Warehouse Best PracticesData Warehouse Best Practices
Data Warehouse Best Practices
 
A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Salesforce Steelbrick CPQ Overview
Salesforce Steelbrick CPQ OverviewSalesforce Steelbrick CPQ Overview
Salesforce Steelbrick CPQ Overview
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Sales Cloud Lightning Migration Best Practices
Sales Cloud Lightning Migration Best PracticesSales Cloud Lightning Migration Best Practices
Sales Cloud Lightning Migration Best Practices
 
SAP Testing with SolMan and SAP Quality Center
SAP Testing with SolMan and SAP Quality CenterSAP Testing with SolMan and SAP Quality Center
SAP Testing with SolMan and SAP Quality Center
 
Going Serverless with CQRS on AWS
Going Serverless with CQRS on AWSGoing Serverless with CQRS on AWS
Going Serverless with CQRS on AWS
 
Salesforce integration best practices columbus meetup
Salesforce integration best practices   columbus meetupSalesforce integration best practices   columbus meetup
Salesforce integration best practices columbus meetup
 
Profiles and permission sets in salesforce
Profiles and permission sets in salesforceProfiles and permission sets in salesforce
Profiles and permission sets in salesforce
 
Salesforce CPQ
Salesforce CPQSalesforce CPQ
Salesforce CPQ
 
Salesforce Interview Questions And Answers | Salesforce Tutorial | Salesforce...
Salesforce Interview Questions And Answers | Salesforce Tutorial | Salesforce...Salesforce Interview Questions And Answers | Salesforce Tutorial | Salesforce...
Salesforce Interview Questions And Answers | Salesforce Tutorial | Salesforce...
 
Salesforce PPT.pptx
Salesforce PPT.pptxSalesforce PPT.pptx
Salesforce PPT.pptx
 
Data Streaming with Apache Kafka in the Defence and Cybersecurity Industry
Data Streaming with Apache Kafka in the Defence and Cybersecurity IndustryData Streaming with Apache Kafka in the Defence and Cybersecurity Industry
Data Streaming with Apache Kafka in the Defence and Cybersecurity Industry
 
Flow builder pros and cons
Flow builder pros and consFlow builder pros and cons
Flow builder pros and cons
 
Metrics Worth Measuring: Align Business Goals to Salesforce Adoption
Metrics Worth Measuring: Align Business Goals to Salesforce AdoptionMetrics Worth Measuring: Align Business Goals to Salesforce Adoption
Metrics Worth Measuring: Align Business Goals to Salesforce Adoption
 
Salesforce Streaming event - PushTopic and Generic Events
Salesforce Streaming event - PushTopic and Generic EventsSalesforce Streaming event - PushTopic and Generic Events
Salesforce Streaming event - PushTopic and Generic Events
 

Viewers also liked

Providence: rapid vulnerability prevention
Providence: rapid vulnerability preventionProvidence: rapid vulnerability prevention
Providence: rapid vulnerability prevention
Salesforce Engineering
 

Viewers also liked (9)

HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017
 
LDS salesforce saturday
LDS  salesforce saturdayLDS  salesforce saturday
LDS salesforce saturday
 
Tree Traversal #SalesforceSaturday
Tree Traversal #SalesforceSaturdayTree Traversal #SalesforceSaturday
Tree Traversal #SalesforceSaturday
 
Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017
 
Providence: rapid vulnerability prevention
Providence: rapid vulnerability preventionProvidence: rapid vulnerability prevention
Providence: rapid vulnerability prevention
 
Forcelandia 2016 PK Chunking
Forcelandia 2016 PK ChunkingForcelandia 2016 PK Chunking
Forcelandia 2016 PK Chunking
 
Build Great Triggers Quickly with STP (the Simple Trigger Pattern)
Build Great Triggers Quickly with STP (the Simple Trigger Pattern)Build Great Triggers Quickly with STP (the Simple Trigger Pattern)
Build Great Triggers Quickly with STP (the Simple Trigger Pattern)
 
Building a Single Page App with Lightning Components
Building a Single Page App with Lightning ComponentsBuilding a Single Page App with Lightning Components
Building a Single Page App with Lightning Components
 
Design in Tech Report 2017
Design in Tech Report 2017Design in Tech Report 2017
Design in Tech Report 2017
 

Similar to HyperBatch

Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
xlight
 
Keep your Metadata Repository Current with Event-Driven Updates using CDC and...
Keep your Metadata Repository Current with Event-Driven Updates using CDC and...Keep your Metadata Repository Current with Event-Driven Updates using CDC and...
Keep your Metadata Repository Current with Event-Driven Updates using CDC and...
confluent
 
SnappyData, the Spark Database. A unified cluster for streaming, transactions...
SnappyData, the Spark Database. A unified cluster for streaming, transactions...SnappyData, the Spark Database. A unified cluster for streaming, transactions...
SnappyData, the Spark Database. A unified cluster for streaming, transactions...
SnappyData
 

Similar to HyperBatch (20)

Salesforce Apex Hours :- Hyper batch
Salesforce Apex Hours :- Hyper batchSalesforce Apex Hours :- Hyper batch
Salesforce Apex Hours :- Hyper batch
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 
Fixing_Twitter
Fixing_TwitterFixing_Twitter
Fixing_Twitter
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Keep your Metadata Repository Current with Event-Driven Updates using CDC and...
Keep your Metadata Repository Current with Event-Driven Updates using CDC and...Keep your Metadata Repository Current with Event-Driven Updates using CDC and...
Keep your Metadata Repository Current with Event-Driven Updates using CDC and...
 
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshootingTarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
 
Building FoundationDB
Building FoundationDBBuilding FoundationDB
Building FoundationDB
 
Azure saturday pn 2018
Azure saturday pn 2018Azure saturday pn 2018
Azure saturday pn 2018
 
SnappyData, the Spark Database. A unified cluster for streaming, transactions...
SnappyData, the Spark Database. A unified cluster for streaming, transactions...SnappyData, the Spark Database. A unified cluster for streaming, transactions...
SnappyData, the Spark Database. A unified cluster for streaming, transactions...
 
SnappyData at Spark Summit 2017
SnappyData at Spark Summit 2017SnappyData at Spark Summit 2017
SnappyData at Spark Summit 2017
 
Drinking from the Firehose - Real-time Metrics
Drinking from the Firehose - Real-time MetricsDrinking from the Firehose - Real-time Metrics
Drinking from the Firehose - Real-time Metrics
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
 
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and TransformIntro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
 
Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)
 
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]
 
Databus - Abhishek Bhargava & Maheswaran Veluchamy - DevOps Bangalore Meetup...
Databus - Abhishek Bhargava &  Maheswaran Veluchamy - DevOps Bangalore Meetup...Databus - Abhishek Bhargava &  Maheswaran Veluchamy - DevOps Bangalore Meetup...
Databus - Abhishek Bhargava & Maheswaran Veluchamy - DevOps Bangalore Meetup...
 
Square Peg Round Hole: Serverless Solutions For Non-Serverless Problems
Square Peg Round Hole: Serverless Solutions For Non-Serverless ProblemsSquare Peg Round Hole: Serverless Solutions For Non-Serverless Problems
Square Peg Round Hole: Serverless Solutions For Non-Serverless Problems
 
Spring batch for large enterprises operations
Spring batch for large enterprises operations Spring batch for large enterprises operations
Spring batch for large enterprises operations
 

More from Daniel Peter

Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
Daniel Peter
 

More from Daniel Peter (11)

Salesforce Slack Demo Cactusforce 2022
Salesforce Slack Demo Cactusforce 2022Salesforce Slack Demo Cactusforce 2022
Salesforce Slack Demo Cactusforce 2022
 
Rules-based Record Generation with Custom Metadata Types
Rules-based Record Generation with Custom Metadata Types Rules-based Record Generation with Custom Metadata Types
Rules-based Record Generation with Custom Metadata Types
 
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
 
No Refresh Needed
No Refresh NeededNo Refresh Needed
No Refresh Needed
 
Using Custom Permissions to Simplify Security
Using Custom Permissions to Simplify SecurityUsing Custom Permissions to Simplify Security
Using Custom Permissions to Simplify Security
 
DF Global Gathering PuneWIT
DF Global Gathering PuneWITDF Global Gathering PuneWIT
DF Global Gathering PuneWIT
 
Dreamforce Global Gathering Bangaluru 2017
Dreamforce Global Gathering Bangaluru 2017Dreamforce Global Gathering Bangaluru 2017
Dreamforce Global Gathering Bangaluru 2017
 
Blaze a Trail to Predictive Selling With Einstein Intent
Blaze a Trail to Predictive Selling With Einstein IntentBlaze a Trail to Predictive Selling With Einstein Intent
Blaze a Trail to Predictive Selling With Einstein Intent
 
PK chunking presentation from Tahoe Dreamin' 2016
PK chunking presentation from Tahoe Dreamin' 2016PK chunking presentation from Tahoe Dreamin' 2016
PK chunking presentation from Tahoe Dreamin' 2016
 
Lightning Reports - Dreamforce 2015
Lightning Reports - Dreamforce 2015Lightning Reports - Dreamforce 2015
Lightning Reports - Dreamforce 2015
 
Callout architecture
Callout architectureCallout architecture
Callout architecture
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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​
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

HyperBatch

  • 1. HyperBatch ​Daniel PETER ​Lead Applications Engineer, Kenandy ​Salesforce MVP ​Bay Area Salesforce Developer User Group Organizer ​20x certified ​dan@danpeter.com ​@danieljpeter A Hyper-Fast Batchable Interface for Salesforce
  • 3. ​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. Speed! Why HyperBatch?
  • 4. ​CreateContactsBatch ​Using traditional Apex Database.Batchable: 45 mins Speed! Why HyperBatch?
  • 5. ​UpdateContactsBatch ​Using traditional Apex Database.Batchable: 10 mins Speed! Why HyperBatch?
  • 6. ​DeleteContactsBatch ​Using traditional Apex Database.Batchable: 33 mins total (got row lock errors, had to run twice) Speed! Why HyperBatch?
  • 7. ​CreateContactsHyperBatch ​Using HyperBatch: 2 mins 12 seconds Speed! Why HyperBatch?
  • 9. ​DeleteContactsHyperBatch ​Using HyperBatch: 1 min, 11 seconds Speed! Why HyperBatch?
  • 10. Speed! Why HyperBatch? Operation Database.Batchable HyperBatch Difference Percentage CreateContacts 45 2.2 42.8 4.9% UpdateContacts 10 0.6 9.4 6.3% DeleteContacts 33 1.2 28 3.6% Total 88 4 84 4.6%
  • 11. ​Summary ​Running all 3 example batch jobs takes only 4 mins instead of 88 mins. ​You save 84 mins. ​It only takes 4.6% of the time! Speed! Why HyperBatch?
  • 13. Concurrency Why HyperBatch? ​Max concurrent jobs processing ​Apex Batch: 5 per org ​HyperBatch: ? 20 / user?
  • 14. Concurrency Why HyperBatch? ​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 succeed. Each re-attempt gets a new context!
  • 15. Summary How it works • 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. • Parallel remote actions fire the qeueables for the batch executions methods. (Not serial!) • Wrapping requests in unique identifiers for closed loop execution – JavaScript function binding. • JavaScript polls for the status of the qeueables, waiting for them to complete. • Each execute can return some state of type Object, it can be anything. These are stored in a custom object, and a list of them is returned to the finish() method, then they are deleted.
  • 18.
  • 19. Roadmap • Enhance the user interface • Test methods • 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
  • 20. • 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) • 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) Resources
  • 21. Q & A ​Daniel PETER ​Lead Applications Engineer, Kenandy ​Salesforce MVP ​Bay Area Salesforce Developer User Group Organizer ​20x certified ​dan@danpeter.com ​@danieljpeter
  • 22. Merci ​Daniel PETER ​Lead Applications Engineer, Kenandy ​Salesforce MVP ​Bay Area Salesforce Developer User Group Organizer ​20x certified ​dan@danpeter.com ​@danieljpeter