SlideShare a Scribd company logo
1 of 49
Download to read offline
© 2022 - Atsign | docs.atsign.com
Backends in Dart
QConSF - Oct 2022 / QCon Plus - Nov 2022
© 2022 - Atsign | docs.atsign.com
“Dart is a client-optimized language
for fast apps on any platform”
dart.dev
AOT
JIT
VM JIT
Snap
shot
AOT
JIT
VM JIT
Snap
shot
AOT
JIT
VM JIT
Snap
shot
AOT
JIT
VM JIT
Snap
shot
© 2022 - Atsign | docs.atsign.com
What I do
1. Improve the quality of documentation, samples and
examples, so that atSigns are the easiest way for
developers to build apps that have privacy preserving
identity.
2. Build Continuous Delivery pipelines as a first step towards Progressive Delivery and Chaos
Engineering so that we can confidently deploy high quality well tested software.
3. Lay the foundations for an engineering organisation that’s optimised for high productivity by
minimising cognitive load on teams and the people working in those teams.
© 2022 - Atsign | docs.atsign.com
What I do
1. Improve the quality of documentation, samples and examples, so that atSigns are the easiest way
for developers to build apps that have privacy preserving identity.
2. Build Continuous Delivery pipelines as a first step towards
Progressive Delivery and Chaos Engineering so that we
can confidently deploy high quality well tested software.
3. Lay the foundations for an engineering organisation that’s optimised for high productivity by
minimising cognitive load on teams and the people working in those teams.
© 2022 - Atsign | docs.atsign.com
What I do
1. Improve the quality of documentation, samples and examples, so that atSigns are the easiest way
for developers to build apps that have privacy preserving identity.
2. Build Continuous Delivery pipelines as a first step towards Progressive Delivery and Chaos
Engineering so that we can confidently deploy high quality well tested software.
3. Lay the foundations for an engineering organisation
that’s optimised for high productivity by
minimising cognitive load on teams and
the people working in those teams.
© 2022 - Atsign | docs.atsign.com
Agenda
➔ Why Dart?
➔ Language features
➔ Just in time (JIT) vs Ahead of time (AOT)
➔ Dart in Containers
➔ Profiling and performance management
➔ A middle way with jit-snapshot?
Why Dart? Industry big picture.
© 2022 - The @ Company | atsign.dev
Flutter pulled Dart into the Redmonk Top 20
1 JavaScript
2 Python
3 Java
4 PHP
5 CSS
5 C#
7 C++
8 TypeScript
9 Ruby
10 C
11 Swift
12 R
13 Objective-C
14 Shell
14 Scala
16 Go
17 PowerShell
18 Kotlin
19 Rust
19 Dart
Why Dart for Atsign?
atSigns are personal data stores
Alice
(thing)
Bob’s
app
Data about stuff
Alice
PDS
Bob
PDS
Dart AOT binaries produce really small containers
VPC
Infrastructure for ~6500 atSigns
Docker Swarm
Manager Nodes
e2-custom-4-8192
Ubuntu 22.04 LTS
1 2 3
Worker Nodes
e2-standard-4
Flatcar Linux (Stable channel)
4 5 6 7 20 21
19
. . .
NetApp Cloud Volume
CVS-Performance
Language features
‘Hello World!’
void main() {
print('Hello, World!');
}
Async/await (like JavaScript)
Future<String> createOrderMessage() async {
var order = await fetchUserOrder();
return 'Your order is: $order';
}
Future<String> fetchUserOrder() =>
// Imagine that this function is
// more complex and slow.
Future.delayed(
const Duration(seconds: 2),
() => 'Large Latte',
);
Future<void> main() async {
print('Fetching user order...');
print(await createOrderMessage());
}
Concurrency - Isolates
“independent workers that are similar
to threads but don’t share memory,
communicating only through messages”
Sound null safety (since Dart 2.12, Mar 2021)
// In null-safe Dart, none of these can ever be null.
var i = 42; // Inferred to be an int.
String name = getFileName();
final b = Foo();
// To indicate that a variable might have the value null
// just add ? to its type declaration
int? aNullableInt = null;
Licensing
Package Manager - pub.dev
JIT vs AOT
Dartshowplatform - A more useful ‘Hello World!’
import 'dart:io' show Platform, stdout;
void main() {
print(Platform.version);
}
2.18.2 (stable) (Tue Sep 27 13:24:11
2022 +0200) on "linux_arm64"
JIT - Just `dart run` it in the virtual machine
$ time dart run showplatform.dart
2.18.2 (stable) (Tue Sep 27 13:24:11
2022 +0200) on "linux_arm64"
real 0m6.588s
user 0m5.862s
sys 0m0.925s
AOT - Compile it first then run the binary
$ dart compile exe showplatform.dart
$ time ./showplatform.exe
2.18.2 (stable) (Tue Sep 27 13:24:11
2022 +0200) on "linux_arm64"
real 0m0.027s
user 0m0.012s
sys 0m0.018s
Trade off - compilation is slow
$ time dart compile exe 
showplatform.dart
Info: Compiling with sound null safety
Generated: showplatform.exe
real 0m18.184s
user 0m22.533s
sys 0m2.643s
Dart in Containers
A typical Dockerfile for AOT compiled Dart binary
FROM dart AS build
WORKDIR /app
COPY ./mydemoapp.dart .
RUN dart pub get
RUN dart compile exe /app/mydemoapp.dart 
-o /app/mydemoapp
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/mydemoapp /app/mydemoapp
ENTRYPOINT ["/app/mydemoapp"]
Image sizes for a trivial application
Image sizes for a non trivial application
Profiling and performance management
Dart DevTools
https://dart.dev/tools/dart-devtools
Memory view
https://flutter.dev/docs/development/tools/devtools/memory
Flame chart
https://flutter.dev/docs/development/tools/devtools/performance
But… DevTools need to connect to a VM, so JIT only
A middle way?
jit-snapshot
Creating and running a jit-snapshot
$ dart compile jit-snapshot showplatform.dart
$ time dart run showplatform.jit
2.18.2 (stable) (Tue Sep 27 13:24:11
2022 +0200) on "linux_arm64"
real 0m1.786s
user 0m1.783s
sys 0m0.341s
Putting a jit-snapshot into a container
FROM dart AS build
WORKDIR /app
COPY ./mydemoapp.dart .
RUN dart pub get
RUN dart compile jit-snapshot /app/mydemoapp.dart 
-o /app/mydemoapp.jit
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /usr/lib/dart/bin/ /usr/lib/dart/bin/
COPY --from=build /app/mydemoapp.jit /app/mydemoapp.jit
ENTRYPOINT ["/usr/lib/dart/bin/dart","run",
"--observe=8181/0.0.0.0","/app/mydemoapp.jit"]
Container image sizes
REPOSITORY TAG SIZE
atsigncompany/secondary dev_obs 1.25GB
atsigncompany/secondary prod 14.5MB
cpswan/secondary obsjit 430MB
Runtime resource usage
CONTAINER ID NAME
CPU % MEM USAGE / LIMIT MEM % NET I/O
f938de4395a7 ss_secondary.1.7wnwoifieezhdc91gkdwqnn12
0.04% 8.359MiB / 976.9MiB 0.86% 2.56kB / 5.97kB
6043df1c0027 cpsbh_secondary.1.xkfk5w2gl76vhi8ifx8t94z37
0.05% 87.47MiB / 976.9MiB 8.95% 3.03kB / 6.05kB
© 2022 - Atsign | docs.atsign.com
Review
➔ Why Dart?
➔ Language features
➔ Just in time (JIT) vs Ahead of time (AOT)
➔ Dart in Containers
➔ Profiling and performance management
➔ A middle way with jit-snapshot?
© 2022 - Atsign | docs.atsign.com
Call to action: Try Dart yourself
https://dart.dev/codelabs
Thanks for your time
chris@atsign.com
@cpswan
Questions?

