Currently, I am trying to learn microservices and node.js. I googled a bit about the serverless vs microservices and got confused. I'd like to hear from you experts about what the differences between these two.
You can use microservices and serverless together, it's not one vs other.
Serverless is basically a managed infrastructure for you. You write your business logic, deploy it to any serverless provider (i.e., as a combination of functions, queues, databases, etc.) and then cloud provider manage it automatically. You'll get auto-scaling, auto-failover, full isolation, and many other things out-of-the box.
You can deploy a monolithic application to a single serverless function (for example, AWS Lambda), but as we describe in the chapter 14 of our book, that's not an ideal use case. Much better is to split your application in multiple services (micro or even nano services) and let AWS manage them automatically. You'll see case studies in the last chapter of our book (how MindMup and CodePen are using serverless), both apps are using some kind of micro services.
For my product, Vacation Tracker, high-level infrastructure looks similar to the attached diagram. You can see a few services there, but in reality they are split into even more small functions and other pieces. We have more than 60 functions, and they communicate via Amazon Simple Notification Service messages, queues, and many other triggers.
So, short answer to your question is that you can't compare microservices and serverless, as they are different things and you can use them together. I hope that answers your question.
posted 1 month ago
Thanks for your quick reply.
It makes sense to me now. In the Serverless box of the picture, everything seems independent (except many components are depending on the database). I'd like to read more about serverless now.