Ishanka Ranatunga

Software Engineer | Tech Geek

A Short Introduction to Serverless & FaaS

Hey folks 👋, it has been a while since my last post 👉 An Introduction to NoSQL.  Recently, I had to revise some of the things that I have learned about in past few months. One of them is the Serverless Architecture. So I decided to write a post about it while I’m revising. 😁


Serverless is a hot 🔥 trend in cloud computing. The serverless architecture is not actually “serverless” though. .
tenorYes. It is just the name. 😉 Serverless does not mean that there are no servers involved. It simply means, the developers don’t have to think about server management and low-level infrastructure. The cloud provider will be responsible for managing resources, provisioning, patching and make servers available for the tasks. So that the developer can focus only in coding. 👨‍💻1_dAnZk19kGszKTvAgag31sQ.jpeg

In Serverless Architecture, applications significantly depend on third-party services known as Backend-as-a-Service (BaaS) or on custom code that’s run in ephemeral containers  known as Function-as-a-Service (FaaS).

  • BaaS :
    Applications that depend on 3rd party applications/services to execute a certain amount of the application’s logic and state.
    eg: Auth0, Firebase
  • FaaS :
    Applications that run in stateless compute containers that can be triggered via events.
    eg: AWS Lambda, Google Cloud Functions

Basically, FaaS is about running back-end code without managing your own server. Here instead of writing applications, we can write piece of applications with event rules which trigger our code when needed. So that you’ll be billed only for the fraction of a second, measuring resource usage. 💰

I have worked with PaaS solutions like, Heroku. As the PaaS providers promised they have offered us the freedom of managing servers but they don’t have great auto scaling, so we have to still think about it. 🤔 Also PaaS is designed for long-running applications. So that the application is running always to serve the incoming requests. In FaaS, our function begins to serve a request and terminated after it is processed. That means, when there are no requests, our functions should not consume the resources.

But there is a issue, ☝ not all workload can be converted to a event triggered model and neither can all code be separated by it’s dependencies and some of them may require intensive installation and configurations. So we should keep in mind that FaaS cannot be used in every situations.

Here are some use cases of FaaS; 👍
-Web Apps
-Scheduled Tasks
-Chat Bots
-IoT Services

Let’s list down some benefits of Serverless approach 👇

  • In serverless, you are only charged for the time it took the function to run. So we don’t have to pay for the idle time.
  • Serverless gives auto scaling without involving us. Depending on the load cloud provider will scale up function instances.
  • We can use different language runtime according to the use case
  • Developers can focus on coding without worrying about the server management

There are drawbacks also. Below are some of them 👇

  • Serverless can also add complexity rather than reducing it.
  • Potentially hard to debug
  • Hard to work with different services : using Firbase instead of DynamoDB
  • Cold start : It takes some time for a scalable serverless platform to handle the first request by a function

Serverless architecture allows us to write piece of applications with event rules which trigger our code when needed and run quickly without using lot of server resources. But it doesn’t mean that FaaS is usable only in small scenarios. Although a function is a small unit, it can be invoked millions of times per second. The question is what functionalities we should move from our application to functions and how to do it without making our application complex. 💭


An Introduction to NoSQL

Hi there! With the new look of my blog, I decided to talk about a different subject. Let’s jump straight into the today’s subject without any small talks. 😛

In the world of computer systems, there are large number of data comes out every day. A significant amount of those data is handled by Rational Database Management Systems (RDBMS) which is a predominant technology for storing structured data in computer systems.

There are different types of data;

  • Structured Data : Information with the high degree of organization and readily searchable by simple,straight forward search operations.  
  • Unstructured Data : Information that is not organized in a pre-defined manner neither a pre-defined model.
  • Semi-Structured Data : A cross between above two. Type of structured data. but lacks the strict data model structure.

Structured, Semi-structured and Unstructured Data

As i said, the structured data is handled by RDBMS, what happens to the unstructured and semi-structured data then? What if your data requirements at the beginning are not clear and you are dealing with massive amounts of rapidly increasing unstructured data (time series data such as – IoT and device data, user and session data; chat, messaging, log data) ?

