[Applause]
yeah good good good yeah
judging by the sound of the claps sounds
very good judging by the sound of the
claps that sounds very good
did you tell you that than me I know it
was the guy backstage do it again do it
again
I just wanted to applause hop you well
five of you were well what's the matter
was the last the last stop was good
right
you're feeling energized you're feeling
inspired amazing
my name is Tagus that's pronounced like
contagious but don't worry I'm not
contagious I'm not going to give you
anything besides hopefully a good talk
and I have to say I love this conference
I was here for CSS conf and J's confi
esterday learned the ton I learned a ton
debugging performance it's all here can
we hear it for the organizers of J's
computer pest absolutely incredible
and also and also the city the city is
really beautiful if you live here who
I'm jealous
I'm jealous so as I said my name stages
contagious is kind of like a way to
remember it because it's a it's a bit of
a different Indian name but really at
this point you can just call me that
joke guy from yesterday yesterday at the
party it's like and so yes yes I'm
hilarious
I work in Germany at a company called
con te amo and we you know the marketing
way we like promote ourselves as we
accelerate data access just means we we
help people understand their data and do
all kinds of cool data science II things
but really for me what I love the most
about my work is these people oh my good
this is my team and they are some of the
brightest funniest smartest all my good
I love them very much and I'm very happy
to work with them and you know I get to
come here and tell you about how
wonderful they are but that
unfortunately is not what this talk is
about sorry sad instead the talks about
serverless service how do you even heard
if serverless
Wow everybody so nothing new will be
learned here I'm just kidding we're
gonna talk about certainly gonna look at
some adoption some usage we look at what
it means and why I think it is
absolutely revolutionary and I mean that
this talk is called legendary lambdas
for a reason
but before we get into that let's kind
of look at some facts and figures these
are from surveys this the citations on
the bottom left I'd encourage you to go
look it out look it up and according to
the new stack some time ago about 78% of
participants in the survey wanted to
adopt serverless into their ecosystem
into their internal service architecture
70% which means by now they may have
already another interesting statistic is
75% of the problem space has been
penetrated by serverless in the last 18
months or so and that is really really
really exciting it very quickly overtook
the prior art if you will containers as
a service and it's it's growing very
fast and these are just numbers but
there are real world use cases where
serverless is doing amazing things and
one such use cases by one of the biggest
brands in the whole world
coca-cola reduced their operating costs
by about sixty five percent on
serverless
and how they did that is they had these
these vending machines that were like 10
to 12 years old and they would have to
send some some telemetry they had a
sense of information about like are
there enough drinks and stuff to coke
now these up until 2016 or run on
Amazon's ec2 and cost about twelve
thousand eight hundred sixty-four
dollars a year okay
after moving to server lists coca-cola
pays 4490 roughly at the time of the
case study for you that's that's a 65
percent reduction and it they could
serve 30 million requests at one time at
the time of publishing of this study
very very very interesting second if
you've ever played or her
of final fantasy square enix is a
company behind some of the world's
greatest MMORPGs massively multiplayer
online role-playing games and they can
have millions of players on at the same
time and what players like to do at
massive scale is take screenshots so
they have an image processing function
that would process these screenshots now
processing these screenshots especially
under heavy load would use that used to
take several hours after moving to
server list these take a little over 10
seconds and more than that they can
comfortably do this with traffic spikes
of over 2 times so if there's a gaming
tournament and there's like millions of
people online this this function to
process the images eats it for breakfast
lastly if you've ever heard of a used a
Wi-Fi router in your entire life there's
a good chance on with a Thompson one and
Thompson routers one of the world's
biggest brands for routers is able to
process 4,000 events per second on
serverless what's really impressive
about this is even you know under very
heavy conditions there's no or minimal
probably no data loss but for me and
this is what I want to focus on today is
they scheduled five months to get this
into production according to the report
and you know if you're at the scale of
Thompson five months is a really short
time I've heard people say that in
larger companies things just take longer
there's more meetings and more planning
whatsoever and so five months is
ambitious Thompson actually ended up
moving this thing to server list two
months ahead of schedule two months
ahead of serverless is is you're able to
get up and running really really fast
and so I tell you all these things to
tell you it's here and it's big and and
people are talking about it but don't
take my word for it I think one of my
friends Nadder said it best he just says
this serverless is the future and so if
it is the future and we're all kind of
going there anyway let's let's spend 30
minutes talking about it in a little bit
of detail so what is it what is
serverless serverless in quotes
it's a loaded term right it could mean
functions which we talk about but it
could just mean like static websites jam
stack things I want to make a point here
that may be controversial but you know
what it's just it's you love me you know
it's fine or whatever I think just the
word serverless is kind of a lie like in
english it's called a misnomer miss as a
not not quite no more as a name now in
software engineering naming things is
hard and I think we may have missed
serverless because I was talking to my
wife about it she's you know she studies
law and isn't very involved with tech
and it sounds like well there's no
servers at all which is a huge lie and
so I'd like I couldn't I'd invite you to
consider this it's a wireless charger
also kind of a lie
and so server this is kind of like that
it means it doesn't mean there are no
servers it means that they're not your
problem you you do what you love you get
to focus on building the apps the
experiences you absolutely love and you
pay Amazon or diet or neckla fire one of
these some amount of money or use their
feet here and your stuffs magically in
the cloud server lists you can quote me
on this server list brings the cloud
down but but why and there's a number of
reasons why server list is so popular
and we'll go through them I think you
know them they're not like rocket
science or mind blowing but as I just
said you can focus on the things you
love you you delegate the responsibility
of servers to someone else so you write
your JavaScript you write your Python if
you're into that yeah and and you put it
in the cloud and the concerns of
provisioning the server setting up the
runtime putting it getting it up all of
that you don't deal with if for some
reason your server dies and you need to
send traffic to a different machine for
whatever reason handled for you that's
already like I can breathe a little bit
easier there were three scale like if
for example you your Square Enix and
there's a huge gaming tournament you
don't have to think about scaling
vertically by adding more
memory or you know Hardware throwing
hardware from you or scaling
horizontally by adding more servers in
your cluster you just doesn't matter you
create the software you know and love
and these are kind of the three tenets
of service but I invite you to consider
one more and that is this one you see
most tech conferences I think it may be
fair to say all tech conferences are on
this spectrum of technology and
community and jeaious Khan family
conferences that I've been to usually
lean a little bit more towards community
and if we're in community we need to
talk accessibility in case that's not
big enough accessibility
I think serverless makes the web so the
cloud so accessible that everybody can
play and this is huge you see I come
from I was born in a country that is
poor it's a developing country India in
case you were wondering I love the food
it's amazing but the country is is is
it's growing right and the prior art of
serverless means you have to have some
type of server means you have to either
get shared hosting if if money's tight
or you get a virtual private server or a
bare metal server now with these there's
money involved and sometimes for some
communities this money is too much it's
not as accessible with lambda serverless
helps these communities see India I
think is home to some of the most
brilliant minds on the face of the
planet and if you need evidence of that
don't you don't have to look very far
CEO of Google CEO of Microsoft Sunil PI
at Facebook
there's react India is happening right
now and there's a whole bunch of them
ready to learn and grow the problem is
the cloud is not accessible because you
pay so much for a server it's
unbelievable lambda has this pricing
model that allows people from these
communities to put stuff in the cloud
you have an idea put it in there and how
that's possible is because lambdas are
functions they're just
there's an excellent talk yesterday on
functional programming their functions
and as we saw functions what do they do
you write them they start they do a job
they run to completion they finish they
return a value that's it in a perfect
world your functions are stateless or as
in they close over their own state they
have no side effects and they're pure
meaning for any given input they give
you the same output without side effects
so they're predictable if they're
predictable they're testable you can
unit test them and make sure they behave
the way you want them to if they're
testable they're scalable meaning you
can run 50 different versions of the
same function they do the same thing and
if they're infinitely scalable you can
go really really really far and so if
the functions are invoked it presents an
entirely different pricing model right
previously you would pay monthly for a
server people use it people don't I
don't care I'm losing 350 euros a month
just paying for a server I'm wildly
unpopular I'm paying for a server I
can't pay my rent but maybe someone will
use it and it'll catch on I'll just keep
hope and pay for this I lose money a
whole year with lambda you pay for each
time your function is invoked and I
think that's a game changer I really do
because if no one uses your thing you
pay nothing and some with some providers
if one person uses it you pay I think
it's like 1/5 millionth of a dollar you
pay for invocations and you pay for
compute time we'll talk more about that
it's it's almost free and if it's almost
free no matter how much money you or
your country has you can put stuff in if
I think that's incredible and so I
thought I could show you some examples
if the internet cooperates if it doesn't
you know we'll see what happens and so
here's an example here's a server this
function in JavaScript because it's J's
convent I'm I'm sending so I have a
request response a set of arguments and
I'm sending through the response a
heading off the current date and time
let's put this in the cloud I want you
to pay attention because this is super
sophisticated to put stuff in the cloud
on server list I'm using a provider as I
there's others but I find this easy and
I just enter one command literally one
command
and it says okay I'm deploying this
function damn it's a van it's done and I
open it and so what happens is that
function is called when I open the
function and it returns a value to the
browser this calls the function and
calls the function if I reload the page
it calls the function every time you see
and so I'm kind of running up a huge
bill here by reloading this page but
it's not very much I'm sure I can afford
it I'm actually on their free tier so
I'm sure I can afford it but another
case for server lists if you want to get
creative is this thing which will
automatically give you a randomly
generated thinking emoji on every
invocation this one apparently is huge
but every time you reload the page you
just get a new one because the function
is called on many I could do this all
day okay moving on um so what we saw was
cool I don't know why my doc is showing
like Apple if you're watching please
quality the pricing for that though is
that much you pay for each time it's
invoked you pay that much and you pay
for the amount of gigabyte seconds you
use and and this is on Amazon Web
service that's it that's crazy but I
spend a lot of time in a lot of tech
conferences talking to a lot of people
about things about server list about CSS
about life in love and Romeo and Juliet
whatever and as with everything there
are concerns can it be that good is it
too good to be true the two big concerns
I hear often are acceptance of service
so a traditional problem with servers is
denial of service you get hit with too
many requests and then your server is
like I can't I can't deal with it I quit
and and it denies service but would
server list since it scales up the other
side of the problem is true if you pay
for each time your URL is accessed
someone could just like wild crew and
then fetch you every time you know what
I mean and then they just send a request
after request and then you get a bill of
two million dollars how do you deal with
that number two if you say pages if you
say our lamb doesn't need to be
stateless and pure but I need to say I
need a database how do I do this we'll
talk about those let's start with
acceptance of service
go down a hypothetical journey okay
let's say your worst enemy sets up a
network of a hundred thousand bucks okay
and they just like keep hitting your
server for sixty minutes one request per
second okay that is a total of three
hundred and sixty million in an hour
lambda invocations big numbers big and
scary it's even physically big on the
screen so that's a lot let's add to the
equation let's say your function takes
two hundred milliseconds of compute time
and uses a gigabyte of memory okay this
is these are just factors for a little
experiment know what Amazon Web Services
with lambda this is this is what you
would pay it's a two digit number for
invocation seventy two dollars and since
it's one gigabyte of memory over two
hundred seconds
it's 1024 dollars all of that to say in
an attack at that scale we pay less than
fifteen hundred dollars you would pay
that anyway on virtual on a like
previously server based solution if not
more so this is an extreme case and I
think if you're an early stage startup
or a late stage startup or whatever
that's within reach and if you're
attacked at that scale you're probably
famous enough to afford it
maybe and there's at their services
there's something called Amazon Cloud
watch that will kind of watch your thing
and warn you if you're getting too much
crap so there are measures you can
implement to prevent this I think that's
pretty okay second problem the need for
state I need state we all need state
that kind of can't have an app for that
state how do we do this every time I
talk about server list at someone I
don't know why but the the thinking goes
to like okay everything needs to be a
function everything everything's pure
everything like we love this in
JavaScript like someone says something I
would got to be really move everything
to Gatsby
someone says something about react hooks
were like hooks everywhere classes are
evil you know like everything doesn't
need to be a function okay use it in
moderation use it with consideration
but perhaps you have a MongoDB Atlas or
a sewer database on Postgres the graphic
API somewhere great maybe there's a
place for your function at the API layer
maybe there isn't but not everything
needs to be from yes you can have your
state you can even eat it if you want
you didn't understand that that's okay
uh-huh not everything needs to be a
function and so that brings me to the
the study part of this talk was to
discuss briefly a study that I did
literally for science I have to preface
this multiple times by saying don't do
this it's what it's one of those things
that you do because you're curious don't
do it in production there's better ways
to do this Jam stack is a good way other
ways to but anyway I wanted to try out
serverless button but like with UI so it
took some frameworks and did some stuff
with lambdas and we'll see some results
but how do you do like a UI as a far as
you know so you have UI and you want to
put it in the lambda but this is your UI
of function or is it like divs and stuff
yeah I've heard actually no wait a
second new UI is a function of your
state like this is like the e equals MC
square of UI development isn't it like u
UI is a function of your okay
I didn't see that hmm wait a second that
means you I can just be a lambda whoa
okay cool let's try it let's write like
react dong render to string on a on a
lemon and that's exactly what we did
we server rendered by UI as a server
list lambda so I guess that's that's
serverless server-side rendering is that
SSSR us s no don't make that joke hmm
seriously this study anyway the study we
we looked at some leading UI frameworks
and we looked at pre-act react lit idml
that's the polymer icon
don't be offended view and vie html5
frameworks and what we wanted to do was
we wanted to build a reddit phone and
this is just a clone of reddit it uses a
flat file as the backend so we don't
really talk to the reddit API and that's
to reduce latency and and standard
deviation on your benchmark and the
reason we chose server-side rendering
there was an excellent talk yesterday
actually by Surma and Jake about they
talked a little bit about server-side
rendering it's just better if you're not
server rendering I think it can be
better in many cases partly because
everything's delivered to your users in
one network hop like they visit your
page BAM they get exactly what they want
there is no like oh my JavaScript bundle
is loading now like some of you have
seen these experiences on the web where
you get a shell of a nap and then
spinners immediately server-side
rendering this gives them what they need
it's also better for you in terms of
search engine marketing I heard at I
think at Google i/o actually that it's
significantly harder for search engines
to index these things as well users
don't like spinners but one benefit you
get actually with serverless and
server-side rendering again probably not
a good idea is you get analytics out of
the box so imagine you have a blog and
each articles deployed as a lambda so if
from article a your server list bill is
$2 an article be your server list bill
is $200 you kind of know what kind of
content to be producing from there I
thought that was interesting but but
regardless so this is what we wanted to
build and we wanted to track three key
metrics metric number one is the cost of
booting the function cold we'll talk a
little bit more about this because it's
a little bit exclusive to serverless
number two is the lamina size or the
package size this is a concept you're
aware of and number three is the
throughput I'm how many requests per
second can this handle but let's talk a
little bit about cold boot with lambdas
how they execute is there these
ephemeral containers like somebody
accesses your URL and then a container
spins up it npm installs JavaScript
ecosystem NPM installs your dependencies
gets ready then execute the
function with importing your npm modules
returns value there's a bit of ceremony
there and that ceremony can take time
that's called a cold boot this is best
visualized with this graphic here so a
request comes in and it downloads your
code and boots and then your code runs
once your code runs every the function
is considered hot or warm it's ready to
serve more requests and it stays hot for
a while but after a while they wind down
and go cold again there's a typo in the
text I hope you don't see it and after a
while late so that's kind of how cool
boot work so we wanted to test which
framework required the most resources to
start let's talk briefly about the code
involved the code for all of the reddit
examples would react react and the HTML
I believe was the same code exactly the
same code how do you do that well using
this thing how many of you have heard of
hyper script I can count on my fingers
like five hyper script is kind of just a
function signature and it's the function
signature of something year may be more
familiar with react create element it
takes the tag of the element the props
and the children and pre-act and the
HTML they implement this interface as
well and so what we ended up doing was
you just kind of assign h to one of
these three and the rest of the code
stays exactly the same
it was really cool for view and lit HTML
we had to take a different strategy
because with view you work with view
instances but we ended up copying the
HTML string rendered and just
interpolating with some view there it's
important to note here let HTML doesn't
have a note implementation I don't
believe so we used a fork and so the
moment we've all been waiting for
the talk is almost over no we're gonna
look at the results of this briefly but
again as I said in the beginning there's
better what do not have like a blog
that's all lambdas I'm not sure that's
the best way to do it the but if we're
talking about the fastest the best
framework on service the answer is very
much no don't
do it don't do it really just use the
platform it's amazing seriously you can
even use the jam stack or like vanilla
seriously like just don't don't even
anyway
have I made my point but the results
regardless in case you're curious about
numbers are V hTML is really fast and
you just write JSX it looks just like
react but what ends up happening is it
doesn't have a virtual Dom and that's
why it's fast so what it does it takes
your like JSX and turns it into a string
of HTML that you can then return from
your lambda and because of this super
fast and super light coming in at 28
kilobytes pre-act naturally was the
second in fact if you chose to do this
for Reno for science you could serve a
render the HTML hydrate with pre-act and
you have a really fast and pleasant
experience unfortunately coming up at
the rear was view which i don't think is
necessarily a bad thing the purpose of
this study kind of like the purpose of
this talk is to get us a little bit more
serious about service right is to get us
to think about serverless a bit more
it's not to bash view what is to think
about service and so I was actually
quite I feel like my work on this was
was how do you say it was vindicated was
was successful because the author of
view noticed the study and responded
with maybe will revisit this only
optimized for service in the future of
view and this is the goal I think
because as Nadder said it's so
eloquently service is the future because
it's the future I think we all should
start thinking and optimizing for
service in the new future with that let
us land this plane there's been a
beautiful journey I enjoy talking I
could talk all day I'm not sure if you
could listen all day so we'll we'll wrap
it up we talked about how serverless is
the future we looked at how coca-cola
square-enix others are really
benefitting for serverless we looked at
how community matters see I
like some of you may not get the weight
the potential of service to be truly
legendary because for most of you you do
your job and get push and your ops team
puts it in the cloud your ops team
though may be losing sleep your company
may be spending more than necessary
maybe it doesn't directly impact you but
I truly believe serverless has a
positive impact on your company and your
team but by and large the positive
impact as I mentioned is in poor
communities financially it brings the
cloud down it makes it respond it makes
it available to the rest of us and I
truly believe through these legendary
lambdas we're going to see the world
change for the better we're gonna see
India develop and other nations like it
develop faster that lead to human
satisfaction happiness joy and
flourishing and with that I want to say
thank you very much for your time and
for listening
you