Serverless Architecture Explained In 10 Minutes

What if we told you there are servers in serverless architecture?

It’s a counter-intuitive concept, almost an oxymoron in itself.  But it’s real, it’s here and it could be the future of how we design and integrate applications.

So, what exactly is serverless architecture?  And how can FAAS or “Function as a Service” be used in cloud computing?

This is serverless architecture explained in 10 minutes.

The big buzzword in the software world right now is “serverless”. The only thing is, many of those singing its praises or trying to shoot it down have no idea what the term actually means – they’re still stuck in 2010. Ever tried explaining cloud computing to someone outside of the tech world? You get our point.

Speaking of the cloud, the big 3 cloud vendors are heavily invested in the serverless method, we’re talking about the tech giants here – Amazon, Google, and Microsoft. The smaller players are following suit, with open-source projects from software vendors dedicated to a new way of doing things.

Is it right for everyone though? Is it feasible for the little guy and industry giant alike? It’s the same as any new tech, there will be pros, there will be cons, just ensure you make an informed decision before picking a side.

SO, WHAT IS IT:

To make it difficult and ambiguous straight off the bat, the term “serverless” is actually describing two separate things. There is some common ground between the two, an overlap of the Venn diagram, but they are not the same.

Classically, a back end would be considered serverless if the application used a third party to do all, or the majority of, its server-side logic. These third parties are cloud-hosted applications and services that run from a server room in somebody else’s building. See – serverless, but still using servers.

This arrangement is used by things like single page web apps and mobile apps. Databases and authentications services are run via the cloud, dubbed Back-end As A Service or BAAS for short. This is old news.

But serverless also describes server-side logic written by the application developer, but not handled onsite. In this case, the third party provide stateless compute containers that are event triggered. They may only last for a single subroutine schedule and cease to exist post execution.

This process is called Functions As A Service or FAAS, and AWS Lambda is one of the most popular service providers. They let you run your own code for literally any type of application without provisioning or managing servers – you pay for what you need, and computing power is allocated based on the complexity of the coding and rate of traffic.

Vendors offer serverless portfolios that employ both BAAS and FAAS products used in unison.

WHAT IT’S NOT:

Platform As A Service or PAAS provides a cloud-based platform designed to develop, run, and manage an application. It wouldn’t be considered serverless because it’s a framework of powerful tools for developers to create fully customized applications from within the cloud.

It takes a lot longer to wind up than true serverless processes, as it must handle both development and delivery of software over the internet – instead of just focusing on delivery alone. Both BAAS and FAAS take all of the advantages of PAAS and do them better by either using the tools provided by the third party, or the freedom to execute in-house code.

Serverless processes operate on event driven fees and autoscaling, which reduce running costs and increase the speed of both software deployment and updates.

HOW IT WORKS:

We know how a regular back end works. We have the client-side browser making a request for the server-side logic to access a central database. Simple.

In a serverless system, the client-side browser talks directly to the authentication service associated with the BAAS. Once access is granted, another BAAS function allows the browser access to a products database fully hosted by the third party. We essentially have a single page application – the third party keeps track of the client’s session, reading of the database, and translating into a usable view by offering a specific service package.

Instead of having third party servers that are always running, we can use FAAS to generate an application programming interface gateway. The user can now choose between other functions they have created themselves – for argument’s sake, let’s call one search, and one purchase.

The search function links to the same product database as the BAAS, with the results populating in the browser. The search code has been ported in the original Java and JavaScript without a complete rewrite – but the process is much faster, and variable function can be added at the developer’s discretion.

A selection is made in the “shopping cart” style function of the browser, before another FAAS function links to the offside purchase database. From there payment is authenticated via another third-party vendor like PayPal and success – the browser informs the user of their purchase.

The FAAS system has broken up different logic processes into separately deployed commands that are more flexible and easier to modify or change. Each click generates a new compute container, managing the microservices in a more efficient manner. BAAS functions like security, user authentication, and database optimization are left to run as background processes.

THE PROS:

As we’ve touched upon, cost-wise serverless has the lowest operational costs by far – not too dissimilar to a PAAS situation. Paying for server management is drastically less than building and managing your own, especially if the fee structure is event based. This is great for inconsistent traffic.

Horizontal scaling and the addition of more microservices is completely automatic, developer adjusted, and ultimately managed by the third party. Sufficient resources are generated as the need arises, and as the application grows, there is no danger of overloading like there is with a traditional proprietary back end arrangement.

Time to market and development cycles are slashed, thanks to the shared computing power of the substantial third-party databases and servers. Development can even be done as a continuously improved rollout, improving as you go while still maintaining operation and function – no server shutdowns.

Server rooms use an enormous amount of electricity just to keep running. It’s a commendably green option to opt for serverless cloud-based operation as resources are pooled in a group, and energy is used as it’s needed with no wastage of a system running idle.

THE CONS:

After gushing about how great serverless is, it’s time to see the other side of the coin flip. It’s not all rainbows and sunshine, and there are some drawbacks associated with going full off-site third-party management.

By giving control over to the vendor, you’re at their mercy. This means downtime and resource limitations are dictated by their maintenance routine. Similarly, cost changes must be accepted as each vendor will have specific BAAS tools your browser has been built to work with.

As with everything in life, trust has to be earned. Every database has inherent weaknesses that make it prone to cyber attacks and breaches, and by using a third party you are going on blind faith that their security protocols are up to scratch.

WHAT DOES IT ALL MEAN?

In the end, despite a completely confusing name, all serverless architecture means is that you’re effectively renting someone else’s machines.

Using BAAS, the tools associated with third-party servers can be integrated into the client-side browser to run simple functions like security, authentication, and notification services. Where FAAS gives you the opportunity to move your own server-side coding directly into the serverless system, for near-instant function and endless customization.

There are riches to be made by taking the plunge and diving into a serverless system, but the grim reality is that you are handing over control to a third party, and your success is at their mercy. There is still a lot to be said about the value of a traditional monolithic or microservices back end that is built, run, and maintained in-house.

THE FUTURE OF FAAS

As cloud computing has accelerated over the years, it’s helped develop more efficient and scalable routes for engineers to build working solutions quickly.  But we’re only seeing the tip of the iceberg.

In 2019, UC Berkeley published a paper titled “Cloud Programming Simplified: A Berkeley View on Serverless Computing.” The paper predicted that serverless computing would dominate the development of cloud computing over the next decade and will reshape the way enterprises innovate.

In the future, expect to see complex technical solutions implemented as fully managed, serverless backend services.  An entire ecosystem accessible through API’s.

Kofi Group is proud to be a source of knowledge and insight into the startup software engineering world and offers a multitude of resources to help you learn more, improve your career, and help startups hire the best talent. If you are interested in learning more about what we do and how we can help you then get in touch or watch our Youtube videos for additional information.

Try our other blogs on hot topics, like  “Why React Native is the Most Popular Cross-Platform Technology” or “Microservices Explained in 10 Minutes”.