Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Articles Tagged ‘database’

Introduction to NoSQL

Saturday, December 16th, 2017 by Servage
databaseWhen working on websites and applications, there are many databases to choose from. The most common choice for websites is MySQL or MariaDB, which are essentially the same database systems. Another alternative that has gained popularity recently is NoSQL databases. Today it’s time to look at how NoSQL databases work, how they differ from MySQL and if there are any benefits in using a NoSQL database instead. What is NoSQL? You have likely used either MariaDB or MySQL in the past. Both of these are relational databases and differ from NoSQL databases quite a lot. The first misconception about NoSQL is that it wouldn’t use SQL like the name might suggest. In fact, ...

Recover database records with soft deletion

Wednesday, July 26th, 2017 by Servage
trash-deleteSome websites allow you to delete your content, such as videos you have uploaded or even your whole user account. At least this is what it looks like for the end user. However, in most cases, the content is not actually deleted, which gives administrators an easy way to undo actions of users who make hasty decisions. This can be done using a technique called soft deletion. How Soft Deletion Works Soft deletion is incredibly simple to set up. All you need is one additional column in your database. The field is usually called deleted_at or is_deleted, depending on whether you want to know when a specific record was deleted. The deleted_at field ...

Introduction to Graph Databases

Friday, July 14th, 2017 by Servage
database-queryYou may have worked with relational databases such as MySQL before, but what about graph databases? Graph databases are data storages for the semantic web, and their structure differs from a typical relational database. Let’s have a closer look at how a database like this works and what it can be used for. Data Storage Model A relational database stores data in key-value pairs in rows of a table where a column (key) has a value. Graph databases are not tied to data structures such as columns or tables. Instead, a graph database uses nodes, properties and edges. Although these terms may be new to you, fortunately they map surprisingly well to the ...

What is JSON-LD

Sunday, June 25th, 2017 by Servage
json-ldYou don’t have to be a JavaScript developer to know JSON. It has become the standard for transferring data over the Internet, for example from back-end APIs to front-end applications. However, JSON-LD is a totally different story. It’s a relatively new and unpopular standard among developers, at least compared to JSON. JSON for Linked Data JSON-LD stands for JavaScript Object Notation for Linked Data. As the name suggests, it is used to represent linked data using JSON. It is meant to be as simple as possible for developers to convert their existing JSON to JSON-LD. Linked Data Explained So, what is this linked data? In order to understand linked data, one should have a basic ...

How distributed high-availability databases work

Saturday, June 10th, 2017 by Servage
databaseSometimes a website becomes so popular it outgrows the single database model and the workload must be distributed across multiple database instances. Or perhaps the website is so critical it cannot tolerate database failures even for short periods of time. There issues can be overcome by setting up a high-availability database infrastructure with multiple servers. Master-Slave Architecture The master-slave architecture is a common way to distribute load between multiple databases. In this model, one server is chosen as a master server, which can be used to execute read and write actions. The master server’s database is then replicated in real-time to one or multiple slave servers. This works by creating a database user ...

Load-balancing web applications

Thursday, June 1st, 2017 by Servage
network-serverLoad balancing works by distributing the traffic of a single website across multiple web servers. This is important for large websites that receive so much traffic that a single web server is no longer enough to serve all visitors. It also adds a layer of reliability because if one of the web servers goes down, the others can continue to serve visitors with little to no impact to the website. Let’s explore a couple of strategies for load balancing web applications. DNS Load Balancing This is probably the cheapest and simplest way to load balance web traffic. The Domain Name System (DNS) is not specifically built with load balancing in mind but system ...

Database seeding with sample data in Laravel

Monday, March 7th, 2016 by Servage
laravel-db-seedWhen working with web applications you know the need for testing with sample data in your applications during development. This is extremely useful because testing with various sample data allows you to likely detect bugs you otherwise would have overlooked. Meaningful sample data also provides a useful way of showcasing the application for others, without having the typical manually entered John Doe entries over and over again. Laravel provides a tool to add sample data to your databases automatically. They call it database seeding. It is the processes of adding data to a database after migrations. You can create seeding scripts with PHP, so they can essentially include any logic you desire, to create ...

Laravel database migrations

Sunday, February 14th, 2016 by Servage
database-migrationWorking with database structure is often a cumbersome process. Initially everything is fine. You have all kinds of options and can design whatever database structure you want and your project needs. You can even change your structure many times over during the initial development without any real implications. However, this changes as soon as you get more developers on board or whenever you start working with real data. As soon as collaboration and live data exists, you need to make sure that structure and data is properly managed throughout any change process you may need. You cannot just change the database in your local environment without properly recording the change and making ...

Work with databases and the query builder in Laravel

Monday, November 30th, 2015 by Servage
database-queryWorking with database driven applications in Laravel is super straightforward. This functionality has been included as a core feature of the framework as database handling is almost done in every project. Using your Servage hosting account you can connect to one or multiple MySQL databases from Laravel and create, edit and delete data as you please. This article will outline some of the standard functionality for this. Configuration You first need to configure your Laravel installation for your environment. Note that you can use local configurations to make the database settings different depending on for example local development environment and production web hosting account. Below you find an example configuration. 'mysql' => [ ...

Building a good data model with Workbench

Friday, December 26th, 2014 by Servage
data-modelWhenever you start considering a new project you will quickly find yourself wondering about the data model. At least if you're the developer. Considering it early on helps building a good solution, and having a fine understanding of the caveats in data modeling is a great advantage. Why is the data model important The data model is important because it greatly impacts the future performance of your site or web app. During a user request to a normal dynamic website with PHP in the back end, it is not uncommon to execute a range of database queries. Poorly optimized sites may execute hundreds of database queries for every page load. Providing users with a ...