RDBMS are not designed to manage these type of data efficiently, and this is where NoSQL comes into the stage with the capability of handling huge amount of data properly.

What is NoSQL?

NoSQL means “Not only SQL” and it is an approach to database systems which is far away from traditional RDBMS. Unlike RDBMS, NoSQL satisfies the next-generation data-intensive application requirements which are performance, scalability and flexibility. NoSQL is very useful when it comes to storing unstructured data which is growing rapidly than structured data.

How NoSQL achieve those?

Instead of tables like in RDBMS. NoSQL is document-oriented. So the unstructured data is stored in a single document that can be easily found and it is not necessary to categorize into fields like in RDBMS.  Not only the unstructured data, it can handle structured and semi-structured data also.

Developers who are working with object-oriented programming languages such as Java, PHP, C# and Python use APIs such as JPA, Hibernate, LINQ which allow developers to execute queries without having to learn SQL. NoSQL is natively object-oriented, easy to use and flexible. So it sidestep by using APIs.

NoSQL provides horizontal scaling rather than vertical. It’s cost-effective when comparing with RDBMS which is vertically scalable by increasing server hardware power and bigger servers.


Vertical Scaling vs. Horizontal Scaling


Types of NoSQL Databases

  • Key-Value Stores :
    The most simple NoSQL option which is very useful in accelerating an application’s read-write speed and processing of non-transactional data. Stored values can be any type of binary object (text, video, JSON, etc.) and are accessed via a key.
    Eg: Redis, Riak, Azure, DynamoDB
  • Document Stores :
    This uses the Key-Value as concept but complex. A value is a single document that stores all data related to a specific key. It’s own a unique key, which is used to retrieve. Popular fields in the document can be indexed to provide fast retrieval of data without knowing the key. Each document has same or different structure.
    Eg: MongoDB, CouchDB i4
  • Wide Column Stores :
    Stores data as columns rather than rows and groups columns of related data together. A query can easily retrieve related data in a single operation because only the columns associated with the query are retrieved. In RDBMS, the data would be in different place on disk, requiring multiple operation for retrieval.
    Eg: BigTable, Cassandra, SimpleDB
  • Graph Stores :
    Uses graph structures to store, map and query relationship. The adjacent elements are linked together without using an index. This method is the most complex one.
    Eg: Neo4J, OrientDB, Polyglot

Why NoSQL?

Think of a situation where your server-side application is developed to be fast and seamless, but you use RDBMS to handle data which will bottleneck the data. If you use NoSQL, it will prevent from data being bottleneck.
Think about an AI or a machine learning model. What will happen if you use RDBMS over NoSQL?

When it comes to Big Data, NoSQL is the hero doing the things that traditional RDBMS cannot.

A NoSQL database has no limit when it comes to storing types of data. You can store them together and allows to add new different types as you need. With document based database you will store data in one place without having to define the types.

In cloud computing, NoSQL is the best cost-saving approach. Some NoSQL databases are increasingly begin adopted to high availability and they use master-less database architecture that automatically distribute data equally among multiple resources. By automatically replicating over multiple data centers, distributed NoSQL databases can ensure a great application experience wherever users are located by reducing the latency.  NoSQL databases like Cassandra are designed to be scaled across multiple data centers without any hassle.

BUT, there are some disadvantages also.
A major problem in NoSQL is lack of reporting tools. However, SQL have variety of reporting tools available.
The community is relevantly new when comparing with the community that SQL has. But NoSQL is rapidly growing.


NoSQL databases are becoming a major role in the database landscape. With the advantages like low-cost, performance, high availability and scalability, it is a great option for companies who integrate in big data. But, NoSQL is a still young technology and does not have standards that SQL databases like MySQL has. At the end of the day, the choice between SQL and NoSQL depends on the complexity, variety and volume of data that you are going to work with.

Ruhunu Millennium Leosලාගේ මාසික හමුව…

අද දවසෙ දෙවැනි post එක… 😉

