How can we avoid the headache of having too many and too heavy features or services? Add more resources? Do some refactoring? Pile up external services? But what if users keep coming back with more requests for new features?
Imagine adding new features to a project that has to do with images. It may be a platform for sharing photos. The features we need store images and assign URLs to them. Simple. But then users want to add cropping and resizing features. Fine. We find an appropriate solution on the web and link it to our project. The users come back again, but this time they would like us to implement an image recognition feature which would store the results somewhere. Things are starting to look complicated - especially when the issue of price comes into play.
We can connect all these services and remember the correct logic sequences and exceptions. Obviously, the service must be asynchronous because only after a successful upload will it send an image to the crop service, and later on to the recognition service. We’re smart, and we see the problem: many vulnerable dependencies and ‘heavy’ features.
It takes (too much) time to develop anything new in such a complex environment. And it’s costly to pay for so many external services.
Our answer and solution is:
Node.js + Lambda(AWS) + Serverless = a lightweight project
Lambda(AWS) “is a compute service that lets you run code without provisioning or managing servers. AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second.”
So where's the catch? Well, there is no catch!
Using Lambdas is fully transparent. You pay only for the functions that get triggered:
first 1 million requests per month are free of charge;
$0.20 per 1 million requests after that ($0.0000002 per request).
The Perfect Mix
Combining the three tools will let you create flexible, fast and lightweight features on a single platform. No need to worry about the complexity, because Lambda has an automatic rescale function – Lambda can handle almost an infinite amount of requests and respond to all of them. With Serverless, we obtain a tool for building new functionalities in one place. We connect Serverless directly to Amazon Web Services. Don’t worry about setting up AWS manually. We can find everything we need in the Serverless framework.
Interested in trying this approach yourself? Drop us a line and we’ll help you get started.