Arnaud Bouchez - Synopse
Frameworks
Expressiveness
Arnaud Bouchez
• Open Source Founder
mORMot 2
SynPDF, dmustache
• Modern Delphi and FPC
DDD, SOA, ORM, MVC
Performance, SOLID
• Synopse
https://synopse.info
Arnaud Bouchez
dev @ https://tranquil.it/wapt
SW deployment Windows updates
IT Inventory
Arnaud Bouchez
dev @ https://tranquil.it/wapt
+7000 +400 +1 300 000
sw packages customers pc equipped
Frameworks Expressiveness
Frameworks Expressiveness
not performance (tomorrow)
not exhaustive
not Delphi centric
Menu du jour
• The TFB Challenge
• Languages & Frameworks
• Object Pascal & mORMot
• Some Thoughts
The TFB Challenge
https://www.techempower.com/benchmarks
The TFB Challenge
The TFB Challenge
Web Frameworks Benchmarks
• Since 2013, a collaborative project
• Now one official round per year
• Hundredths of frameworks tested
• Seven web /endpoints tested
• 24/7 continuous tests on dedicated HW
The TFB Challenge
One official round per year
• Round 22 is just finished
• Round 22 should be published very soon
• Including object pascal with mORMot
The TFB Challenge
Hundredths of frameworks tested
• Currently 301 frameworks
• In 791 flavors/configurations
• All languages
The TFB Challenge
Hundredths of frameworks tested
• Currently 301 frameworks
• In 791 flavors/configurations
• All languages: C, C++, CFML, C#, Clojure,
Crystal, D, Dart, Elixir, Erlang, F#, Fortran,
Go, Groovy, Haskell, Java, JavaScript, Julia,
Kotlin, Lisp, Lua, Nim, OCaml, PhP,
Pascal, Prolog, Python, R, Racket, Ruby, Rust,
Scala, Swift, TypeScript, Ur, V, VB , Vala …
The TFB Challenge
Seven web /endpoints tested
/plaintext
/json
/db
/query?queries=###
/cached_queries?count=###
/update?queries=###
/fortunes
The TFB Challenge
24/7 continuous tests on big HW
• Three homogeneous Dell R440 servers:
as web client, web server, database
• Each with an Intel Xeon Gold 5120 CPU
• 32 GB of memory, enterprise SSD
• Dedicated Cisco 10-gigabit Ethernet switch
The TFB Challenge
24/7 continuous tests on big HW
Latest runs are available at
https://tfb-status.techempower.com
The TFB Challenge
Motivation(s)
• Officially: measure performance
to reduce cost of ownership
and enhance usability and scalability
• For us: investigate the diverse philosophies
of the frameworks
and their corresponding languages
The TFB Challenge
Demo
• Reproduce on my dev laptop
• Compiled on Linux with Lazarus
• Run locally on the very same machine
Languages & Frameworks
Languages & Frameworks
Opinioned Language Clustering
• Old and boring: C, C++, C#, Java
• Trendy: Go, Rust
• Fast scripts: JavaScript, TypeScript
• Slow scripts: PhP, Python, Ruby
• Esoteric: xyz…
Languages & Frameworks
Opinioned Language Clustering
• Old and boring: C, C++, C#, Java
• Trendy: Go, Rust
• Fast scripts: JavaScript, TypeScript
• Slow scripts: PhP, Python, Ruby
• Esoteric: xyz… object pascal?
Languages & Frameworks
Performance and Languages
• Some trends:
most Rust is on top, most Python is on bottom
• But it depends on the framework
e.g. you can have poorly behaving C++
and amazing or dead slow JavaScript
Languages & Frameworks
Performance and Frameworks
• Some are Performance focused
other are Features focused
• Proof of concept
or Production ready
• Usually, the more featured, the slower
and top frameworks are more like POC
Languages & Frameworks
Performance Bottlenecks
• The Web Server
• The Database layer
• The threading/execution Model
• The RTL (JSON, heap…)
Languages & Frameworks
Performance Languages
• async / coroutines :
when the threading/execution Model
is built into the language
• The fastest use it (C++, Rust, Go, C#, JS)
• The slowest (ruby, python) are not compiled
and have scaling issues (giant locks)
Languages & Frameworks
Performance Languages
asp.net core
https://github.com/TechEmpower/Framewo
rkBenchmarks/tree/master/frameworks/C
Sharp/aspnetcore/src/Platform
Languages & Frameworks
Performance Languages
c libh2o
https://github.com/TechEmpower/Framewo
rkBenchmarks/blob/master/frameworks/C
/h2o/src/handlers/plaintext.c
Languages & Frameworks
Performance Languages
Rust ntex
https://github.com/TechEmpower/Framewo
rkBenchmarks/blob/master/frameworks/R
ust/ntex/src/main.rs
Languages & Frameworks
Performance Languages
JavaScript just
https://github.com/TechEmpower/Framewo
rkBenchmarks/blob/master/frameworks/J
avaScript/just/techempower.js
Languages & Frameworks
Performance Languages
Java vertx
https://github.com/TechEmpower/Framewo
rkBenchmarks/blob/master/frameworks/J
ava/vertx/src/main/java/vertx/App.java
Languages & Frameworks
Performance Frameworks
• Manual tuning in user code
with minimalistic/baremetal framework
• High-level user code
and very optimized/PoC framework
Languages & Frameworks
Performance and Production
• e.g. custom PostgreSQL driver
using (at best) MD5 password
• no parsing of the HTTP headers
• optimized for a few identical requests
from a fast local client
• no GC/stability measurement
Object Pascal & mORMot
Object Pascal & mORMot
Object Pascal – why not?
• Delphi is mostly Windows-centric
and not an Open Source compiler
• FPC is a niche, underestimated compiler
• Old and boring language
• Mostly used on client side for RAD UI
with a 2-layer DB design
not a 3-layer Web framework design
Object Pascal & mORMot
Object Pascal
• As system language:
pointers, buffers - close to the metal
• As high-level language:
class, string, interface - abstract
Object Pascal & mORMot
mORMot 2
• 10+ years of Web Server code experience
• Full rewrite
for performance and maintainability
• Validated with the TFB challenge
for stability and scalability
Object Pascal & mORMot
mORMot 2
• Cross-platform & cross-compiler RTL
• REST over several Web Servers
• High level SOA/REST using interfaces
• Low level WEB/HTTP classes
Object Pascal & mORMot
mORMot 2
• Cross-platform & cross-compiler RTL
• REST over several Web Servers
• High level SOA/REST using interfaces
• Low level WEB/HTTP classes
Object Pascal & mORMot
mORMot 2 TFB Sample
• Command line tool
• Data/ORM structures
• HTTP routing
• Database/ORM layers
• Built-in {{mustache}} templates
• Asynchronous execution
Object Pascal & mORMot
mORMot 2 TFB Sample
https://github.com/synopse/mORMot2/tre
e/master/ex/techempower-bench
Object Pascal & mORMot
Performance Frameworks
• Manual tuning in user code
with minimalistic/baremetal framework
• High-level user code
and very optimized/PoC framework
Some Thoughts
Some Thoughts
No Magic Bullet
• “Fast” languages could make
“Slow” projects
• “Slow” languages could make
“Fast” projects
Some Thoughts
Pascal Still Relevant
• Easy to read and write
• ‘asynchronous-of-the-poor’ ™
anonymous methods do help
still missing an async keyword
• Not restricted to RAD and Windows
• Open Source rocks (FPC & mORMot)
Frameworks Expressiveness
Questions? Wishes?
Opinions? Reactions?
No Marmots Were Harmed in the Making of This Session

EKON27-FrameworksExpressiveness.pdf

  • 1.
    Arnaud Bouchez -Synopse Frameworks Expressiveness
  • 2.
    Arnaud Bouchez • OpenSource Founder mORMot 2 SynPDF, dmustache • Modern Delphi and FPC DDD, SOA, ORM, MVC Performance, SOLID • Synopse https://synopse.info
  • 3.
    Arnaud Bouchez dev @https://tranquil.it/wapt SW deployment Windows updates IT Inventory
  • 4.
    Arnaud Bouchez dev @https://tranquil.it/wapt +7000 +400 +1 300 000 sw packages customers pc equipped
  • 5.
  • 6.
    Frameworks Expressiveness not performance(tomorrow) not exhaustive not Delphi centric
  • 7.
    Menu du jour •The TFB Challenge • Languages & Frameworks • Object Pascal & mORMot • Some Thoughts
  • 8.
  • 9.
  • 10.
    The TFB Challenge WebFrameworks Benchmarks • Since 2013, a collaborative project • Now one official round per year • Hundredths of frameworks tested • Seven web /endpoints tested • 24/7 continuous tests on dedicated HW
  • 11.
    The TFB Challenge Oneofficial round per year • Round 22 is just finished • Round 22 should be published very soon • Including object pascal with mORMot
  • 12.
    The TFB Challenge Hundredthsof frameworks tested • Currently 301 frameworks • In 791 flavors/configurations • All languages
  • 13.
    The TFB Challenge Hundredthsof frameworks tested • Currently 301 frameworks • In 791 flavors/configurations • All languages: C, C++, CFML, C#, Clojure, Crystal, D, Dart, Elixir, Erlang, F#, Fortran, Go, Groovy, Haskell, Java, JavaScript, Julia, Kotlin, Lisp, Lua, Nim, OCaml, PhP, Pascal, Prolog, Python, R, Racket, Ruby, Rust, Scala, Swift, TypeScript, Ur, V, VB , Vala …
  • 14.
    The TFB Challenge Sevenweb /endpoints tested /plaintext /json /db /query?queries=### /cached_queries?count=### /update?queries=### /fortunes
  • 15.
    The TFB Challenge 24/7continuous tests on big HW • Three homogeneous Dell R440 servers: as web client, web server, database • Each with an Intel Xeon Gold 5120 CPU • 32 GB of memory, enterprise SSD • Dedicated Cisco 10-gigabit Ethernet switch
  • 16.
    The TFB Challenge 24/7continuous tests on big HW Latest runs are available at https://tfb-status.techempower.com
  • 17.
    The TFB Challenge Motivation(s) •Officially: measure performance to reduce cost of ownership and enhance usability and scalability • For us: investigate the diverse philosophies of the frameworks and their corresponding languages
  • 18.
    The TFB Challenge Demo •Reproduce on my dev laptop • Compiled on Linux with Lazarus • Run locally on the very same machine
  • 19.
  • 20.
    Languages & Frameworks OpinionedLanguage Clustering • Old and boring: C, C++, C#, Java • Trendy: Go, Rust • Fast scripts: JavaScript, TypeScript • Slow scripts: PhP, Python, Ruby • Esoteric: xyz…
  • 21.
    Languages & Frameworks OpinionedLanguage Clustering • Old and boring: C, C++, C#, Java • Trendy: Go, Rust • Fast scripts: JavaScript, TypeScript • Slow scripts: PhP, Python, Ruby • Esoteric: xyz… object pascal?
  • 22.
    Languages & Frameworks Performanceand Languages • Some trends: most Rust is on top, most Python is on bottom • But it depends on the framework e.g. you can have poorly behaving C++ and amazing or dead slow JavaScript
  • 23.
    Languages & Frameworks Performanceand Frameworks • Some are Performance focused other are Features focused • Proof of concept or Production ready • Usually, the more featured, the slower and top frameworks are more like POC
  • 24.
    Languages & Frameworks PerformanceBottlenecks • The Web Server • The Database layer • The threading/execution Model • The RTL (JSON, heap…)
  • 25.
    Languages & Frameworks PerformanceLanguages • async / coroutines : when the threading/execution Model is built into the language • The fastest use it (C++, Rust, Go, C#, JS) • The slowest (ruby, python) are not compiled and have scaling issues (giant locks)
  • 26.
    Languages & Frameworks PerformanceLanguages asp.net core https://github.com/TechEmpower/Framewo rkBenchmarks/tree/master/frameworks/C Sharp/aspnetcore/src/Platform
  • 27.
    Languages & Frameworks PerformanceLanguages c libh2o https://github.com/TechEmpower/Framewo rkBenchmarks/blob/master/frameworks/C /h2o/src/handlers/plaintext.c
  • 28.
    Languages & Frameworks PerformanceLanguages Rust ntex https://github.com/TechEmpower/Framewo rkBenchmarks/blob/master/frameworks/R ust/ntex/src/main.rs
  • 29.
    Languages & Frameworks PerformanceLanguages JavaScript just https://github.com/TechEmpower/Framewo rkBenchmarks/blob/master/frameworks/J avaScript/just/techempower.js
  • 30.
    Languages & Frameworks PerformanceLanguages Java vertx https://github.com/TechEmpower/Framewo rkBenchmarks/blob/master/frameworks/J ava/vertx/src/main/java/vertx/App.java
  • 31.
    Languages & Frameworks PerformanceFrameworks • Manual tuning in user code with minimalistic/baremetal framework • High-level user code and very optimized/PoC framework
  • 32.
    Languages & Frameworks Performanceand Production • e.g. custom PostgreSQL driver using (at best) MD5 password • no parsing of the HTTP headers • optimized for a few identical requests from a fast local client • no GC/stability measurement
  • 33.
  • 34.
    Object Pascal &mORMot Object Pascal – why not? • Delphi is mostly Windows-centric and not an Open Source compiler • FPC is a niche, underestimated compiler • Old and boring language • Mostly used on client side for RAD UI with a 2-layer DB design not a 3-layer Web framework design
  • 35.
    Object Pascal &mORMot Object Pascal • As system language: pointers, buffers - close to the metal • As high-level language: class, string, interface - abstract
  • 36.
    Object Pascal &mORMot mORMot 2 • 10+ years of Web Server code experience • Full rewrite for performance and maintainability • Validated with the TFB challenge for stability and scalability
  • 37.
    Object Pascal &mORMot mORMot 2 • Cross-platform & cross-compiler RTL • REST over several Web Servers • High level SOA/REST using interfaces • Low level WEB/HTTP classes
  • 38.
    Object Pascal &mORMot mORMot 2 • Cross-platform & cross-compiler RTL • REST over several Web Servers • High level SOA/REST using interfaces • Low level WEB/HTTP classes
  • 39.
    Object Pascal &mORMot mORMot 2 TFB Sample • Command line tool • Data/ORM structures • HTTP routing • Database/ORM layers • Built-in {{mustache}} templates • Asynchronous execution
  • 40.
    Object Pascal &mORMot mORMot 2 TFB Sample https://github.com/synopse/mORMot2/tre e/master/ex/techempower-bench
  • 41.
    Object Pascal &mORMot Performance Frameworks • Manual tuning in user code with minimalistic/baremetal framework • High-level user code and very optimized/PoC framework
  • 42.
  • 43.
    Some Thoughts No MagicBullet • “Fast” languages could make “Slow” projects • “Slow” languages could make “Fast” projects
  • 44.
    Some Thoughts Pascal StillRelevant • Easy to read and write • ‘asynchronous-of-the-poor’ ™ anonymous methods do help still missing an async keyword • Not restricted to RAD and Windows • Open Source rocks (FPC & mORMot)
  • 45.
    Frameworks Expressiveness Questions? Wishes? Opinions?Reactions? No Marmots Were Harmed in the Making of This Session