Building a Multi-tenant SaaS Platform
What does SaaS and Multi-tenant mean and what can they do for us?
Our Back end leader, Nacho, tells us how we implemented in Widergy the multi-tenant SaaS application platform as the basis for the products we offer to our customers. But first we need to clarify what we mean when we talk about multi-tenant SaaS applications, and more importantly what they can be used for.
After almost 3 years of being involved in the development of software applications conceived as a product, I began to notice that the development patterns and technical solutions we were arriving at began to diverge more and more from the typical examples, tutorials and posts that had served me so well when I started this “journey”.
We created Widergy with the mission to think, design and develop technology solutions for the Utilities industry (companies that offer public services such as electricity, gas or water) in an increasingly dynamic, challenging and complex context.
The first product we set out to develop, so that we could then offer our potential customers, the utilities, was UtilityGO! An interactive digital platform that facilitates a new relationship between the consumer and the utility, evolving the user experience. In short, the main objective was for consumers to be able to interact with the utility across multiple digital channels while maintaining a consistent end-to-end experience, regardless of the channel. Understanding their consumption, paying a bill, carrying out a procedure or claim had to be a simple experience within the reach of anyone with access to a computer, tablet or smartphone.
This is when we first considered building a white label platform with a SaaS model.
SaaS: Software as a Service
Software as a service is a software distribution model in which a technology provider (us) offers a series of “services” in the cloud to its customers (the utilities), which are delivered to end users so that they can access them through a web browser or a mobile application developed for this purpose.
The provider is in charge of providing the service, taking care of the daily operation, maintenance, updating and evolution of the software, while the customer pays a fee for the use of one or more applications, as opposed to a classic model where the customer would have to bear the full cost of development and operation.
Software as a service often comes hand in hand with a feature that makes the model especially efficient: it is multi-tenancy.
Imagine you want to create a web application and market it in such a way that multiple organizations can use it, how would you implement such a project? You could simply take the code base of your application and copy it completely for each organization, right?… but this implies that now you are going to have to support multiple instances of your application separately.
Clearly this is not the best solution, since in this case your development team would have to manage server infrastructure, upgrades or new functionality separately for each instance. If your application is being used by, say, a dozen organizations, and you want to deploy a new version, to update all the applications, your development team would have to do the same deployment a dozen times! There is a much better solution.
You can develop a multi-tenant application.
Multitenancy is a property that a software application may have that takes its name from the term “multi-tenant” (can be interpreted as “multi-organization”). It corresponds to a principle of software architecture in which a single instance of an application running on a server can serve multiple clients or organizations at the same time.
Multi-tenant software-as-a-service applications are extremely popular in 2019, but why? Basically, because they allow us to offer the same application to many customers at the same time, distributing the cost of infrastructure and maintenance among all of them. That is, an application that allows with a single instance and a single database, for example, to serve all customers at the same time.
The main idea is simple: to have a single code base that runs for all clients, with the same data structure, but implementing a mechanism that allows us to separate and isolate the data belonging to each of the organizations, in a way that is transparent to the client. That is, to look the same as any other single-tenant application.
The physical implementation of this concept has several possible approaches: The code base will be unique, but there may be only one physical copy running on a server, or it may be deployed on several servers running the same code in parallel. As for the data, they may be stored in a single database, or there may be a separate database for each customer, but all with an analogous structure.
The implications of this type of architecture are significant. Updating the code base means updating it for all customers at the same time; this has the great advantage that everyone shares in the improvements immediately, without the need for a complex phased implementation plan. At the same time, it has the problem of requiring a clear understanding of the effects that general changes may have on the particularities of each client. In terms of data structures, a great advantage of having unified structures, whether they are hosted in the same physical database or not, is the possibility of making aggregated queries on the data of all clients.
In terms of maintenance and updating processes, logically the structures must be modified at the same time as the code that uses them. This means that there is usually little or no downtime for the application in production, so these operations must be planned to have as little impact on performance as possible. If possible, it is best to implement “hot-deploy” mechanisms (as they are often called) which aim to have zero-downtime.
If you are serious about building horizontally scalable distributed systems, they definitely have to be multi-tenant.
If you were interested in this article and want to know more about how we implement these technologies, stay tuned to our social networks and we will let you know about the next ones!