Everything you need to know about Serverless
Serverless is a cost-efficient way to host your APIs and it forms the crux of systems like Chatbots and Online Judge.
Serverless does not mean that your code will not run on the server; it means that you do not manage, maintain, access, or scale the server your code is running on.
The traditional way to host APIs is by spinning up a server with some RAM, and CPU. Say the resources make your server handle 1000 RPS, but you are getting 1000 RPS only 1% of the time which means for the other 99% you are overprovisioned.
So, what if there was an Infrastructure that
These requirements gave rise to Serverless Computing.
Real-world applications
Chatbot
Say, we build a Slack chatbot that responds with the Holiday list when someone messages holidays . The traffic for this utility is going to be insignificant, and keeping a server running the whole time is a waste. This is best modeled on Serverless which is invoked on receiving a message.
Online Judge
Every submission can be evaluated on a serverless function and results can be updated in a database. Serverless gives you isolation out of the box and keeps the cost to a bare minimum. It would also seamlessly handle the surge in submissions.
Vending Machine
Upon purchase, the Vending machine would need to update the main database, and the APIs for that could be hosted on Serverless. Given the traffic is low and bursty, Serverless would help us keep the cost down.
Scheduled DB Backups
Schedule daily DB backups on the Serverless function instead of running a separate crontab server just to trigger the backup.
Batch and Stream Processing
Use serverless and invoke the function every time a message is pushed on the broker making the system reactive instead of poll-based.
Advantages
Disadvantages
领英推荐
When NOT to use Serverless
When to use Serverless
Here's the video of my explaining this in-depth ?? do check it out
Serverless Computing is one of the hottest topics of discussion today, but the term "serverless" is slightly misleading and it does not mean that your code will not need a server to run. We have to be extremely cautious while deciding on adopting serverless for our use case, but it is not something that fits all the use cases.
In this video, we talk about what serverless computing is, see why it was built in the first place, learn about 5 real-world use-cases that become super-efficient with serverless architecture, understand the advantages and more importantly, the disadvantages of adopting it, and conclude with acknowledging when to use and when not to use this computation pattern.
Outline:
You can also
Thank you so much for reading ?? If you found this helpful, do spread the word about it on social media; it would mean the world to me.
Yours truly,
Arpit
Until next time, stay awesome :)
I teach a course on System Design where you'll learn how to intuitively design scalable systems. The course will help you
I have compressed my ~10 years of work experience into this course, and aim to accelerate your engineering growth 100x. To date, the course is trusted by 600+ engineers from 10 different countries and here you can find what they say about the course.
Together, we will build some of the most amazing systems and dissect them to understand the intricate details. You can find the week-by-week curriculum and topics, benefits, testimonials, and other information here https://arpitbhayani.me/masterclass .
Helping startups with monitoring | Grafana | Docker | K8s | Prometheus | Loki
2 年Arpit Bhayani you mentioned multi-tanency under "when not to use". Isn't multi-tanency a concept orthogonal to serverless?
Full Stack Engineer II @Ascentt
2 年Amazing Article
Platform Advocate at Loft Labs | CNCF Ambassador | Google Venkat Scholar | CKA, KCNA, PCA | Gold Microsoft LSA | GitHub Campus Expert ??| 4X Azure | LIFT Scholar '21|
2 年For Online Judge wouldn't the cold start be a problem?
Lead Staff Engineer @FountaneInc Coach, Instructor and Mentor. Problem Solver. ?? helping people learn programming and doing well in their life.
2 年Lakshay, Prakash, Neha, Pallab, Aman
Driving the growth of TJX India, a Fortune 500 company ranked 87th. Expert Technical Recruiter with a focus on team building, tech startups. Data-driven and storytelling specialist.
2 年Very informative and simple reading material, Thanks Arpit Bhayani, I always look forward for your articles.