Alex Xu Profile picture
Mar 31, 2022 โ€ข 8 tweets โ€ข 3 min read โ€ข Read on X
๐’๐ž๐ซ๐ฏ๐ž๐ซ๐ฅ๐ž๐ฌ๐ฌ is one of the hottest topics in cloud services. How does AWS ๐‹๐š๐ฆ๐›๐๐š work behind the scenes?

Lambda is a ๐ฌ๐ž๐ซ๐ฏ๐ž๐ซ๐ฅ๐ž๐ฌ๐ฌ computing service provided by Amazon Web Services (AWS), which runs functions in response to events. Image
๐…๐ข๐ซ๐ž๐œ๐ซ๐š๐œ๐ค๐ž๐ซ ๐Œ๐ข๐œ๐ซ๐จ๐•๐Œ
Firecracker is the engine powering all of the Lambda functions [1]. It is a virtualization technology developed at Amazon and written in Rust.

The diagram below illustrates the isolation model for AWS Lambda Workers.
Lambda functions run within a sandbox, which provides a minimal Linux userland, some common libraries and utilities. It creates the Execution environment (worker) on EC2 instances.

How are lambdas initiated and invoked? There are two ways. Image
๐’๐ฒ๐ง๐œ๐ก๐ซ๐จ๐ง๐จ๐ฎ๐ฌ ๐ž๐ฑ๐ž๐œ๐ฎ๐ญ๐ข๐จ๐ง
Step1: "The Worker Manager communicates with a Placement Service which is responsible to place a workload on a location for the given host (itโ€™s provisioning the sandbox) and returns that to the Worker Manager" [2]. Image
Step 2: "The Worker Manager can then call ๐˜๐˜ฏ๐˜ช๐˜ต to initialize the function for execution by downloading the Lambda package from S3 and setting up the Lambda runtime" [2]

Step 3: The Frontend Worker is now able to call ๐˜๐˜ฏ๐˜ท๐˜ฐ๐˜ฌ๐˜ฆ [2]. Image
๐€๐ฌ๐ฒ๐ง๐œ๐ก๐ซ๐จ๐ง๐จ๐ฎ๐ฌ ๐ž๐ฑ๐ž๐œ๐ฎ๐ญ๐ข๐จ๐ง
Step 1: The Application Load Balancer forwards the invocation to an available Frontend which places the event onto an internal queue(SQS). Image
Step 2: There is "a set of pollers assigned to this internal queue which are responsible for polling it and moving the event onto a Frontend synchronously. After itโ€™s been placed onto the Frontend it follows the synchronous invocation call pattern which we covered earlier" [2]. Image
Question: Can you think of any use cases for AWS Lambda?

Sources:
[1] AWS Lambda whitepaper: docs.aws.amazon.com/whitepapers/laโ€ฆ
[2] Behind the scenes, Lambda: bschaatsbergen.com/behind-the-sceโ€ฆ
Image source: [1] [2]

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Alex Xu

Alex Xu Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @alexxubyte

Jun 10
11 steps to go from Junior to Senior Developer Image
1 - Collaboration Tools
Software development is a social activity. Learn to use collaboration tools like Jira, Confluence, Slack, MS Teams, Zoom, etc.

2 - Programming Languages
Pick and master one or two programming languages. Choose from options like Java, Python, JavaScript, C#, Go, etc.

3 - API Development
Learn the ins and outs of API Development approaches such as REST, GraphQL, and gRPC.
4 - Web Servers and Hosting
Know about web servers as well as cloud platforms like AWS, Azure, GCP, and Kubernetes

5 - Authentication and Testing
Learn how to secure your applications with authentication techniques such as JWTs, OAuth2, etc. Also, master testing techniques like TDD, E2E Testing, and Performance Testing

6 - Databases
Learn to work with relational (Postgres, MySQL, and SQLite) and non-relational databases (MongoDB, Cassandra, and Redis).
Read 6 tweets
Jul 1, 2023
Twitter has enforced very strict rate limiting. Some people cannot even see their own tweets.

Rate limiting is a very important yet often overlooked topic. Let's use this opportunity to take a look at what it is and the most popular algorithms.

A thread.

#RateLimitExceeded
What is rate limiting? Rate limiting controls the rate at which users or services can access a resource. Here are some examples:

- A user can send a message no more than 2 per second
- One can create a maximum of 10 accounts per day from the same IP address
Fixed Window Counter

The algorithm divides the timeline into fixed-size time windows and assigns a counter for each window. Each request increments the counter by some value. Once the counter reaches the threshold, subsequent requests are blocked until the new time window begins
Read 9 tweets
May 29, 2023
/1 Our system design newsletter just reached a new milestone: 400,000 subscribers. Here are the most popular ones: ๐Ÿ‘‡

Subscribe here: blog.bytebytego.com Image
/2 Understanding Database Types: blog.bytebytego.com/p/understandinโ€ฆ Image
/3 Password, Session, Cookie, Token, JWT, SSO, OAuth - Authentication Explained: blog.bytebytego.com/p/password-sesโ€ฆ Image
Read 7 tweets
May 19, 2023
/1 Free Algorithm, Git, Python, SQL, Java Books (And Many More)

These books were compiled from Stack Overflow Documentation and can be helpful for quick reference. Image
/2 The link to the books: books.goalkicker.com
/3 Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/42Ex9oZ Image
Read 4 tweets
May 18, 2023
/1 What is the difference between โ€œpullโ€ and โ€œpushโ€ payments?

The diagram below shows how the pull and push payments work. Image
/2 ๐Ÿ”น When we swipe a credit/debit card at a merchant, it is a pull payment, where the money is sent from the cardholder to the merchant. The merchant pulls money from the cardholderโ€™s account, and the cardholder approves the transaction.
/3 ๐Ÿ”น With Visa Direct or Mastercard Send, the push payments enable merchant, corporate, and government disbursements.

Step 1: The merchant initiates the push payment through a digital channel. It can be a mobile phone or a bank branch etc. Image
Read 9 tweets
May 15, 2023
/1 Netflix Tech Stack - Databases Image
/2 The Netflix Engineering team selects a variety of databases to empower streaming at scale.

Relational databases: Netflix chooses MySql for billing transactions, subscriptions, taxes, etc. They use CockroachDB to support a multi-region active-active architecture. Image
/3 Columnar databases: Netflix primarily uses them for analytics purposes. They utilize Redshift and Druid for structured data storage, Spark and data pipeline processing, and Tableau for data visualization. Image
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(