SlideShare a Scribd company logo
HyperBatch
A	Hyper-Fast	Batchable Interface	for	Salesforce
Daniel	Peter
Lead	Applications	Engineer,	Kenandy
Salesforce	MVP
Bay	Area	Salesforce	Developer	User	Group	Organizer
22x	certified
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.Batchableinterface.
• 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
HyperBatch - Snowforce 2017
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
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)
Questions?
Thank	you!

More Related Content

What's hot (20)

PPT
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
Hadoop User Group
 
PDF
Data encoding and Metadata for Streams
univalence
 
PDF
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
Hakka Labs
 
PDF
Log File Analysis: The most powerful tool in your SEO toolkit
Tom Bennet
 
ODP
Web Crawlers in Perl
Lambert Lum
 
PDF
Tackling Kafka, with a Small Team ( Jaren Glover, Robinhood) Kafka Summit SF ...
confluent
 
DOCX
Kafka Spark Realtime stream processing and analytics in 6 steps
Azmath Mohamad
 
PDF
Understanding the state of your web application using Apache Kafka, Spark
Exist
 
PPT
Dyna trace
Yasmine Gaber
 
PPTX
Managing a MongoDB Deployment
Tony Tam
 
PPTX
Test Automation for NoSQL Databases
Tobias Trelle
 
PPTX
Keeping the Lights On with MongoDB
Tony Tam
 
PDF
Presto - Hadoop Conference Japan 2014
Sadayuki Furuhashi
 
PPTX
Using server logs to your advantage
Alexandra Johnson
 
PDF
Fluentd and Docker - running fluentd within a docker container
Treasure Data, Inc.
 
PPTX
Running MongoDB in the Cloud
Tony Tam
 
PDF
Akka and AngularJS – Reactive Applications in Practice
Roland Kuhn
 
PDF
Systems Monitoring with Prometheus (Devops Ireland April 2015)
Brian Brazil
 
PDF
Introduction à kafka
univalence
 
PDF
MySQL optimisations of Docplanner services
Tomasz Wójcik
 
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
Hadoop User Group
 
Data encoding and Metadata for Streams
univalence
 
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
Hakka Labs
 
Log File Analysis: The most powerful tool in your SEO toolkit
Tom Bennet
 
Web Crawlers in Perl
Lambert Lum
 
Tackling Kafka, with a Small Team ( Jaren Glover, Robinhood) Kafka Summit SF ...
confluent
 
Kafka Spark Realtime stream processing and analytics in 6 steps
Azmath Mohamad
 
Understanding the state of your web application using Apache Kafka, Spark
Exist
 
Dyna trace
Yasmine Gaber
 
Managing a MongoDB Deployment
Tony Tam
 
Test Automation for NoSQL Databases
Tobias Trelle
 
Keeping the Lights On with MongoDB
Tony Tam
 
Presto - Hadoop Conference Japan 2014
Sadayuki Furuhashi
 
Using server logs to your advantage
Alexandra Johnson
 
Fluentd and Docker - running fluentd within a docker container
Treasure Data, Inc.
 
Running MongoDB in the Cloud
Tony Tam
 
Akka and AngularJS – Reactive Applications in Practice
Roland Kuhn
 
Systems Monitoring with Prometheus (Devops Ireland April 2015)
Brian Brazil
 
Introduction à kafka
univalence
 
MySQL optimisations of Docplanner services
Tomasz Wójcik
 

Similar to HyperBatch - Snowforce 2017 (17)

PDF
Hyperbatch danielpeter-161117095610
Sandeep Dobariya
 
PPTX
Batch Apex in Salesforce
David Helgerson
 
PPTX
SFDC Batch Apex
Sujit Kumar
 
PDF
Salesforce Batch processing - Atlanta SFUG
vraopolisetti
 
PDF
Apex Liberation: The Evolution of FlexQueues
Salesforce Developers
 