ඊයේ රෑ අපේ ගෙට් එකෙන් පස්සේ කස්ටිය රෙස්ට් කරලා අද හවස ආයෙම සෙට් උනා…කස්ටිය කිවුවට ඉතින් ඔක්කොම අය නෙවෙයි, මාතර රුහුණු මිලේනියම් ලියෝ ක්ලබ් එකේ අය විතරයි…මේ සැරේ meeting එක තිබුනේ මාතර සාන්ත මරියා දෙව්මැදුරෙ hall එකක..දෙව්මැදුරෙ හිටපු සහෝදරයෙක් අපිට උදව් කලා අපේ meeting එක තියන්න..

අද ඇවිත් හිටපු අය...

අද ඇවිත් හිටපු අය…

අද meeting එකට මලිත්, පෙමිත්, ශානුක්, තිලූක, අමිත් අයියා,ලක්ෂිත, අකිල සහ අසිරි ඇවිත් හිටියා…ශානුක් සහ තිලූක අද අලුතෙන් අපිත් එක්ක එකතු වුන සාමාජිකයන්..අපේ LEO Club එකේ president තමයි පෙමිත්…එතකොට මලිත් කියන්නෙ secretary…සමහර අයට ඉතින් අද එන්න බැරි වුනා එක එක වැඩ නිසා…

Pemith (left) & Malith (right)

පෙමිත් (වම) & මලිත් (දකුණ)

මේ සැරේ අපි පොඩි දෙයක් සංවිධානය කරන්න කතා වුනා…ඒ ගැන දැන්ම කියන්න බෑ…එතකොට කිසි ගතියක් නැති වෙනවනෙ…ලොල්.. 😛 ඒ සංවිධානය කරපු දෙයට ඇවිත් හිටපු හැමෝගෙම කැමැත්ත ලැබුනා..

අමිත් අයියා අපි සංවිධානය කරපු ‘දෙය’ තියන්න තැනකුත් යොජනා කලා..අපිට එතන බලන්න හිතුනා ඒක ගැන කියපු විදියෙන්..ඉතින් අපි ගියා place එක බලන්න meeting එකේ වැඩ කටයුතු ඔක්කොම ඉවර කරලා…

මම එතනට ගියපු හැටියම ගොඩාක්ම ලස්සන සිත්ගන්නා සුළු,අපේ වචනයෙන් කිවුවොත් පට්ටම පට්ට scenery එකක් දැක්කේ..අපි හැමොම දැක්කා..හැමොගෙන්ම කටින් ඒ වෙලාවෙ පිට වුන එකම වචනය ඉතින් “පට්ට” තමයි… 😀

කොහොමහරි අපි ඒ ගියපු තැන ඉන්නකොට වෙලාව යනවා තේරුනේ නෑ…එතනින් යන්න කලින් මම අපේ කස්ටියගෙ (අදුරු 😀 ) photo එකක් ගන්න අමතක කලේ නෑ…



අපි සංවිධානය කරන දෙය තියෙන්නේ ලබන මාසයේ…එදාට ඔයාලත් එන්න LEO කෙනෙක් විදියට අපේ club එකට බැදිලා සමාජයට මෙහෙවරක් කරන්න ආසනම්…එදාට අපේ ක්ලබ් එකට අලුතෙන් සාමජිකයන්/සාමාජිකාවන් බධවා ගන්නවා…එදාට එනවනම් කලින් දැනුම් දෙන්න පහල තියන ක්‍රමයකින්.. 🙂

වැඩි විස්තර…

facebook – RuhunuMLeo

twitter – RuhunuMLeo

පෙමිත් – 0713366766

මලිත් – 0713166508

පළමුවැනි post එක (1st post)


මේ මගේ පළවෙනි පෝස්ට් එක…මම ඉෂංක රණතුංග…මට 21යි…මම ඉන්නේ මාතර…

මම නිකමට වගේ මගේ phone එකට බ්ලොග්ර් එකයි වර්ඩ්ප්‍රෙස් එකයි install කරගත්තා (නිකන් ඉන්නම බෑ නේ… 😛 😀 )…ඒක නිසා හිතුවා නිකමට වගේ බ්ලොග් පෝස්ට් එකක් ලියන්න… ඉතින් ලිවුවා…

ම්ම්ම්…පළවෙනි පෝස්ට් එක නිසා වැඩිය කියන්න දෙයක් ඇත්තෙත් නෑ… දැනට ඉවරායි… 😀