As soon as your project begins to go beyond a simple static site such as a showcase site, for example, your database equally becomes more and more essential.
Historically, the database was provided in a package by your host. For companies with larger projects, it was necessary to invest in machines that would host their own database servers and that they would have hosted on their premises or within a data center.
Since the development of cloud computing, it is no longer a question of buying your own machines. Servers are made available by cloud providers and each web project will rent resources on these machines.
Since cloud products began to emerge with the rental of virtual machines, we quickly saw the birth of Database as a Service, also called DBaaS.
DBaaS is a service that offers you access to a database whose capacities will be able to adapt to your consumption without you having to install or configure it or ensure maintenance in the event of failure.
DBaaS is the turnkey solution that allows you to free yourself from any database administration work in order to concentrate on your project.
From localhost database to DbaaS
Think back to your first steps with a database when you were developing your first projects. You started by installing your database on your machine before you could build your application.
Before the arrival of DBaaS, if you wanted to deploy your application in production, you would have to launch a computing instance on a cloud service, connect to it in SSH and then install your database as if you were doing it on your machine. In itself, nothing too bad to do, especially since the arrival of Docker has simplified this type of task.
Once your database, which you manage yourself, is deployed and running, everything will seem to be working fine… Until it doesn’t. This is where you come into Database Administration.
The implications of DB Administration when you manage your own database
In life, there are only 3 certainties. Death, taxes, and the fact that your IT infrastructure will experience moments of failure. Development and system administration teams know today that it is useless to try to prevent these moments when the infrastructure is going to fail, but rather to seek to be ready to mitigate these failures.
In the context of a database, it is a question of setting up replica instances, knowing how to configure the database so that requests can pass on the replicas if the main instance does not respond, and having back -up as often as possible in order to limit data loss, deploy replicas in several different and geographically distant data centers.
All of these considerations are the reason why good friends don’t let their friends manage their databases themselves. Opting for a DBaaS solution is the easiest way to get rid of all this work, and companies have understood this.
The challenges of database administration.
Imagine that you have a website that generates income, for example, an e-commerce site or a dating site. Every minute your database goes unresponsive is lost revenue.
To avoid these situations, the system administration ensures the following elements:
Replication: Your database is replicated on several servers, often in different data centers. The goal is not to depend on a single machine or a single region. If a natural disaster were to flood or deprive a data center of electricity, replication in another location would take over the requests.
Failover: In the event of a primary server failure, your infrastructure should be designed to redirect requests to replica instances. This configuration work requires advanced skills in the database technology you are using.
call: What happens if you’re managing your database and it goes down at 3:00 a.m. on a Tuesday? Have you thought about putting an alert system or are you going to wait until you wake up to realize that something is wrong and start fixing it?
Recommissioning: This is obviously the main purpose of database administration. How long would it take you to get your database back up and running if there was a fault? Have you automated deployments? Do you have health checks frequent Or will you redo the infrastructure by hand in case something goes wrong? Here again, the recovery time will be more or less critical depending on your business, and the skills required to set up infrastructure automation will be quite specialized, and therefore expensive.
Data Losses: When your database suffers an outage, there is a high chance that there will be a period of time where you will lose data. Between the requests that will have failed and the data that will not yet have been replicated in a standby backup, there is bound to be a loss of data. It is measured in the number of minutes of potentially lost data. Depending on the project activity, a longer or shorter data loss is acceptable. On a dating site, it might be okay to lose an hour of data history. On a banking app, a 15-minute outage can put you out of business.
Performance: The performance of your database mainly depends on how you have coded your application and indexed your data. However, your database performance may be degraded for infrastructure reasons. Database administration is responsible for ensuring that queries maintain an acceptable response time throughout the life of the application and for taking the necessary steps to correct or reconfigure at the database server level if needed.
Whatever your choice for your infrastructure, the work of database administration must be ensured. It is done internally if you manage your databases yourself, or it is shared and managed for you as part of DBaaS.
These challenges are part of the SLAs, Service Level Agreements, that a cloud provider undertakes to hold for you as a DBaaS provider.
The cost of a DB Admin
When thinking about how to set up your database, you will assess the cost of a Cloud DBaaS infrastructure as opposed to doing it yourself. Taking a dedicated server from a host would cost you around $60 per month and you would be free to manage everything by yourself.
If you had to do the job of a database administrator on your own, you would be limited by your skills and available time.
If you were to hire a Database Administrator, you should expect to pay a salary of around $47,000 per year on average, to which employer charges must be added, for a total of more than $65,000 per year. Again, it is a single person, who will have his periods of leave and will not be able to do all the on-call duties. If you were to complete your team with one or more freelancers, their TJMs would be around $400 per day.
The benefits of DBaaS
The added value of DBaaS is also found in the simplification of processes. By outsourcing database administration work to an external provider, you can focus your energy on coding and modeling your data.
At the scale of a company with deployment processes, simplifying the steps translates into significant savings.
Data growth and scalability
This is one of the most favorable assets of DBaaS. Given that data sources are more and more numerous and the growing popularity of professions around Data Science, databases tend to grow exponentially.
In the days when databases were hosted On-Premise, growing one’s database capabilities would have involved purchasing new machines, their installations, and their configurations.
Thanks to DBaaS, an application requiring more resources for its database will be able to increase its capacities from the administration panel of the DBaaS provider.
Entrust security to experts
Data privacy has become paramount for most projects collecting personal data. Indeed, since the new GDPR regulations in 2018, companies that have suffered a breach of personal data for which they are responsible are obliged to declare the incident to the CNIL under penalty of a heavy fine.
When your company processes personal data, having to make a data breach declaration is bound to cause bad press. Consequently, fewer and fewer companies choose to keep control of this brick which has become very critical.
DevOps is a philosophy aimed at increasing the speed of deployments of an application by mixing the phases of development, maintenance, and monitoring in an event loop.
Thanks to the database administration services supported by the DBaaS provider, the team following a DevOps philosophy will be able to concentrate its efforts on the other phases of the loop.
How much does DBaaS cost?
The cost of a DBaaS varies according to the CPU, RAM, and storage space resources you want to allocate to your database server. For example, a PostgreSQL database of 1GB capacity will cost you around $15 per month on DigitalOcean, RDS, or Scalingo.
All DBaaS cloud providers offer free tiers. It is however necessary to be vigilant, as for any cloud service, with the evolution of the tariffs according to the volume consumed. Some providers offer large volumes of data for free and the first levels are at rates comparable to their competitors, but as soon as your data volume increases, the rate increases more quickly than with competitors.
How to choose your DBaaS
Many database technologies are offered by cloud providers. Some are Open Source or independent technologies, others are vendor-proprietary databases.
Related article: Top 10 databases to learn
Third-party technology databases
These are the technologies we all know, MySQL, PostgreSQL, MongoDB, ElasticSearch, and Redis. These technologies are offered by several vendors who must pay a fee to the publisher of the technology in order to offer it as a service to its customers.
In addition to these technologies, GAFA has developed its own database technologies, very similar to third-party technologies, sometimes 100% compatible with your code designed around these technologies.
They are often less expensive, or bring new features related to their suite of cloud products to “make your job easier”.
For example, AWS offers the RDS product which offers MySQL or PostgreSQL databases but they also offer Aurora, a proprietary relational database to Amazon. The same is true with DocumentDB which is their proprietary equivalent to MongoDB.
Pay attention to vendor Lock-in
When you design your application, certain features of your database will seem interesting to you because they could simplify your development and your technical environment.
For example, if your application is deployed on an AWS Cloud, native integrations between a DBaaS DynamoDB database might seem like a good idea since you are using other products from them.
Except that if your code becomes specific to certain functionalities offered by a cloud provider, you put yourself in a position of confinement vis-à-vis this provider. This is called the Vendor Lock-in.
If that vendor decided to increase their price by 15% overnight and you wanted to move your application to a competitor, you would find yourself having to redevelop a segment of your application that relies on that vendor’s proprietary technology or integration. DBaaS.
The geographical criterion
In many applications, database operations are the most time-consuming. If the operation time is inherent in the database technology, the network travel time can be optimized.
Indeed, if your database is in the USA but your users are in France, you will lose precious milliseconds of travel time. It is therefore advisable to choose a supplier capable of offering you hosting of your database as close as possible to your users.
This is why GAFAs are able to offer DBaaS in several geographical areas. If, on the other hand, your user base is mainly in France, only AWS and Azure, among the GAFAs, have a data center in France. However, you can also turn to a French DBaaS host such as Scalingo, which hosts its applications and databases in datacenters located in France.
Watch out for network traffic
Interacting with a database involves sending requests over the network between the web server that will want to retrieve, insert, modify or delete data present on the database server.
When developing locally, the application and database server are on the same machine. On the other hand, if they are hosted on the cloud, their location must be taken into consideration.
If, for example, you decide to host your application on a PaaS whose data center is located in Ireland, but your DBaaS provider hosts your database in France, you will have a performance loss in terms of query response time at your database but you will also have to pay for incoming traffic.
If, on the other hand, your application and your database server are hosted in the same data center, you will not pay for network traffic because the two servers are located within the same data center.
DBaaS & PaaS: Deploy an application easily
Using a DBaaS database in your application is often as simple as replacing a connection string, localhost, or the IP of your database server, with the one provided by your DBaaS provider.
For this example, we will use Scalingo a French PaaS provider. Scalingo allows us to deploy the Node and have a database in one command line, all while ensuring 99.9% availability. Scalingo offers a free plan, which is more than enough for its prototypes.
After registering on Scalingo, create your first application and choose your database. Scalingo offers MySQL, PostgreSQL, MongoDB, Redis, ElasticSearch, and InfluxDB databases.
Related article: Connecting Nodejs with MySql.
Then go to the AddOns tab to access your database dashboard. Then you will find the connection string to use in your application.
In just two clicks and a command line, you will have deployed your application in production and you will never have to manage the infrastructure vagaries of any of your servers.
Get Exclusive Online Business Guides and Tips That I Only Share With Email Subscribers