SlideShare uma empresa Scribd logo
1 de 29
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

Mais conteúdo relacionado

Mais procurados

Elasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep diveElasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep diveSematext Group, Inc.
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNodeXperts
 
Create an online bookstore
Create an online bookstoreCreate an online bookstore
Create an online bookstoreJaved Khan
 
New Features in Apache Pinot
New Features in Apache PinotNew Features in Apache Pinot
New Features in Apache PinotSiddharth Teotia
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerMydbops
 
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiA Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiDatabricks
 
OAC and ODI! A Match Made in…the cloud?
OAC and ODI! A Match Made in…the cloud?OAC and ODI! A Match Made in…the cloud?
OAC and ODI! A Match Made in…the cloud?Rodrigo Radtke de Souza
 
Book Store Management System - Functional Requirements - 2021
Book Store Management System - Functional Requirements - 2021Book Store Management System - Functional Requirements - 2021
Book Store Management System - Functional Requirements - 2021Bharat Chawda
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redisDvir Volk
 
Remote Log Analytics Using DDS, ELK, and RxJS
Remote Log Analytics Using DDS, ELK, and RxJSRemote Log Analytics Using DDS, ELK, and RxJS
Remote Log Analytics Using DDS, ELK, and RxJSSumant Tambe
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architectureBishal Khanal
 
Geospatial Advancements in Elasticsearch
Geospatial Advancements in ElasticsearchGeospatial Advancements in Elasticsearch
Geospatial Advancements in ElasticsearchElasticsearch
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDBMongoDB
 
Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...Ontico
 

Mais procurados (20)

Elasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep diveElasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep dive
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management Demystified
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Create an online bookstore
Create an online bookstoreCreate an online bookstore
Create an online bookstore
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
New Features in Apache Pinot
New Features in Apache PinotNew Features in Apache Pinot
New Features in Apache Pinot
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizer
 
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiA Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
 
OAC and ODI! A Match Made in…the cloud?
OAC and ODI! A Match Made in…the cloud?OAC and ODI! A Match Made in…the cloud?
OAC and ODI! A Match Made in…the cloud?
 
Book Store Management System - Functional Requirements - 2021
Book Store Management System - Functional Requirements - 2021Book Store Management System - Functional Requirements - 2021
Book Store Management System - Functional Requirements - 2021
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 
Remote Log Analytics Using DDS, ELK, and RxJS
Remote Log Analytics Using DDS, ELK, and RxJSRemote Log Analytics Using DDS, ELK, and RxJS
Remote Log Analytics Using DDS, ELK, and RxJS
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
Geospatial Advancements in Elasticsearch
Geospatial Advancements in ElasticsearchGeospatial Advancements in Elasticsearch
Geospatial Advancements in Elasticsearch
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDB
 
Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...
 

Semelhante a Salesforce Apex Hours :- Hyper batch

Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017Hyperbatch (LoteRapido) - Punta Dreamin' 2017
Hyperbatch (LoteRapido) - Punta Dreamin' 2017Daniel Peter
 
Hyperbatch danielpeter-161117095610
Hyperbatch danielpeter-161117095610Hyperbatch danielpeter-161117095610
Hyperbatch danielpeter-161117095610Sandeep Dobariya
 
HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017HyperBatch - Snowforce 2017
HyperBatch - Snowforce 2017Daniel Peter
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster WebsitesCraig 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 PHPJonathan 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 2017Speedment, Inc.
 
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 FramworksSumitkumar 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
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan 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]Speedment, Inc.
 
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
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitterRoger Xia
 

Semelhante a 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 danielpeter-161117095610
Hyperbatch danielpeter-161117095610Hyperbatch danielpeter-161117095610
Hyperbatch danielpeter-161117095610
 
HyperBatch
HyperBatchHyperBatch
HyperBatch
 
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
 

Mais de Amit Chaudhary

Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code BenchmarkingAmit 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 pipelineAmit Chaudhary
 
Marketing cloud development
Marketing cloud developmentMarketing cloud development
Marketing cloud developmentAmit 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 salesforceAmit Chaudhary
 
Modular application development using unlocked packages
Modular application development using unlocked packagesModular application development using unlocked packages
Modular application development using unlocked packagesAmit Chaudhary
 
Einstein Next Best Action (NBA)
Einstein Next Best Action (NBA)Einstein Next Best Action (NBA)
Einstein Next Best Action (NBA)Amit Chaudhary
 
Lightning web components
Lightning web componentsLightning web components
Lightning web componentsAmit Chaudhary
 
Lightning web components
Lightning web componentsLightning web components
Lightning web componentsAmit Chaudhary
 
Lightning Locker Services
Lightning Locker ServicesLightning Locker Services
Lightning Locker ServicesAmit 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 diveAmit 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 OrgAmit Chaudhary
 
Einstein Analytics Part 2
Einstein Analytics Part 2Einstein Analytics Part 2
Einstein Analytics Part 2Amit Chaudhary
 
Demystifying the salesforce reports api
Demystifying the salesforce reports apiDemystifying the salesforce reports api
Demystifying the salesforce reports apiAmit Chaudhary
 
Salesforce apex hours Einstein platform services
Salesforce apex hours   Einstein platform servicesSalesforce apex hours   Einstein platform services
Salesforce apex hours Einstein platform servicesAmit 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 LDVAmit Chaudhary
 

Mais de 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
 

Último

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 

Último (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 

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