One of such solutions is a multi-tenant
application (thus, also database) architecture. The
main idea of this approach is to share one instance of
an application among many tenants (companies
subscribed to the service), thus drastically reducing
expenditures to application servers, web-servers and
associated infrastructural elements. An application
design according to such architectural principles
imposes some restrictions to functionality, but it
brings unprecedented opportunities to scale the
solution and allows, having sufficient physical (or
virtual) computing power, to set up an unlimited
amount of application instances to serve clients.
However, these considerations do not apply to
database servers which are the first candidates to
become a bottleneck as the system grows. The
reason for this lies in the fact that, in a contrast to
application servers, database servers scale poorly.
To be more precise, application servers are able to
scale well just because they descend most of load to
the level of database servers, often just generating
SQL queries and performing simple post-processing
of the result. The database server should provide
reliable data storage, fast access, transactional
integrity and much more. A trend in recent years,
when the most of the application logic moved to the
database level, increased the load on this component
of the system even more. The total amount of data of
all provider's customers in cloud solutions and the
number of different queries that they have to
perform, make traditional database scaling
techniques (like vertical scaling or database
partitioning) even less ineffective than they were
earlier.
2 BACKGROUND: MODERN
WAYS OF ORGANIZING A
MULTI-TENANT
ARCHITECTURE
There has already been some experience in the field
of organizing cloud data storages
(Chong et al.,
2006b)
. At the moment, there are two main
approaches to designing multi-tenant relational
database.
Usage of shared tables for all clients with
attachment of tenant identifier to every record
— this is the shared table approach.
Creation of the own set of tables for every
tenant (usually, these tables are united into one
database schema) — this is the shared process
approach.
Both approaches have its pros and cons.
2.1 Shared Table Approach
This approach is the most radical in answering a
question of sharing server resources. Its usage
requires adding a special column to every table in a
database which stores a tenant identifier to
distinguish data of different clients. Every SQL
query to the database of such architecture should be
supplemented with an additional WHERE/HAVING
predicate, that leaves in the query result only records
that belong to a specific client. There are also some
projects of SQL extensions
(Schiller et al., 2011), that
allow to add such predicates automatically. The
advantages of the shared table approach are the
following:
better usage of a disk space;
small size of a data dictionary;
better usage of a query planner's cache (i.e.
shorter time of query analyzing and generation
of its execution plan).
This approach also has some drawbacks. First of all,
it is the enlarging of the size of database tables and
their indexes
(Jacobs and Aulbach, 2007). This
drawback results in a requirement of very high
qualification of developer of database queries, since
any mistake or inefficient solution can lead to
significant degradation of an application
performance. In second, usage of this approach
implies a need to always add predicate of selection
of data of a current tenant. This drawback leads to
access errors, when users of one tenant can see data
of another tenant in a case of a programmer error.
The above mentioned
(Schiller et al., 2011) concepts
of extensions of the SQL language are possibly able
to solve this issue. The third issue of this approach is
a complexity of replication and backup copying of
data of a separate tenant.
In general, this approach shows good results,
when application's data schema does not contain
many tables, and a typical query is relatively simple.
If the above conditions are met, this approach allows
the most effective usage of hardware resources.
2.2 Shared Process Approach
This approach occupies an intermediate position in
solving a problem of sharing server resources,
between complete isolation of tenant's data in a
separate database and a shared storage of them in the
shared table approach. The separation of tenant's
data is achieved by creation of the own set of
database objects (tables, views, e.t.c.) for each
tenant. This approach has some advantages.
Multi-tenant Database Clusters for SaaS
145