These are the slides of the second talk of the second Tech Talk@TransferWise Singapore, which happened on the 1st of March 2018.
We take a look at what Serverless Computing is, find out what we can do with Amazon Web Services Lambda and when it can be useful. We also explore how it has evolved for the past 3 years and learn about its remaining limitations.
3. Definition
● Managing functions,
not apps or servers
● Tasks triggered by
events
● Wikipedia:
○ “Serverless
computing is a cloud
computing execution
model in which the
cloud provider
dynamically manages
the allocation of the
machine resources”.
4. Comparison of the main cloud providers
● AWS Lambda: Built-in versioning with traffic split,
staging environments, good online IDE
● Azure Functions: A few advantages over AWS Lambda
like support of F# and PowerShell but more limited for
C# (single file) and Java (preview)
● Google Cloud Functions: Only Node.js and still in beta
8. Let’s build
Craigslist!
Designing with and without
serverless computing
● Marketplace to buy and sell
second-hand items
● 100+ million unique visitors
per month
● Simple website with login
● No need to create an
account or to share an
email address to contact
someone
○ Two-way anonymous email
system
9. Anonymous email system without serverless
● What do we need?
● Setting up email system (on-premise or hosted)
● Database to know which emails have been processed
● Distributed fault-tolerant job that regularly reads the inbox, check
the database, and send emails
● Setting up the database and backend servers (deployment,
monitoring, load balancing, security).
● Estimated implementation time?
● What is a two-way anonymous email system?
● A@gmail.com sends an email to
{encrypt(“B@gmail.com”)}@craigslist.com
● The system should send the same email from
{encrypt(“A@gmail.com”)}@craiglist.com to B@gmail.com
10. Anonymous email system with serverless
● What do we need?
● Configuring AWS Simple Email Server (SES) to receive emails
● One AWS Lambda function!
● Event: Email received by AWS SES
● Action:
○ Encrypt and decrypt email addresses
○ Create new email with the same body and attachments
○ Send the email
● Estimated implementation time?
● Less than one day!
11. Advantages of serverless computing
● Integrated cloud services
● Automatic scaling
● Built-in fault tolerance
● Built-in security
● Built-in monitoring/alerts
● Built-in logging per execution (easier to read logs)
● Fast and easy deployment
● Isolated sandbox environment (less issues with CPU,
memory and thread resources)
● Don’t pay for idle time
13. AWS Lambda in its early days
AWS Lambda launched in November 2014 and had a fair
amount of limitations:
● High latency (~1 second)
● Supports only Node.js
● Everything in a single file
● No staging environment, no versioning
● API endpoints always returning 202
● Hard to write AWS Lambda functions outside the
online editor (no local emulator).
14. AWS Lambda today
● Lower latency (~100 ms)
● Support for multiple files
● More languages: Node.js, Python, Java 8, C# and Go
● Java: upload your jar file. Convenient for unit testing,
Git, continuous delivery.
● Better online IDE (Cloud9)
● Versioning with traffic split (e.g 99% on v1.2, 1% on v1.3)
● API endpoints with custom HTTP responses and
staging environments thanks to AWS API Gateway
15. Remaining limitations
● Latency is not negligible and not predictable (~100ms)
● Short actions (less than 5 minutes)
● Less than 250MB of uncompressed code
● Not easy to manage hundreds of AWS Lambda
functions
● Not good for local caches
17. When is serverless computing useful?
● Good for short background independent tasks,
triggered with timers or HTTP calls
● Not always good for Web API endpoints (extra latency,
dependencies between CRUD operations)