perl 6 concurrency - jonathan worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · the...
TRANSCRIPT
![Page 1: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/1.jpg)
Perl 6 Concurrency
Jonathan Worthington | Edument
![Page 2: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/2.jpg)
Hi. I'm Jonathan.
![Page 3: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/3.jpg)
Hi. I'm Jonathan.
I do Perl 6 stuff.... Perl 6 concurrency designer
MoarVM founder and architect Rakudo compiler developer
![Page 4: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/4.jpg)
Hi. I'm Jonathan.
I do Perl 6 stuff.... Perl 6 concurrency designer
MoarVM founder and architect Rakudo compiler developer
And I lead the Edument Prague office... Developer tooling and compiler consultancy
Founder of Cro and Comma
![Page 5: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/5.jpg)
Today...
![Page 6: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/6.jpg)
The essence of Perl 6 concurrency Key concepts and mechanisms
![Page 7: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/7.jpg)
The essence of Perl 6 concurrency Key concepts and mechanisms
The application of Perl 6 concurrency A case-study from a production application
![Page 8: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/8.jpg)
The essence of Perl 6 concurrency Key concepts and mechanisms
The application of Perl 6 concurrency A case-study from a production application
The future of Perl 6 concurrency Where are we heading?
![Page 9: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/9.jpg)
The
essence of Perl 6 Concurrency
![Page 10: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/10.jpg)
The essence of Perl 6 concurrency and parallelism reflects the essence of the
Perl language family…
![Page 11: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/11.jpg)
A Perlish language is
multi-paradigm
![Page 12: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/12.jpg)
Because when we have a range of problem-solving tools, we can choose the most appropriate one for
the problem at hand
![Page 13: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/13.jpg)
Concurrency
Trying to get the right result when we have multiple,
possibly competing, tasks with overlapping start/end times
![Page 14: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/14.jpg)
We don't choose concurrency.
Concurrency chooses us.
![Page 15: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/15.jpg)
Parallelism
Exploit multi-core hardware to do the same task, and deliver equivalent results, but in less
wallclock time.
![Page 16: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/16.jpg)
Concurrency is part of the
problem domain.
Parallelism is part of the
solution domain.
![Page 17: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/17.jpg)
With concurrency, correctness
is domain specific.
With parallelism, correctness
is just equivalence.
![Page 18: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/18.jpg)
Concurrency and parallelism are best addressed by
different tools.
![Page 19: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/19.jpg)
In fact, there's different kinds of
parallelism…
![Page 20: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/20.jpg)
Task parallel
![Page 21: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/21.jpg)
Task parallel
Data parallel
![Page 22: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/22.jpg)
And different approaches to concurrency…
![Page 23: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/23.jpg)
Concurrent objects
Object
Method calls
![Page 24: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/24.jpg)
Concurrent objects
Event processing
Object
Method calls
Event Processor
Event Event Event
![Page 25: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/25.jpg)
Perl 6 provides for all of these, and more
![Page 26: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/26.jpg)
A Perlish language makes the
easy things easy
![Page 27: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/27.jpg)
my ($input-config, $app-config) =
do {
load-yaml slurp $input-file
},
do {
from-json $_ with slurp $*HOME.add('.fooconf')
}
Load and parse two files in parallel
my ($input-config, $app-config) = await
start {
load-yaml slurp $input-file
},
start {
from-json $_ with slurp $*HOME.add('.fooconf')
}
![Page 28: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/28.jpg)
.say for (1..*) .grep(-> $n { $n.is-prime && $n eq $n.flip }) .head(100);
Parallel search for 100 palindromic primes
.say for (1..*) .hyper(batch => 512, degree => 6) .grep(-> $n { $n.is-prime && $n eq $n.flip }) .head(100);
![Page 29: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/29.jpg)
class Cache { has %!entries; method add(Str $key, Any $value --> Nil) { %!entries{$key} = $value; } method lookup(Str $key --> Any) { %!entries{$key} // fail "No entry '$key'" } }
Acquire a lock around all method calls
monitor Cache { has %!entries; method add(Str $key, Any $value --> Nil) { %!entries{$key} = $value; } method lookup(Str $key --> Any) { %!entries{$key} // fail "No entry '$key'" } }
![Page 30: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/30.jpg)
Re-run a script whenever it changes
react { my $current-proc; whenever $script.watch.unique(:as(*.path), :expires(1)) { .kill with $current-proc; $current-proc = Proc::Async.new($*EXECUTABLE, $script); my $done = $current-proc.start; whenever $done { $current-proc = Nil; } } }
react { my $current-proc; whenever $script.watch.unique(:as(*.path), :expires(1)) { .kill with $current-proc; $current-proc = Proc::Async.new($*EXECUTABLE, $script); my $done = $current-proc.start; whenever $done { $current-proc = Nil; } } }
react { my $current-proc; whenever $script.watch.unique(:as(*.path), :expires(1)) { .kill with $current-proc; $current-proc = Proc::Async.new($*EXECUTABLE, $script); my $done = $current-proc.start; whenever $done { $current-proc = Nil; } } }
react { my $current-proc; whenever $script.watch.unique(:as(*.path), :expires(1)) { .kill with $current-proc; $current-proc = Proc::Async.new($*EXECUTABLE, $script); my $done = $current-proc.start; whenever $done { $current-proc = Nil; } } }
react { my $current-proc; whenever $script.watch.unique(:as(*.path), :expires(1)) { .kill with $current-proc; $current-proc = Proc::Async.new($*EXECUTABLE, $script); my $done = $current-proc.start; whenever $done { $current-proc = Nil; } } }
![Page 31: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/31.jpg)
A Perlish language makes the
hard things possible
![Page 32: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/32.jpg)
Perl 6 provides access too…
OS-level threads
Locks Atomic operations
![Page 33: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/33.jpg)
Don't use them!*
![Page 34: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/34.jpg)
Don't use them!*
* Unless you're implementing new concurrency or parallelism paradigms
and data structures in Perl 6
![Page 35: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/35.jpg)
A Perlish language offers
whip-up-ability
![Page 36: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/36.jpg)
When we "whip up a solution", we're typically taking existing components, which we then
wire together
![Page 37: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/37.jpg)
And wiring things together depends on them having a
common interface
![Page 38: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/38.jpg)
Promise A single, asynchronously
produced, value
Supply A stream of asynchronously
produced values
![Page 39: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/39.jpg)
A Supply can be…
Network packets WebSocket messages
File system notifications Child process output
UI events Timer ticks
Domain events
![Page 40: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/40.jpg)
A Perlish language will
torture the language implementer for the sake
of the language user
![Page 41: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/41.jpg)
M : N
![Page 42: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/42.jpg)
M : N High-level
tasks OS-level threads
![Page 43: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/43.jpg)
M : N High-level
tasks OS-level threads
Many ~Core-count
![Page 44: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/44.jpg)
await
Suspend the current high-level task until the
thing it needs is available
![Page 45: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/45.jpg)
async?
![Page 46: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/46.jpg)
No async!
No need to refactor all of the callers in order to use await!
Just save the whole stack.
![Page 47: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/47.jpg)
A Perlish language helps us to
do the right thing
![Page 48: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/48.jpg)
What does the supply/whenever
syntax give us?
![Page 49: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/49.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Thanks to using it, this code will work robustly…
![Page 50: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/50.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Unsubscription, however things end
![Page 51: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/51.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Unsubscription, however things end
If the data source
completes…
![Page 52: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/52.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Unsubscription, however things end
If the data source
completes, cancel the timeout
![Page 53: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/53.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Unsubscription, however things end
If we hit the timeout…
![Page 54: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/54.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Unsubscription, however things end
If we hit the timeout, close the
data source
![Page 55: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/55.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic exception propagation
![Page 56: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/56.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic exception propagation
If the data source
crashes…
![Page 57: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/57.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic exception propagation
If the data source
crashes, cancel the timeout,
convey the exception
![Page 58: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/58.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic cleanup upon downstream close
![Page 59: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/59.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic cleanup upon downstream close
If our consumer
unsubscribes…
![Page 60: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/60.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic cleanup upon downstream close
If our consumer
unsubscribes, close the data
source and cancel the timeout
![Page 61: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/61.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic concurrency control
![Page 62: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/62.jpg)
sub timeout(Supply $source, Real $seconds --> Supply) {
supply {
whenever $source {
emit $_;
LAST done;
}
whenever Promise.in($seconds) {
die X::Timeout.new;
}
}
}
Automatic concurrency control
We'll only ever be in one whenever
block at a time
![Page 63: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/63.jpg)
Even if we remembered all of these, it'd be a huge amount of boilerplate
Instead, we just Do The
Right Thing
![Page 64: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/64.jpg)
The
application of Perl 6 Concurrency
![Page 65: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/65.jpg)
eAsii
A tool to assist insurance or reinsurance undertakings with
calculation of the European regulatory standard formula (Solvency II, Pillar I)
and associated reporting to the supervisory authority via XBRL
(Solvency II, Pillar III).
![Page 66: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/66.jpg)
EasiiLang
A pure, functional, non-Turing Complete language
The entire calculation forms a DAG, so can see the path from input to result
Syntax inspired by Perl 6
![Page 67: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/67.jpg)
EasiiLang was easy...
Parsed by a Perl 6 grammar
Produces a tree, which is walked to evaluate the expression
Perl 6 is good at this stuff. But, that's
not the focus for today...
![Page 68: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/68.jpg)
Architecture Backend
Exposes a HTTP API (using Cro) Versioned Input Storage (uses a SQLite database)
Live Dataset (in-memory reactive calculation)
![Page 69: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/69.jpg)
Architecture Backend
Exposes a HTTP API (using Cro) Versioned Input Storage (uses a SQLite database)
Live Dataset (in-memory reactive calculation)
Frontend JavaScript Application (qooxdoo, transpilation)
View, View Model, Store
![Page 70: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/70.jpg)
Architecture Backend
Exposes a HTTP API (using Cro) Versioned Input Storage (uses a SQLite database)
Live Dataset (in-memory reactive calculation)
Frontend JavaScript Application (qooxdoo, transpilation)
View, View Model, Store
HTTP WebSocket
![Page 71: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/71.jpg)
Cro
Libraries for building distributed systems; currently mostly used for
building HTTP applications
Request and response processing pipeline is a set of steps connected
using Supply asynchronous
![Page 72: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/72.jpg)
Cro has...
WebSocket support
Reactive middleware
Log::Timeline integration, to allow tools to trace the request pipeline
![Page 73: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/73.jpg)
![Page 74: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/74.jpg)
6 requests being served in parallel
![Page 75: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/75.jpg)
![Page 76: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/76.jpg)
Drill down into the pipeline
![Page 77: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/77.jpg)
![Page 78: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/78.jpg)
See the cost of each stage
![Page 79: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/79.jpg)
Log::Timeline
Can use it to do application-level logging also
Doing this helped us to understand
the application behavior, and guided our use of parallelism
![Page 80: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/80.jpg)
The model
Developed by mathematicians based on European regulations
Loaded at application startup
During model development, reloaded
when the model is changed
![Page 81: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/81.jpg)
The current model 350+ modules
A YAML file for each. Totals over 100,000 lines of YAML.
Nearly 4,000 formulas 25,000 lines of EasiiLang
between the modules
64 Excel Documents... Based on the legal
requirement of the European supervisory authority
...cached as 7 MB of JSON Since reading from Excel every time we load the
model is too slow
5,500+ lines of CSV Containing parameters, such
as country-specific data
2000+ translation keys And many more to come,
written in .po files
![Page 82: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/82.jpg)
Model loading
As the model grew, model reloads became long enough to be annoying
![Page 83: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/83.jpg)
Can we parallelize?
First, need to consider the data dependencies of model loading
![Page 84: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/84.jpg)
Can we parallelize?
First, need to consider the data dependencies of model loading
The check phase needs layouts, parameters, and
all modules
![Page 85: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/85.jpg)
Can we parallelize?
First, need to consider the data dependencies of model loading
Each module can be parsed and compiled independently...
![Page 86: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/86.jpg)
Can we parallelize?
First, need to consider the data dependencies of model loading
...and without knowing the parameters and layouts.
![Page 87: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/87.jpg)
Data parallelism
When we apply the same operation to many data items
Parallelism comes from partitioning
the data - into items or batches - and spreading them over worker threads
![Page 88: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/88.jpg)
my @modules = @files
.grep(/ \.(yaml|yml) $/)
.map(-> $file {
my $yaml = Easii::Log::ParseModuleYAML.log: $task, :file(~$file), -> {
self!load-yaml($file, $schema, $problems)
}
with $yaml {
Easii::Log::CompileModule.log: $task, :file(~$file), -> {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
}
});
Module loading
![Page 89: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/89.jpg)
my @modules = @files
.grep(/ \.(yaml|yml) $/)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
});
Module loading (Log::Timeline use omitted for simplicity)
![Page 90: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/90.jpg)
Load in parallel my @modules = @files
.grep(/ \.(yaml|yml) $/)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
});
my @modules = @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
});
my @modules = @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
});
![Page 91: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/91.jpg)
But wait... my @modules = @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
});
This problem collector may be used concurrently
![Page 92: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/92.jpg)
Not safe my class Problems {
has @.errors;
method add-error($error--> Nil) {
@!errors.push($error);
}
}
Potential race on this
![Page 93: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/93.jpg)
Make it a monitor
Acquires a lock automatically.
use OO::Monitors;
my monitor Problems {
has @.errors;
method add-error($error--> Nil) {
@!errors.push($error);
}
}
![Page 94: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/94.jpg)
Huge improvement!
Takes 30% of the time it used to
![Page 95: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/95.jpg)
Huge improvement!
Takes 30% of the time it used to
Up to 6 modules loaded in parallel
![Page 96: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/96.jpg)
Task parallelism
Identify different, independent, tasks that we could do in parallel
Have different threads do them
![Page 97: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/97.jpg)
Task parallelism?
There's an opportunity!
Load layouts and parameters in parallel
with the modules
![Page 98: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/98.jpg)
Load asynchronously my @modules = @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
});
my $modules-load = start @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
});
Works lazily!
my $modules-load = start @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file {
my $yaml = self!load-yaml($file, $schema, $problems) ;
with $yaml {
Easii::Model::Module.new(parsed => $yaml,
source => $file.basename)
}
})
.eager;
![Page 99: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/99.jpg)
Load asynchronously my $parameter-load = start self!load-parameters(
$parameters-path, $problems);
my $layout-load = start self!load-layouts(
$layouts-dir, $cache-dir, $problems);
![Page 100: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/100.jpg)
Load asynchronously self.bless:
modules => await($modules-load),
parameters => await($parameter-load),
layouts => await($layout-load),
dpm => self!load-dpm($dpm-dir, $cache-dir),
load-errors => $problems.errors
![Page 101: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/101.jpg)
An improvement?
A little, though not that much more, due to resource contention
![Page 102: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/102.jpg)
Looking closer...
![Page 103: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/103.jpg)
Looking closer...
Huge module that takes ages to parse
![Page 104: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/104.jpg)
Looking closer...
Compilation of that module (quite quick)
![Page 105: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/105.jpg)
Looking closer...
Only stuff for one CPU core to do
![Page 106: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/106.jpg)
Do the big files first
my $modules-load = start @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file { ... })
.eager;
my $modules-load = start @files
.grep(/ \.(yaml|yml) $/)
.race(batch => 1, degree => 6)
.map(-> $file { ... })
.eager;
my $modules-load = start @files
.grep(/ \.(yaml|yml) $/)
.sort(-*.s)
.race(batch => 1, degree => 6)
.map(-> $file { ... })
.eager;
![Page 107: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/107.jpg)
It helps!
Model loading in around 20% of the original time - with few code changes!
![Page 108: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/108.jpg)
Concurrency too
Parallelism gave us an easy speedup
However, implementing eAsii was also greatly aided by Perl 6's concurrency support - of note, for live calculations
![Page 109: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/109.jpg)
Datasets
A set of inputs, either entered manually, uploaded, or sometimes
derived from other inputs
Current test customer dataset has 250,000 inputs (and each input has a change history, for audit purposes)
![Page 110: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/110.jpg)
Processing inputs Sync call Supply
![Page 111: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/111.jpg)
Processing inputs
Cro route handler HTTP POST
Sync call Supply
![Page 112: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/112.jpg)
Processing inputs
Cro route handler HTTP POST DB
1. Write to database
Sync call Supply
![Page 113: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/113.jpg)
Processing inputs
Cro route handler HTTP POST DB
1. Write to database Change! 2. Emit an event
Async
Propagation Queue
Sync call Supply
![Page 114: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/114.jpg)
Processing inputs
Cro route handler HTTP POST DB
1. Write to database Change! 2. Emit an event
Async
Propagation Queue
Live Dataset
Changes!
Sync call Supply
![Page 115: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/115.jpg)
Processing inputs
Cro route handler HTTP POST DB
1. Write to database Change! 2. Emit an event
Async
Propagation Queue
Live Dataset WebSocket messages
Changes!
Sync call Supply
Cro WebSocket Handler
![Page 116: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/116.jpg)
Processing timeline
HTTP request completes quickly, recalculation runs in the background
![Page 117: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/117.jpg)
Live dataset setup class Easii::LiveDataset {
has Int $.dataset is required;
has Supply $.input-source is required;
has Supplier $.changes .= new;
}
![Page 118: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/118.jpg)
Live dataset setup class Easii::LiveDataset {
has Int $.dataset is required;
has Supply $.input-source is required;
has Supplier $!changes .= new;
submethod TWEAK(:%initial-inputs) {
start react {
my $matching-input = $!input-source
.grep(*.dataset == $!dataset);
whenever $matching-input {
# Perform reclculation...
}
}
}
}
![Page 119: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/119.jpg)
if %formula-changes {
$!version++;
$!changes.emit: Easii::LiveDataset::Change.new:
:$!version, :$module-key, :%formula-changes;
}
Live dataset changes
If there recalculation determines there are changes to a module, emit
an event containing them
![Page 120: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/120.jpg)
WebSocket get -> LoggedIn $user, 'easii', 'setupWebsocket', Int :$dataset {
}
![Page 121: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/121.jpg)
WebSocket get -> LoggedIn $user, 'easii', 'setupWebsocket', Int :$dataset {
$app.with-current: $user.customer, -> $state {
}
}
![Page 122: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/122.jpg)
WebSocket get -> LoggedIn $user, 'easii', 'setupWebsocket', Int :$dataset {
$app.with-current: $user.customer, -> $state {
web-socket :json, -> $incoming {
supply {
}
}
}
}
![Page 123: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/123.jpg)
WebSocket get -> LoggedIn $user, 'easii', 'setupWebsocket', Int :$dataset {
$app.with-current: $user.customer, -> $state {
web-socket :json, -> $incoming {
supply {
my $live-dataset = $state.get-live-dataset($dataset);
whenever $live-dataset.changes -> $change {
}
}
}
}
}
![Page 124: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/124.jpg)
WebSocket get -> LoggedIn $user, 'easii', 'setupWebsocket', Int :$dataset {
$app.with-current: $user.customer, -> $state {
web-socket :json, -> $incoming {
supply {
my $live-dataset = $state.get-live-dataset($dataset);
whenever $live-dataset.changes -> $change {
my $change-set = $change.for-json;
emit $change-set;
}
}
}
}
}
![Page 125: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/125.jpg)
We also...
Data-parallelize formula calculation in modules with many instances
Use a Channel to send code to the
live dataset for evaluation, the concurrency control meaning we don't
evaluate it when recalculating
![Page 126: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/126.jpg)
Perl 6: good choice
Perl 6's concurrency features helped us to deliver on the reactive aspects of
the application
Meanwhile, the parallelism gave us a bunch of easy performance gains
![Page 127: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/127.jpg)
Lesson: tools are good
Tooling to visualize what's going on in a concurrent/parallel system is a huge win
![Page 128: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/128.jpg)
The
future of Perl 6 Concurrency
![Page 129: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/129.jpg)
We have a good story - but something is missing
Something, perhaps, that will turn out to be a differentiator
![Page 130: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/130.jpg)
Safety
![Page 131: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/131.jpg)
There's smart folks who feel the future is static proofs
There's others who argue to
bind as late as possible
![Page 132: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/132.jpg)
"We need to write tests to assert correctness anyway"
"It's easier to debug a
concrete situation than a theoretical type error"
![Page 133: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/133.jpg)
But what if the failure is a data race that happens
1 time in 10,000?
![Page 134: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/134.jpg)
What we kind of need is...
![Page 135: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/135.jpg)
What we kind of need is...
….ummm….
![Page 136: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/136.jpg)
What we kind of need is...
….ummm….
reliable failure!
![Page 137: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/137.jpg)
We need a Perl-ish solution.
That's a research problem.
But it's one I believe we should take on.
![Page 138: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/138.jpg)
Why?
![Page 139: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/139.jpg)
So we can make getting the easy things right easier
![Page 140: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/140.jpg)
So we can make getting the hard things right possibler
![Page 141: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/141.jpg)
So we can make the whipped up concurrent or parallel
program do the right thing
![Page 142: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/142.jpg)
Because we torment the language implementer for the
sake of the language user
![Page 143: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/143.jpg)
These are the things that define a Perlish language
![Page 144: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/144.jpg)
These are the things that define a Perlish library
![Page 145: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/145.jpg)
Being easy to get in to
Whipping up ideas together
Trying to do the right thing
Realizing others are trying to do the right thing
![Page 146: Perl 6 Concurrency - Jonathan Worthingtonjnthn.net/papers/2019-perlcon-concurrency.pdf · The current model 350+ modules A YAML file for each. Totals over 100,000 lines of YAML. Nearly](https://reader035.vdocuments.net/reader035/viewer/2022070721/5ee15f30ad6a402d666c472a/html5/thumbnails/146.jpg)
That, to me, seems like a way to be a Perl community