SERVERLESS AXIOMS
Event-Driven Architecture
Stateless
♾ Infinite Scaling
Pay when the code is running
Slide 10
Slide 10 text
SERVERLESS AXIOMS
Event-Driven Architecture
Stateless
♾ Infinite Scaling
Pay when the code is running
Slide 11
Slide 11 text
SERVERLESS
UNDER
THE
MICROSCOPE
Slide 12
Slide 12 text
LOG
$ serverless invoke -f index -l
Slide 13
Slide 13 text
LOG
$ serverless invoke -f index -l
START RequestId: Version: $LATEST
END RequestId:
REPORT RequestId:
Duration: 1.48 ms Billed Duration: 100 ms
Memory Size: 1024 MB Max Memory Used: 31 MB
Slide 14
Slide 14 text
LOG
$ serverless invoke -f index -l
START RequestId: Version: $LATEST
END RequestId:
REPORT RequestId:
Duration: 1.48 ms Billed Duration: 100 ms
Memory Size: 1024 MB Max Memory Used: 31 MB
Slide 15
Slide 15 text
SERVERLESS AXIOMS
Event-Driven Architecture
Stateless
♾ Infinite Scaling
Pay when the code is running
Slide 16
Slide 16 text
LOG
$ serverless invoke -f index -l
START RequestId: Version: $LATEST
END RequestId:
REPORT RequestId:
Duration: 1.48 ms Billed Duration: 100 ms
Memory Size: 1024 MB Max Memory Used: 31 MB
Slide 17
Slide 17 text
LOG
$ serverless invoke -f index -l
START RequestId: Version: $LATEST
END RequestId:
REPORT RequestId:
Duration: 1.48 ms Billed Duration: 100 ms
Memory Size: 1024 MB Max Memory Used: 31 MB
Slide 18
Slide 18 text
WHAT ABOUT
CPU?
Slide 19
Slide 19 text
AWS Lambda allocates CPU power
proportional to the memory…
(с) Amazon Docs
Slide 20
Slide 20 text
AWS Lambda allocates CPU power
proportional to the memory…
For example, if you allocate 256 MB
memory, your Lambda function will receive
twice the CPU share than if you allocated
only 128 MB.
(с) Amazon Docs
PURE RUBY LAMBDA
# handler.rb
require 'json'
def heartbeat(event:, context:)
{ statusCode: 200, body: JSON.generate(success: true) }
end
Slide 43
Slide 43 text
BATTLE (128 MB)
AVG ~39ms
AVG ~80ms
Slide 44
Slide 44 text
COST
""<=>
DEPENDENCIES
Slide 45
Slide 45 text
MINIMIZE THE COMPLEXITY OF
YOUR DEPENDENCIES
Slide 46
Slide 46 text
MINIMIZE THE COMPLEXITY OF
YOUR DEPENDENCIES
Slide 47
Slide 47 text
MINIMIZE THE COMPLEXITY OF
YOUR DEPENDENCIES
Slide 48
Slide 48 text
NO RAILS
GOOD!
Slide 49
Slide 49 text
CHEAPLY
NICE
NO RAILS
GOOD!
Slide 50
Slide 50 text
CHEAPLY
NICE
EVENTS
AWESOME
NO RAILS
GOOD!
Slide 51
Slide 51 text
CHEAPLY
NICE
EVENTS
AWESOME
NO RAILS
GOOD!
SCALING
AMAZING
Slide 52
Slide 52 text
TALK ABOUT
THE
PROBLEMS
TELL THE TRUTH
Sponsored by @stacey_om
Slide 53
Slide 53 text
IS
INFINITE
SCALING
ALWAYS
GOOD?
Slide 54
Slide 54 text
# before
$ puma -t 8:32 -w 1
# after
$ puma -t 8:32 -w 2
HOW RUBY DEV SCALES APP
Slide 55
Slide 55 text
500
Slide 56
Slide 56 text
SERVERLESS AXIOMS
Event-Driven Architecture
Stateless
♾ Infinite Scaling
Pay when the code is running
Slide 57
Slide 57 text
When you write your Lambda function code, do not
assume that AWS Lambda automatically reuses the
execution context for subsequent function invocations….
(c) AWS Docs
AWS LAMBDA
EXECUTION CONTEXT
RESULTS
gg
real
user
sys
1m17.670s
1m49.040s
0m7.820s
real
user
sys
0m43.354s
0m3.830s
0m5.490s
real
user
sys
0m29.376s
0m0.950s
0m1.400s
Slide 120
Slide 120 text
RESULTS
gg
real
user
sys
1m17.670s
1m49.040s
0m7.820s
real
user
sys
0m43.354s
0m3.830s
0m5.490s
real
user
sys
0m29.376s
0m0.950s
0m1.400s
Slide 121
Slide 121 text
RESULTS
gg
Total: 1m56s Total: 0m38s
~X3 faster
Slide 122
Slide 122 text
COMPARISON OF COLD-CACHE BUILD TIMES
https://cs.stanford.edu/~matei/papers/2019/usenix_atc_gg.pdf
Slide 123
Slide 123 text
DARK
MAGIC!
Slide 124
Slide 124 text
https://github.com/StanfordSNR/gg
Slide 125
Slide 125 text
GOTO 0;
SERVERLESS
IS RUBY
FUTURE
Slide 126
Slide 126 text
“As a computing substrate, we suspect cloud
functions are in a similar position to Graphics
Processing Units in the 2000s.
At the time, GPUs were designed solely for 3D
graphics, but the community gradually
recognized that they had become programmable
enough to execute some parallel algorithms
unrelated to graphics.” (c)
Slide 127
Slide 127 text
GOTO 0;
SERVERLESS
IS RUBY
FUTURE
Slide 128
Slide 128 text
SORBET?
Slide 129
Slide 129 text
IT saṃsāra
Java
Erlang
C
C++
"=> Scala
"=> Elixir
"=> Go
"=> Rust
Slide 130
Slide 130 text
RUBY
SELF-IDENTIFICATION
Slide 131
Slide 131 text
RUBY IS
Fast
Coding
Slide 132
Slide 132 text
RUBY IS
Startups
(Rails)
Fast
Coding
Slide 133
Slide 133 text
RUBY IS
Startups
(Rails)
GIL
Sensitive
Fast
Coding
Slide 134
Slide 134 text
RUBY IS
Startups
(Rails)
オブジェクト指向スクリプト⾔言語 Ruby
GIL
Sensitive
Fast
Coding
Slide 135
Slide 135 text
RUBY IS
Startups
(Rails)
GIL
Sensitive
The Object-oriented
Scripting Language Ruby
Fast
Coding
Slide 136
Slide 136 text
RUBY IS
Startups
(Rails)
GIL
Sensitive
The Object-oriented
Scripting Language Ruby
Fast
Coding
Slide 137
Slide 137 text
RUBY IS
Startups
(Rails)
GIL
Sensitive
The Object-oriented
Scripting Language Ruby
Fast
Coding
Slide 138
Slide 138 text
RUBY IS
Startups
(Rails)
GIL
Sensitive
The Object-oriented
Scripting Language Ruby
Fast
Coding
Slide 139
Slide 139 text
RUBY IS
Startups
(Rails)
GIL
Sensitive
The Object-oriented
Scripting Language Ruby
Fast
Coding
Slide 140
Slide 140 text
60 SECNDS
OF SUMMARY
Slide 141
Slide 141 text
@ssnickolay
Nikolay Sverchkov
@ssnickolay
THANK YOU!
@evilmartians
http://evl.ms/blog
http://evl.ms/telegram