More Related Content

Similar to QConSF 2022 - Backends in Dart

Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)
Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)
Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)Samy Fodil
 
IBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt IntegrationIBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt Integrationgjuljo
 
Fluttercon Berlin 23 - Dart & Flutter on RISC-V
Fluttercon Berlin 23 - Dart & Flutter on RISC-VFluttercon Berlin 23 - Dart & Flutter on RISC-V
Fluttercon Berlin 23 - Dart & Flutter on RISC-VChris Swan
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerQt
 
Webinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with DockerWebinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with DockerBurkhard Stubert
 
Build Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBBuild Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBScyllaDB
 
Release webinar architecture
Release webinar   architectureRelease webinar   architecture
Release webinar architectureBigData_Europe
 
A hitchhiker‘s guide to the cloud native stack
A hitchhiker‘s guide to the cloud native stackA hitchhiker‘s guide to the cloud native stack
A hitchhiker‘s guide to the cloud native stackQAware GmbH
 
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17Mario-Leander Reimer
 
Flutter Vikings 2022 - End to end IoT with Dart and Flutter
Flutter Vikings 2022 - End to end IoT with Dart and FlutterFlutter Vikings 2022 - End to end IoT with Dart and Flutter
Flutter Vikings 2022 - End to end IoT with Dart and FlutterChris Swan
 
