SlideShare a Scribd company logo
The Trial
Clicks, Code, and Kafka
Ch. Szandor Knapp, Daniel Stange
#CD19
Christian Szandor Knapp
Salesforce MVP & Munich DG Leader
appero
Head of Salesforce Development
@ch_sz_knapp
github.com/szandor72
Daniel Stange
Frankfurt UG Leader
DIA
Technical Architect
@stangomat
github.com/dstdia
#CD19
1. Metamorphosis
a. What we witnessed
b. What we’re afraid of
2. The Trial
a. Premises and Paradoxes
b. Test Setup
3. The Judgement
a. Statistical Evidence
b. Forensic Evidence
Itinerary
#CD19
METAMORPHOSIS
[Salesforce] ist eine beständige Ablenkung, die nicht
darüber zur Besinnung kommen läßt, wovon sie
eigentlich ablenkt.
Franz Kafka, adapted
#CD19
One morning, when Gregor
Samsa woke from troubled
dreams, he found himself
in 2009 - Workflows, Apex
in 2019 - Workflows / Processes,
Flows, Apex
with Events
Metamorphosis
Screenshots:
Old flow cloud flow builder
New flow builder
#CD19
GIF ugly bug on a bed black white gif from movie
Here’s what we’re all afraid of
System.LimitException: Too
many DML statements
System.LimitException:
Apex CPU time limit
exceeded
#CD19
THE TRIAL
Someone must have sabotaged Josefine K., for one
morning, without having done anything truly wrong, her
org broke.
Franz Kafka, adapted
#CD19
A Talk About Order of Execution
What this is not
#CD19
Paradoxes - available since Summer 2018
13:01:09:158 (94505994476)
|LIMIT_USAGE_FOR_NS|(default)|
Maximum CPU time:
240 out of 10000
13:01:08:157
FLOW_START_INTERVIEW_LIMIT_USAGE
CPU time in ms:
240 out of 15000
W-6375582
#CD19
Paradoxes - look for CPU Time Limit in Flow
Limits
13:01:09:158 (94505994476)
|LIMIT_USAGE_FOR_NS|(default)|
Maximum CPU time:
240 out of 10000
13:01:08:157
FLOW_START_INTERVIEW_LIMIT_USAGE
CPU time in ms:
240 out of 15000
https://developer.salesforce.com/docs/atlas.e
n-
us.216.0.salesforce_vpm_guide.meta/salesfo
rce_vpm_guide/vpm_admin_flow_limits_ape
No results
#CD19
The right understanding of any
matter and a misunderstanding
of the same matter do not
wholly exclude each other.
The Trial
Screenshots:
Old flow cloud flow builder
New flow builder
#CD19
Process Builder Quiz: Set a Boolean on Insert
Inserting 2000 records (via apex, data loader, …)
… how many Queries will be consumed?
… how many DML statements will be consumed?
… how much CPU Time will be consumed?
#CD19
Process Builder: Setting Boolean on Insert
#CD19
I like to make use of what I know
Setup:
- Mocking an advanced system
with trigger management and
logging
- We insert a lot of light weight
custom objects in various code
and/or click combinations to
measure results
The Trial
Screenshots:
Old flow cloud flow builder
New flow builder
#CD19
MyTrigger:
https://github.com/appero-com/MyTriggers
Available as unlocked package
MyTrigger and Logger
Logger:
https://github.com/szandor72/logger
#CD19
They’re talking about things of
which they don’t have the
slightest understanding,
anyway.
The Trial
Screenshots:
Old flow cloud flow builder
New flow builder
#CD19
Collecting Evidence
Scenario All Clicks All Code Clicks & Invocable
Code
Single Record
Operation
Creating a Mock will create a related MockMock
Multi Records
(single batch < 200)
For every n Mock, n MockMocks are created.
We’ll increase n by 50 in each run up to 200.
Fully batched
operation (> 200
records)
We then fill the full execution context of the Mock trigger with
201, 300, 400, 401 up to 4500 records (23 batches with 200
each). Can it create 4500 MockMocks?
#CD19
THE JUDGEMENT
It's unbearably dark in here
Franz Kafka
#CD19
Statistic Evidence: Create Child Records
Scenarios All Clicks All Code Clicks &
Invocable
Apex
Single Record 95ms - 118ms 118ms 121ms
Multi Records
(single batch)
68-81ms (n=50)
92-126ms (n=100)
118-136ms (n=150)
159-162ms (n=200)
847-1563ms (n=300)
121ms (n=50)
194ms (n=100)
190ms (n=150)
252ms (n=200)
383ms (n=300)
239ms (n=50)
373ms (n=100)
607ms (n=150)
793ms (n=200)
1504ms (n=300)
Fully batched
(4500 records)
9680 to 14681ms 4989ms 12455ms
#CD19
Statistic Evidence: Create Child Records
#CD19
#CD19
Forensic Evidence: Debug Logs
A lot of “Flow Interviews” run
(instances of a flow or PB Action)
Yet the DML statements
get batched up properly
#CD19
Forensic Evidence: Debug Logs
When we create 400 records in one
transaction400
… Process Builder kicks off 400 flow
interviews (1 per record).
Max CPU time points at the slowest interview, not all!
… all of them will be paused to collect
‘bulkifiable actions’
… which are executed in ‘bulk’, so
invocable Apex receives a maximum of
200 records
200 200 200 200
1 1
1 1
1 1
1 1
…
(400 single flow
interviews
#CD19
Forensic Evidence: Debug Logs
Flow Interviews
(= Process Builder/Flow)
400 Iterations… (blue
markup)
Summary (red markup)
#CD19
User Experience differs widely from system limits
consumption!
Fig.: Less than 1 sec CPU time consumed, but 4.4
secs have elapsed.
Forensic Evidence: Debug Logs
Total Elapsed Time
(!= CPU Time!)
is around 4.4secs.
#CD19
● Take well informed decisions when choosing your automation tools:
○ Read the documentation and follow up with every release
○ Monitor the operations in the Debug Log and Analysis Perspective
● KISS - avoid complexities if possible
○ If you cannot draw it, do not build it
○ Take the least complex design. Can you go full Flow? Or full Apex?
○ Remember good ol’ Workflow Rules - low impact automations!
● Always test your operations with 201 or more records
○ use Dataloader etc. to insert & update records in a Sandbox
Key Takeaways
#CD19
● We are blazing trails to something exciting - an event driven business
platform with secure apps across all devices with visual and
programmatic development
● If you think in events instead of sObject Updates, many things sort
themselves out
Witnessing commotion in the force
“I felt a great disturbance in the Force,
as if millions of [CPU Time Exceptions]
suddenly cried out in terror
and were suddenly silenced.”
#CD19
● Logger:
○ https://github.com/Szandor72/logger
● MyTriggers:
○ https://github.com/appero-com/MyTriggers
● Code Examples from this presentation:
○ https://github.com/dstdia/CzechDreamin19
Resources
Thank you!

More Related Content

More from CzechDreamin

Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
CzechDreamin
 
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
CzechDreamin
 
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
CzechDreamin
 
How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...
CzechDreamin
 
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
CzechDreamin
 
Architecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron CrearArchitecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron Crear
CzechDreamin
 
Ape to API, Filip Dousek
Ape to API, Filip DousekApe to API, Filip Dousek
Ape to API, Filip Dousek
CzechDreamin
 
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel MoyaPush Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
CzechDreamin
 
How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...
CzechDreamin
 
ChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark JonesChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark Jones
CzechDreamin
 
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
CzechDreamin
 
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
CzechDreamin
 
Sales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy AvilovSales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy Avilov
CzechDreamin
 
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
CzechDreamin
 
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
CzechDreamin
 
No Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat FragosoNo Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
CzechDreamin
 
Why do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew CookWhy do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew Cook
CzechDreamin
 
Be kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel SombuBe kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel Sombu
CzechDreamin
 
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
CzechDreamin
 
The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...
CzechDreamin
 

More from CzechDreamin (20)

Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
Salesforce Forecasting: Evolution, Implementation and Best Practices, Christi...
 
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
Supercharge Salesforce Marketing Cloud: The Ultimate Apps Guide, Cyril Louis ...
 
How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...How we should include Devops Center to get happy developers?, David Fernandez...
How we should include Devops Center to get happy developers?, David Fernandez...
 
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
Streamline Your Integration with Salesforce’s Composite API: A Consultant’s G...
 
Architecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron CrearArchitecting for Analytics, Aaron Crear
Architecting for Analytics, Aaron Crear
 
Ape to API, Filip Dousek
Ape to API, Filip DousekApe to API, Filip Dousek
Ape to API, Filip Dousek
 
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel MoyaPush Upgrades, The last mile of Salesforce DevOps, Manuel Moya
Push Upgrades, The last mile of Salesforce DevOps, Manuel Moya
 
How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...How do you know you’re solving the right problem? Design Thinking for Salesfo...
How do you know you’re solving the right problem? Design Thinking for Salesfo...
 
ChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark JonesChatGPT … How Does it Flow?, Mark Jones
ChatGPT … How Does it Flow?, Mark Jones
 
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...Real-time communication with Account Engagement (Pardot). Marketers meet deve...
Real-time communication with Account Engagement (Pardot). Marketers meet deve...
 
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
Black Hat Session: Exploring and Exploiting Aura based Experiences, Christian...
 
Sales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy AvilovSales methodology for Salesforce Opportunity, Georgy Avilov
Sales methodology for Salesforce Opportunity, Georgy Avilov
 
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
5 key ideas for robust and flexible REST API integrations with Apex, Lucian M...
 
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
Report & Dashboard REST API : Get your report accessible anywhere !, Romain Q...
 
No Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat FragosoNo Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
No Such Thing as Best Practice in Design, Nati Asher and Pat Fragoso
 
Why do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew CookWhy do you Need to Migrate to Salesforce Flow?, Andrew Cook
Why do you Need to Migrate to Salesforce Flow?, Andrew Cook
 
Be kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel SombuBe kind to your future admin self, Silvia Denaro & Nathaniel Sombu
Be kind to your future admin self, Silvia Denaro & Nathaniel Sombu
 
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
Monitoring Automation Performance in Marketing Cloud Engagement, Daniela Vrbk...
 
The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...The minimum-profile approach – the modern way to design an efficient security...
The minimum-profile approach – the modern way to design an efficient security...
 

Recently uploaded

Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 

Recently uploaded (20)

Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 

The Trial - Clicks, Code, and Kafka, Christian Szandor Knapp, Daniel Stange

  • 1. The Trial Clicks, Code, and Kafka Ch. Szandor Knapp, Daniel Stange
  • 2. #CD19 Christian Szandor Knapp Salesforce MVP & Munich DG Leader appero Head of Salesforce Development @ch_sz_knapp github.com/szandor72 Daniel Stange Frankfurt UG Leader DIA Technical Architect @stangomat github.com/dstdia
  • 3. #CD19 1. Metamorphosis a. What we witnessed b. What we’re afraid of 2. The Trial a. Premises and Paradoxes b. Test Setup 3. The Judgement a. Statistical Evidence b. Forensic Evidence Itinerary
  • 4. #CD19 METAMORPHOSIS [Salesforce] ist eine beständige Ablenkung, die nicht darüber zur Besinnung kommen läßt, wovon sie eigentlich ablenkt. Franz Kafka, adapted
  • 5. #CD19 One morning, when Gregor Samsa woke from troubled dreams, he found himself in 2009 - Workflows, Apex in 2019 - Workflows / Processes, Flows, Apex with Events Metamorphosis Screenshots: Old flow cloud flow builder New flow builder
  • 6. #CD19 GIF ugly bug on a bed black white gif from movie Here’s what we’re all afraid of System.LimitException: Too many DML statements System.LimitException: Apex CPU time limit exceeded
  • 7. #CD19 THE TRIAL Someone must have sabotaged Josefine K., for one morning, without having done anything truly wrong, her org broke. Franz Kafka, adapted
  • 8. #CD19 A Talk About Order of Execution What this is not
  • 9. #CD19 Paradoxes - available since Summer 2018 13:01:09:158 (94505994476) |LIMIT_USAGE_FOR_NS|(default)| Maximum CPU time: 240 out of 10000 13:01:08:157 FLOW_START_INTERVIEW_LIMIT_USAGE CPU time in ms: 240 out of 15000 W-6375582
  • 10. #CD19 Paradoxes - look for CPU Time Limit in Flow Limits 13:01:09:158 (94505994476) |LIMIT_USAGE_FOR_NS|(default)| Maximum CPU time: 240 out of 10000 13:01:08:157 FLOW_START_INTERVIEW_LIMIT_USAGE CPU time in ms: 240 out of 15000 https://developer.salesforce.com/docs/atlas.e n- us.216.0.salesforce_vpm_guide.meta/salesfo rce_vpm_guide/vpm_admin_flow_limits_ape No results
  • 11. #CD19 The right understanding of any matter and a misunderstanding of the same matter do not wholly exclude each other. The Trial Screenshots: Old flow cloud flow builder New flow builder
  • 12. #CD19 Process Builder Quiz: Set a Boolean on Insert Inserting 2000 records (via apex, data loader, …) … how many Queries will be consumed? … how many DML statements will be consumed? … how much CPU Time will be consumed?
  • 13. #CD19 Process Builder: Setting Boolean on Insert
  • 14. #CD19 I like to make use of what I know Setup: - Mocking an advanced system with trigger management and logging - We insert a lot of light weight custom objects in various code and/or click combinations to measure results The Trial Screenshots: Old flow cloud flow builder New flow builder
  • 15. #CD19 MyTrigger: https://github.com/appero-com/MyTriggers Available as unlocked package MyTrigger and Logger Logger: https://github.com/szandor72/logger
  • 16. #CD19 They’re talking about things of which they don’t have the slightest understanding, anyway. The Trial Screenshots: Old flow cloud flow builder New flow builder
  • 17. #CD19 Collecting Evidence Scenario All Clicks All Code Clicks & Invocable Code Single Record Operation Creating a Mock will create a related MockMock Multi Records (single batch < 200) For every n Mock, n MockMocks are created. We’ll increase n by 50 in each run up to 200. Fully batched operation (> 200 records) We then fill the full execution context of the Mock trigger with 201, 300, 400, 401 up to 4500 records (23 batches with 200 each). Can it create 4500 MockMocks?
  • 18. #CD19 THE JUDGEMENT It's unbearably dark in here Franz Kafka
  • 19. #CD19 Statistic Evidence: Create Child Records Scenarios All Clicks All Code Clicks & Invocable Apex Single Record 95ms - 118ms 118ms 121ms Multi Records (single batch) 68-81ms (n=50) 92-126ms (n=100) 118-136ms (n=150) 159-162ms (n=200) 847-1563ms (n=300) 121ms (n=50) 194ms (n=100) 190ms (n=150) 252ms (n=200) 383ms (n=300) 239ms (n=50) 373ms (n=100) 607ms (n=150) 793ms (n=200) 1504ms (n=300) Fully batched (4500 records) 9680 to 14681ms 4989ms 12455ms
  • 21. #CD19
  • 22. #CD19 Forensic Evidence: Debug Logs A lot of “Flow Interviews” run (instances of a flow or PB Action) Yet the DML statements get batched up properly
  • 23. #CD19 Forensic Evidence: Debug Logs When we create 400 records in one transaction400 … Process Builder kicks off 400 flow interviews (1 per record). Max CPU time points at the slowest interview, not all! … all of them will be paused to collect ‘bulkifiable actions’ … which are executed in ‘bulk’, so invocable Apex receives a maximum of 200 records 200 200 200 200 1 1 1 1 1 1 1 1 … (400 single flow interviews
  • 24. #CD19 Forensic Evidence: Debug Logs Flow Interviews (= Process Builder/Flow) 400 Iterations… (blue markup) Summary (red markup)
  • 25. #CD19 User Experience differs widely from system limits consumption! Fig.: Less than 1 sec CPU time consumed, but 4.4 secs have elapsed. Forensic Evidence: Debug Logs Total Elapsed Time (!= CPU Time!) is around 4.4secs.
  • 26. #CD19 ● Take well informed decisions when choosing your automation tools: ○ Read the documentation and follow up with every release ○ Monitor the operations in the Debug Log and Analysis Perspective ● KISS - avoid complexities if possible ○ If you cannot draw it, do not build it ○ Take the least complex design. Can you go full Flow? Or full Apex? ○ Remember good ol’ Workflow Rules - low impact automations! ● Always test your operations with 201 or more records ○ use Dataloader etc. to insert & update records in a Sandbox Key Takeaways
  • 27. #CD19 ● We are blazing trails to something exciting - an event driven business platform with secure apps across all devices with visual and programmatic development ● If you think in events instead of sObject Updates, many things sort themselves out Witnessing commotion in the force “I felt a great disturbance in the Force, as if millions of [CPU Time Exceptions] suddenly cried out in terror and were suddenly silenced.”
  • 28. #CD19 ● Logger: ○ https://github.com/Szandor72/logger ● MyTriggers: ○ https://github.com/appero-com/MyTriggers ● Code Examples from this presentation: ○ https://github.com/dstdia/CzechDreamin19 Resources

Editor's Notes

  1. Salesforce is a constant deflection which deflects from possibly grasping what it really deflects from
  2. We are witnessing commotion in the force 2009: Apex and Worfklows are complicated but not complex. They have their special place in the order of execution and specific rules how they interact and who wins in the end. 2019: not so much, flows / pb have their place at the end of the execution order ((and are (are not?) limited to 5 re-entries like Workflows)) BTW, it has never been either clicks or code - we’ve been using both from the very beginning. Not counting those wizards that can simply write new object metadata xmls by hand and push it by hand.
  3. And it is also not the ultimate truth it is just a momentary snapshot
  4. Add bug item number
  5. Apex CPU Time is not part of flow limits
  6. Our base line includes code: something to log and something to control trigger. Your baseline could be a different one. If you do not have any code in your org, your results might differ greatly
  7. Coming back to the baseline: our world is that of orgs several years old with several layers of customisation and/or managed packages Hence a sophisticated test setup but no complicated operations therein to keep the overhead at a minimum
  8. Our base line includes code: something to log and something to control trigger. Your baseline could be a different one. If you do not have any code in your org, your results might differ greatly
  9. Handover to Daniel We all know that this can be automated, and it can be done with almost every tool we have on the platform except workflows (remember they
  10. Key observation: If code runs in a transaction with declarative logic, the latter can force the programmatic logic over its limits .
  11. Key observation: If code runs in a transaction with declarative logic, the latter can force the programmatic logic over its limits. Note the peaks whenever we go cross a trigger context’s bulk size, e.g. from 200 to 201 and 400 to 401 n=50/n=100/n=150/n=200/n=300 PB with an internal node: 80/100/136/159/847 (note the surge when entering a second batch!) PB with a subprocess: 85/126/128/165/1473(!) PB with a subflow: 68/92/118/162/1563 PB with Inv. Apex: 239/373/607/793/1504 There is currently no way to catch a CPU time limit exception when it happens in Process Builder! So if it happens, ti happens. .
  12. And this is only one side of the story. The other side is User Experience, and you can see that the CPU time (red bars) is the smaller part of the time that elapses while the transactions is running. All this while, the user will be seeing a spinner in the UI while the operations runs.
  13. Remember our quiz? It’s getting fairly complicated fairly soon.