What can serverless do for Node.js developers?
Serverless computing is 2019’s most talked-about buzzword, at least in the development space. If the idea of building and running applications and services without the need to manage underlying infrastructure doesn’t excite you as a developer, then I don’t know what would!
Serverless makes background processing a breeze
When creating Node.js applications, while building your server is easy, doing background processing of messages isn’t so much. It can be a little intimidating to manage and maintain. There are not that many tools out there, which understand frameworks for doing background processing. Background processing is easy to scale on the HTTP request messages in many platforms but queues can be a little bit trickier to get right. In serverless, I can have a function up and running and scaling dynamically. Since you pay for execution in most serverless frameworks out there, you never have to overpay for your system.
E2E frameworks become less necessary
Node.js frameworks like Express.js become a lot less necessary when you’re pushing just a function. You don’t have to worry about a full stack of things that are going to manage, for example, the various HTTP entry points. You don’t worry about a lot of extra code either. If you take advantage of Microsoft Azure Functions, for instance, which have bindings to various services, you never have to bring in the SDKs to talk to, for example, Azure Cosmos DB, which is a giant document-based database. In serverless, you just need to choose those bindings and return a JSON task from the function and it’ll get stored for you by the cloud platform. Therefore, you don’t have to work with those SDKs.
Horizontal scaling is easier than ever
With serverless, you can high-scale easier than ever with functions. You never have to see the instance count, worry about managing the VMs or about patching things. It just keeps on scaling and as soon as you have no more traffic on your service the VMs just disappear. You don’t really worry about when they’re there and when they’re not. You’ll scale out when you have requests and usage. This has turned out to be really useful in a lot of cases.
Focus on business logic, not infrastructure
You don’t have to manage infrastructure and even code for management infrastructure, and just writing, “when I get this message from Service A make Service B do this”—in that business logic that’s all that you have to write as a developer and everything else is maintained by the platform. That’s really empowering because now you add a whole pool of developers who might not know how to manage the infrastructure but are able to do the same things that a team which had this specific set of skills would be able to do. Now developers without any experience of running large-scale cloud infrastructure, don’t need to develop that experience. They can just implement their business logic and go.
Pay for what you use
With serverless computing, you don’t have to worry about how I’m going to pay for the infrastructure. You pay for what you use. There’s a lot of friction that goes away when you think you don’t need to spend a lot of time architecting things to make sure you understand how it’s all going to work.
For example, event apps using functions is a great idea. They will receive many random requests, especially during the week leading up before the event, from the various speakers that will be having a session at the event. If the event app is serverless, you just have to add a random function to serve purpose and respond to those requests.
The best part is after the conference is over, you don’t have to worry about closing or scaling down the VM. You can walk away in case it is expected for people to use it randomly. You don’t get charged anything for those functions running in the meantime.
Being able to throw a function and make two services talk to each other, is what makes a serverless platform special. You don’t have to establish a server to integrate two different services, serverless function can take care of the integration. Having just a function to do it with a little bit of code, simplifies the effort that goes into development.