What does it mean serverless architecture?
Classic web app has a server spun up which is awaiting for users to come and serve them with responses of info. This requires to take care of load and bandwidth. All that means if one Million users try to reach your app at the same time, your server will have to have adequate capacity of CPU, RAM and network IO throughput to keep all of them happy.However, there is a quite handy alternative right on the shelf. AWS has presented Lambda a while ago and it has found its lovers along by offering to save cash.
What is Lambda
Lambda function is a piece of code which starts where it needed and all the rest of the time it just sits and does nothing. Unlike server you do not pay for anything until your code runs. On a top, if a Million of users decide to come and visit your resource, Lambda will serve all of them at the same time. Also pricing model is based on number of runs. There are some advantages and disadvantages. Let’s have a closer look.
Pros and cons of Lambda
Lambda goes in several different flavors. This is matter of your choice: Python, Node, Java or Go. All of them have minor differences. For example, if you choose Python, in this case function will run very fast with a predictable stable benchmark.
Node on the other hand is not that consistent. Seems like Node version starts process in the background and if your calls follow very close to each other or simultaneously and they are completed asynchronously.
Another characteristic is to be kept in the back of your mind is a cold start. In the background Lambda starts a container in which your function runs. So, first execution includes container start-up time. Next, following functions are fast until container has to be restarted or added new one in order to keep with scaling requirements.
Embedded IDE at this moment is available for Python or Node. If you choose Go, then you will have to create code base locally on your machine, zip it and upload it to the console. This is very straight forward process, but it is very handy to have an IDE on AWS side.
AWS SDK
is included in dependency list in all languages by default. This means for us that it is very easy to manipulate with other AWS services to have reach functionality in our application. There is an unlimited amount of options are on the table. Like so API endpoint connects to Lambda, SNS or Cloudwatch alarms along with S3 events.
Lambda has some limitations
- execution time,
- limits for a RAM
- disk space usage
But they are not such horrible and we still have a room for a maneuver.
If you need any AWS services, please contact for free quote