PPTX
Apex Flex Queue: Batch Apex Liberated
CarolEnLaNube
 
PPTX
Apex Liberation - the evolution of Flex Queue (DF15)
Stephen Willcock
 
PPTX
Large Data Management Strategies
Salesforce Developers
 
PDF
Finit solutions - Automating Data Loads with FDMEE
finitsolutions
 
PPTX
Salesforce Summer 14 Release
Jyothylakshmy P.U
 
PPTX
Batchable vs @future vs Queueable
Boris Bachovski
 
PPTX
Salesforce asynchronous apex
Badan Singh Pundeer
 
PDF
Batch Jobs: Beyond the Basics
Salesforce Developers
 
PDF
Salesforce Admin Group-Barcelona-2022-07-05 In-person Meetup-BCN Admins Group
animuscrm
 
PPTX
ELEVATE Paris
Peter Chittum
 
PPTX
Batching for the Modern Enterprise
VMware Tanzu
 
Hyperbatch danielpeter-161117095610
Sandeep Dobariya
 
Batch Apex in Salesforce
David Helgerson
 
SFDC Batch Apex
Sujit Kumar
 
Salesforce Batch processing - Atlanta SFUG
vraopolisetti
 
Apex Liberation: The Evolution of FlexQueues
Salesforce Developers
 
Apex Flex Queue: Batch Apex Liberated
CarolEnLaNube
 
Apex Liberation - the evolution of Flex Queue (DF15)
Stephen Willcock
 
Large Data Management Strategies
Salesforce Developers
 
Finit solutions - Automating Data Loads with FDMEE
finitsolutions
 
Salesforce Summer 14 Release
Jyothylakshmy P.U
 
Batchable vs @future vs Queueable
Boris Bachovski
 
Salesforce asynchronous apex
Badan Singh Pundeer
 
Batch Jobs: Beyond the Basics
Salesforce Developers
 
Salesforce Admin Group-Barcelona-2022-07-05 In-person Meetup-BCN Admins Group
animuscrm
 
ELEVATE Paris
Peter Chittum
 
Batching for the Modern Enterprise
VMware Tanzu
 
Ad

More from Daniel Peter (12)

PDF
Salesforce Slack Demo Cactusforce 2022
Daniel Peter
 
PPTX
Rules-based Record Generation with Custom Metadata Types
Daniel Peter
 
PPTX
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
Daniel Peter
 
PPTX
No Refresh Needed
Daniel Peter
 
PDF
Using Custom Permissions to Simplify Security
Daniel Peter
 
PDF
DF Global Gathering PuneWIT
Daniel Peter
 
PPTX
Dreamforce Global Gathering Bangaluru 2017
Daniel Peter
 
PPTX
Blaze a Trail to Predictive Selling With Einstein Intent
Daniel Peter
 
PDF
LDS salesforce saturday
Daniel Peter
 
PPTX
Tree Traversal #SalesforceSaturday
Daniel Peter
 
PDF
Lightning Reports - Dreamforce 2015
Daniel Peter
 
PPTX
Callout architecture
Daniel Peter
 
Salesforce Slack Demo Cactusforce 2022
Daniel Peter
 
Rules-based Record Generation with Custom Metadata Types
Daniel Peter
 
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
Daniel Peter
 
No Refresh Needed
Daniel Peter
 
Using Custom Permissions to Simplify Security
Daniel Peter
 
DF Global Gathering PuneWIT
Daniel Peter
 
Dreamforce Global Gathering Bangaluru 2017
Daniel Peter
 
Blaze a Trail to Predictive Selling With Einstein Intent
Daniel Peter
 
LDS salesforce saturday
Daniel Peter
 
Tree Traversal #SalesforceSaturday
Daniel Peter
 
Lightning Reports - Dreamforce 2015
Daniel Peter
 
Callout architecture
Daniel Peter
 
Ad

Recently uploaded (20)

PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 

HyperBatch - Snowforce 2017