Kubernetes für Workstations Edge und IoT Devices
Kubernetes für Workstations Edge und IoT DevicesKubernetes für Workstations Edge und IoT Devices
Kubernetes für Workstations Edge und IoT DevicesQAware GmbH
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesAjeet Singh Raina
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For DevelopmentLaura Frank Tacho
 
What should you know about Net Core?
What should you know about Net Core?What should you know about Net Core?
What should you know about Net Core?Damir Dobric
 
Cloud-native Java EE-volution
Cloud-native Java EE-volutionCloud-native Java EE-volution
Cloud-native Java EE-volutionQAware GmbH
 
TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...
TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...
TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...The Incredible Automation Day
 
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...Roberto Hashioka
 

Similar to QConSF 2022 - Backends in Dart (20)

Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)
Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)
Connectivity is here (5 g, swarm,...). now, let's build interplanetary apps! (1)
 
IBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt IntegrationIBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt Integration
 
Fluttercon Berlin 23 - Dart & Flutter on RISC-V
Fluttercon Berlin 23 - Dart & Flutter on RISC-VFluttercon Berlin 23 - Dart & Flutter on RISC-V
Fluttercon Berlin 23 - Dart & Flutter on RISC-V
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with docker
 
Webinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with DockerWebinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with Docker
 
Build Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBBuild Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDB
 
Release webinar architecture
Release webinar   architectureRelease webinar   architecture
Release webinar architecture
 
CI/CD on pure AWS
CI/CD on pure AWSCI/CD on pure AWS
CI/CD on pure AWS
 
A hitchhiker‘s guide to the cloud native stack
A hitchhiker‘s guide to the cloud native stackA hitchhiker‘s guide to the cloud native stack
A hitchhiker‘s guide to the cloud native stack
 
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
 
Flutter Vikings 2022 - End to end IoT with Dart and Flutter
Flutter Vikings 2022 - End to end IoT with Dart and FlutterFlutter Vikings 2022 - End to end IoT with Dart and Flutter
Flutter Vikings 2022 - End to end IoT with Dart and Flutter
 
Kubernetes für Workstations Edge und IoT Devices
Kubernetes für Workstations Edge und IoT DevicesKubernetes für Workstations Edge und IoT Devices
Kubernetes für Workstations Edge und IoT Devices
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devices
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For Development
 
What should you know about Net Core?
What should you know about Net Core?What should you know about Net Core?
What should you know about Net Core?
 
Cloud-native Java EE-volution
Cloud-native Java EE-volutionCloud-native Java EE-volution
Cloud-native Java EE-volution
 
TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...
TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...
TIAD 2016 : Real-Time Data Processing Pipeline & Visualization with Docker, S...
 
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
 

More from Chris Swan

LNETM - Atsign - Privacy with Personal Data Services
LNETM - Atsign - Privacy with Personal Data ServicesLNETM - Atsign - Privacy with Personal Data Services
LNETM - Atsign - Privacy with Personal Data ServicesChris Swan
 
SOOCon24 - Showing that you care about security - OpenSSF Scorecards
SOOCon24 - Showing that you care about security - OpenSSF ScorecardsSOOCon24 - Showing that you care about security - OpenSSF Scorecards
SOOCon24 - Showing that you care about security - OpenSSF ScorecardsChris Swan
 
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdfAll Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdfChris Swan
 
QConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an OrganisationQConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an OrganisationChris Swan
 
Flutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and Flutter
Flutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and FlutterFlutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and Flutter
Flutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and FlutterChris Swan
 
London IoT Meetup Sep 2022 - End to end encrypted IoT
London IoT Meetup Sep 2022 - End to end encrypted IoTLondon IoT Meetup Sep 2022 - End to end encrypted IoT
London IoT Meetup Sep 2022 - End to end encrypted IoTChris Swan
 
EMFcamp2022 - What if apps logged into you, instead of you logging into apps?
EMFcamp2022 - What if apps logged into you, instead of you logging into apps?EMFcamp2022 - What if apps logged into you, instead of you logging into apps?
EMFcamp2022 - What if apps logged into you, instead of you logging into apps?Chris Swan
 
Devoxx UK 2022 - Application security: What should the attack landscape look ...
Devoxx UK 2022 - Application security: What should the attack landscape look ...Devoxx UK 2022 - Application security: What should the attack landscape look ...
Devoxx UK 2022 - Application security: What should the attack landscape look ...Chris Swan
 
Flutter Festival London 2022 - End to end IoT with Dart and Flutter
Flutter Festival London 2022 - End to end IoT with Dart and FlutterFlutter Festival London 2022 - End to end IoT with Dart and Flutter
Flutter Festival London 2022 - End to end IoT with Dart and FlutterChris Swan
 
Full Stack Squared 2022 - Power of Open Source
Full Stack Squared 2022   - Power of Open SourceFull Stack Squared 2022   - Power of Open Source
Full Stack Squared 2022 - Power of Open SourceChris Swan
 
Keeping a project going
Keeping a project goingKeeping a project going
Keeping a project goingChris Swan
 
TMS9995 on RC2014
TMS9995 on RC2014TMS9995 on RC2014
TMS9995 on RC2014Chris Swan
 
CloudCamp London Nov 2019 Intro
CloudCamp London Nov 2019 IntroCloudCamp London Nov 2019 Intro
CloudCamp London Nov 2019 IntroChris Swan
 
DevSecOps Days London - Teaching 'Shift Left on Security'
DevSecOps Days London - Teaching 'Shift Left on Security'DevSecOps Days London - Teaching 'Shift Left on Security'
DevSecOps Days London - Teaching 'Shift Left on Security'Chris Swan
 
Cooking with a touch of science and a dash of engineering
Cooking with a touch of science and a dash of engineeringCooking with a touch of science and a dash of engineering
Cooking with a touch of science and a dash of engineeringChris Swan
 
Agile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless world
Agile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless worldAgile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless world
Agile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless worldChris Swan
 
The Marginal Cost of Making Mistakes
The Marginal Cost of Making MistakesThe Marginal Cost of Making Mistakes
The Marginal Cost of Making MistakesChris Swan
 
CloudCamp London 8 Mar 2018 - Douglas Adams
CloudCamp London 8 Mar 2018 - Douglas AdamsCloudCamp London 8 Mar 2018 - Douglas Adams
CloudCamp London 8 Mar 2018 - Douglas AdamsChris Swan
 
Jeffconf 2017 LessOps
Jeffconf 2017 LessOpsJeffconf 2017 LessOps
Jeffconf 2017 LessOpsChris Swan
 
"Our problems are easy"
"Our problems are easy""Our problems are easy"
"Our problems are easy"Chris Swan
 

More from Chris Swan (20)

LNETM - Atsign - Privacy with Personal Data Services
LNETM - Atsign - Privacy with Personal Data ServicesLNETM - Atsign - Privacy with Personal Data Services
LNETM - Atsign - Privacy with Personal Data Services
 
SOOCon24 - Showing that you care about security - OpenSSF Scorecards
SOOCon24 - Showing that you care about security - OpenSSF ScorecardsSOOCon24 - Showing that you care about security - OpenSSF Scorecards
SOOCon24 - Showing that you care about security - OpenSSF Scorecards
 
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdfAll Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
All Day DevOps 2023 - Implementing OSSF Scorecards Across an Organisation.pdf
 
QConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an OrganisationQConNY 2023 - Implementing OSSF Scorecards Across an Organisation
QConNY 2023 - Implementing OSSF Scorecards Across an Organisation
 
Flutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and Flutter
Flutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and FlutterFlutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and Flutter
Flutter SV Meetup Oct 2022 - End to end encrypted IoT with Dart and Flutter
 
London IoT Meetup Sep 2022 - End to end encrypted IoT
London IoT Meetup Sep 2022 - End to end encrypted IoTLondon IoT Meetup Sep 2022 - End to end encrypted IoT
London IoT Meetup Sep 2022 - End to end encrypted IoT
 
EMFcamp2022 - What if apps logged into you, instead of you logging into apps?
EMFcamp2022 - What if apps logged into you, instead of you logging into apps?EMFcamp2022 - What if apps logged into you, instead of you logging into apps?
EMFcamp2022 - What if apps logged into you, instead of you logging into apps?
 
Devoxx UK 2022 - Application security: What should the attack landscape look ...
Devoxx UK 2022 - Application security: What should the attack landscape look ...Devoxx UK 2022 - Application security: What should the attack landscape look ...
Devoxx UK 2022 - Application security: What should the attack landscape look ...
 
Flutter Festival London 2022 - End to end IoT with Dart and Flutter
Flutter Festival London 2022 - End to end IoT with Dart and FlutterFlutter Festival London 2022 - End to end IoT with Dart and Flutter
Flutter Festival London 2022 - End to end IoT with Dart and Flutter
 
Full Stack Squared 2022 - Power of Open Source
Full Stack Squared 2022   - Power of Open SourceFull Stack Squared 2022   - Power of Open Source
Full Stack Squared 2022 - Power of Open Source
 
Keeping a project going
Keeping a project goingKeeping a project going
Keeping a project going
 
TMS9995 on RC2014
TMS9995 on RC2014TMS9995 on RC2014
TMS9995 on RC2014
 
CloudCamp London Nov 2019 Intro
CloudCamp London Nov 2019 IntroCloudCamp London Nov 2019 Intro
CloudCamp London Nov 2019 Intro
 
DevSecOps Days London - Teaching 'Shift Left on Security'
DevSecOps Days London - Teaching 'Shift Left on Security'DevSecOps Days London - Teaching 'Shift Left on Security'
DevSecOps Days London - Teaching 'Shift Left on Security'
 
Cooking with a touch of science and a dash of engineering
Cooking with a touch of science and a dash of engineeringCooking with a touch of science and a dash of engineering
Cooking with a touch of science and a dash of engineering
 
Agile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless world
Agile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless worldAgile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless world
Agile Enterprise Rome 2018 - Ops and Security in a PaaS and Serverless world
 
The Marginal Cost of Making Mistakes
The Marginal Cost of Making MistakesThe Marginal Cost of Making Mistakes
The Marginal Cost of Making Mistakes
 
CloudCamp London 8 Mar 2018 - Douglas Adams
CloudCamp London 8 Mar 2018 - Douglas AdamsCloudCamp London 8 Mar 2018 - Douglas Adams
CloudCamp London 8 Mar 2018 - Douglas Adams
 
Jeffconf 2017 LessOps
Jeffconf 2017 LessOpsJeffconf 2017 LessOps
Jeffconf 2017 LessOps
 
"Our problems are easy"
"Our problems are easy""Our problems are easy"
"Our problems are easy"
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

QConSF 2022 - Backends in Dart

  • 1. © 2022 - Atsign | docs.atsign.com Backends in Dart QConSF - Oct 2022 / QCon Plus - Nov 2022
  • 2.
  • 3.
  • 4. © 2022 - Atsign | docs.atsign.com “Dart is a client-optimized language for fast apps on any platform” dart.dev
  • 9. © 2022 - Atsign | docs.atsign.com What I do 1. Improve the quality of documentation, samples and examples, so that atSigns are the easiest way for developers to build apps that have privacy preserving identity. 2. Build Continuous Delivery pipelines as a first step towards Progressive Delivery and Chaos Engineering so that we can confidently deploy high quality well tested software. 3. Lay the foundations for an engineering organisation that’s optimised for high productivity by minimising cognitive load on teams and the people working in those teams.
  • 10. © 2022 - Atsign | docs.atsign.com What I do 1. Improve the quality of documentation, samples and examples, so that atSigns are the easiest way for developers to build apps that have privacy preserving identity. 2. Build Continuous Delivery pipelines as a first step towards Progressive Delivery and Chaos Engineering so that we can confidently deploy high quality well tested software. 3. Lay the foundations for an engineering organisation that’s optimised for high productivity by minimising cognitive load on teams and the people working in those teams.
  • 11. © 2022 - Atsign | docs.atsign.com What I do 1. Improve the quality of documentation, samples and examples, so that atSigns are the easiest way for developers to build apps that have privacy preserving identity. 2. Build Continuous Delivery pipelines as a first step towards Progressive Delivery and Chaos Engineering so that we can confidently deploy high quality well tested software. 3. Lay the foundations for an engineering organisation that’s optimised for high productivity by minimising cognitive load on teams and the people working in those teams.
  • 12. © 2022 - Atsign | docs.atsign.com Agenda ➔ Why Dart? ➔ Language features ➔ Just in time (JIT) vs Ahead of time (AOT) ➔ Dart in Containers ➔ Profiling and performance management ➔ A middle way with jit-snapshot?
  • 13. Why Dart? Industry big picture.
  • 14. © 2022 - The @ Company | atsign.dev Flutter pulled Dart into the Redmonk Top 20 1 JavaScript 2 Python 3 Java 4 PHP 5 CSS 5 C# 7 C++ 8 TypeScript 9 Ruby 10 C 11 Swift 12 R 13 Objective-C 14 Shell 14 Scala 16 Go 17 PowerShell 18 Kotlin 19 Rust 19 Dart
  • 15. Why Dart for Atsign?
  • 16. atSigns are personal data stores Alice (thing) Bob’s app Data about stuff Alice PDS Bob PDS
  • 17. Dart AOT binaries produce really small containers
  • 18. VPC Infrastructure for ~6500 atSigns Docker Swarm Manager Nodes e2-custom-4-8192 Ubuntu 22.04 LTS 1 2 3 Worker Nodes e2-standard-4 Flatcar Linux (Stable channel) 4 5 6 7 20 21 19 . . . NetApp Cloud Volume CVS-Performance
  • 20. ‘Hello World!’ void main() { print('Hello, World!'); }
  • 21. Async/await (like JavaScript) Future<String> createOrderMessage() async { var order = await fetchUserOrder(); return 'Your order is: $order'; } Future<String> fetchUserOrder() => // Imagine that this function is // more complex and slow. Future.delayed( const Duration(seconds: 2), () => 'Large Latte', ); Future<void> main() async { print('Fetching user order...'); print(await createOrderMessage()); }
  • 22. Concurrency - Isolates “independent workers that are similar to threads but don’t share memory, communicating only through messages”
  • 23. Sound null safety (since Dart 2.12, Mar 2021) // In null-safe Dart, none of these can ever be null. var i = 42; // Inferred to be an int. String name = getFileName(); final b = Foo(); // To indicate that a variable might have the value null // just add ? to its type declaration int? aNullableInt = null;
  • 25. Package Manager - pub.dev
  • 27. Dartshowplatform - A more useful ‘Hello World!’ import 'dart:io' show Platform, stdout; void main() { print(Platform.version); } 2.18.2 (stable) (Tue Sep 27 13:24:11 2022 +0200) on "linux_arm64"
  • 28. JIT - Just `dart run` it in the virtual machine $ time dart run showplatform.dart 2.18.2 (stable) (Tue Sep 27 13:24:11 2022 +0200) on "linux_arm64" real 0m6.588s user 0m5.862s sys 0m0.925s
  • 29. AOT - Compile it first then run the binary $ dart compile exe showplatform.dart $ time ./showplatform.exe 2.18.2 (stable) (Tue Sep 27 13:24:11 2022 +0200) on "linux_arm64" real 0m0.027s user 0m0.012s sys 0m0.018s
  • 30. Trade off - compilation is slow $ time dart compile exe showplatform.dart Info: Compiling with sound null safety Generated: showplatform.exe real 0m18.184s user 0m22.533s sys 0m2.643s
  • 32. A typical Dockerfile for AOT compiled Dart binary FROM dart AS build WORKDIR /app COPY ./mydemoapp.dart . RUN dart pub get RUN dart compile exe /app/mydemoapp.dart -o /app/mydemoapp FROM scratch COPY --from=build /runtime/ / COPY --from=build /app/mydemoapp /app/mydemoapp ENTRYPOINT ["/app/mydemoapp"]
  • 33. Image sizes for a trivial application
  • 34. Image sizes for a non trivial application
  • 39. But… DevTools need to connect to a VM, so JIT only
  • 41. Creating and running a jit-snapshot $ dart compile jit-snapshot showplatform.dart $ time dart run showplatform.jit 2.18.2 (stable) (Tue Sep 27 13:24:11 2022 +0200) on "linux_arm64" real 0m1.786s user 0m1.783s sys 0m0.341s
  • 42. Putting a jit-snapshot into a container FROM dart AS build WORKDIR /app COPY ./mydemoapp.dart . RUN dart pub get RUN dart compile jit-snapshot /app/mydemoapp.dart -o /app/mydemoapp.jit FROM scratch COPY --from=build /runtime/ / COPY --from=build /usr/lib/dart/bin/ /usr/lib/dart/bin/ COPY --from=build /app/mydemoapp.jit /app/mydemoapp.jit ENTRYPOINT ["/usr/lib/dart/bin/dart","run", "--observe=8181/0.0.0.0","/app/mydemoapp.jit"]
  • 43. Container image sizes REPOSITORY TAG SIZE atsigncompany/secondary dev_obs 1.25GB atsigncompany/secondary prod 14.5MB cpswan/secondary obsjit 430MB
  • 44. Runtime resource usage CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O f938de4395a7 ss_secondary.1.7wnwoifieezhdc91gkdwqnn12 0.04% 8.359MiB / 976.9MiB 0.86% 2.56kB / 5.97kB 6043df1c0027 cpsbh_secondary.1.xkfk5w2gl76vhi8ifx8t94z37 0.05% 87.47MiB / 976.9MiB 8.95% 3.03kB / 6.05kB
  • 45.
  • 46. © 2022 - Atsign | docs.atsign.com Review ➔ Why Dart? ➔ Language features ➔ Just in time (JIT) vs Ahead of time (AOT) ➔ Dart in Containers ➔ Profiling and performance management ➔ A middle way with jit-snapshot?
  • 47. © 2022 - Atsign | docs.atsign.com Call to action: Try Dart yourself https://dart.dev/codelabs
  • 48. Thanks for your time chris@atsign.com @cpswan