blog posts


Familiarity with Redis and other important databases in NoSQL

Unlike databases like SQL, NOSQL uses a dynamic structure for its schema and is a powerful option in terms of speed and flexibility against the constraints of other databases. In this article, we are going to review the Redis and NOSQL databases and point out the strengths and weaknesses of each.

REDIS database

For companies whose data is growing rapidly (such as storing information on a personal page) and are concerned about the cost of maintaining it, a good option is to use the process of storing some data in cache. Cache is a temporary storage area where data can loads faster.

That was the philosophy behind Redis in 2010. Redis is in memory (both main and side); As a result, speed and efficiency are great. The size of the database must be predictable in order to use Redis, otherwise Redis will cost more. Redis is a Key-Value Database; Therefore, the data is in the form of key-value or key-value pairs. The keys play the role of the identifier of each data.

This database is in C programming language and is mostly in Unix and Linux operating systems, but it is also for Microsoft Windows. It supports many programming languages ​​such as C # / .NET, C ++, Ruby, Java, Python, etc. and is available as open source. Companies such as Flicker, Github, Snapchat and Pinterest use Redis.

Redis Features

  • Fast and optimal performance: Response speed is very high due to memory storage and saves maintenance costs. Also, the information wont delete during resetting.
  • Use of data types: Although Redis is a key-value database model, contrary to popular belief, this value must not be a string. Redis also uses lists, hashes, and collections.
  • Multi-language support: As mentioned, Redis supports many programming languages. Many developers use it.

MongoDB database

It is one of the most popular NOSQL databases with a flexible structure and is mostly in high volume data projects. This database came in 2009 and is a Document Database; This means that JSON or XML documents are for storing the data. Storing different types of values ​​in the form of a document makes it possible to store complex structures such as arrays and hierarchical data. The data values ​​of the primary and external keys are . This database is in the Java programming language, is open to the public, and supports many programming languages ​​compared to other NOSQL databases; Including C # / .NET, C ++, Ruby, Java, Python.

To execute code in mongoDB, you must proceed through mongo Shell. mongo Shell is an interactive interface that allows them to send query commands and update data. Of course, using an external key has its drawbacks and may disrupt data stability and system integrity. Also, in clustering the data in this database, only one node can be as the main node. This problem is okay in the Cassandra database, which we will discuss in the next section.

MongoDB Features

  • Flexible data model: Due to the fact that the data storage model is. It is much more flexible and scalable compared to relational databases and meets many business needs.
  • Use Sharding: This database uses Sharding for better data sharing and management; The database is into several sub-sections to facilitate the process of responding to requests coming from the server.
  • Copying: In this technique, copies are for a data as the original data and other parts of the database system are. And in case this data disappear, the copied data is as the main and alternative data comes.
  • Easy to learn: It also has simple queries and is not difficult to work with for those who have professional experience in various programming projects. Therefore, it is usually at higher levels of software development and programming.

Cassandra Database

Netflix, one of the largest online streaming services for movies and entertainment content, uses this technology exclusively for data storage. Cassandra came in 2008 with the motto of scalability and high performance without reducing system performance on a large scale. It is a Wide-Column Database; This type of database is similar to relational databases, except that each column in different records can contain data of different structure and type, and each row can contain a different number of columns. Because of the cache of this data, Cassandra is for storing valuable key data that requires high access.

Features of Cassandra

Advanced Architecture: Unlike other existing databases, they are consistently available. This is due to the design structure of this database.

  • Intrinsic distributed structure: A gold standard in multiple data centers and can be read and written using cloud technology, so data can be easily used anywhere in the world.
  • Fast linear performance: Even with increasing volume of information, the response speed is very high.
  • Flexible data model: The Cassandra data model allows new entities or features to be added over time, and the developer is not limited to one data model. This means that over time, if you need to add columns or change the structure of the database, Cassandra allows changes.
  • Multi-language support: As mentioned, Cassandra supports many programming languages. This support is such that the program runs optimally. There are many people in the world who use Cassandra and this database is one of the most active open source projects.
  • Operational and developmental simplicity: Although all nodes in a cluster are the same, there is no complex software tier to manage, so government tasks are greatly simplified. In addition, Query Cassandra (CQL) looks and works just like SQL, making it very easy to migrate from any database to Cassandra.

NEO4J database

This database came in 2007. Neo4j is a Graph Database; That is, a graph is for storing entities and the relationships between them. Today, many companies in various industries, including financial services, energy, government, technology, stores, etc., use this database. Neo4j is written in Java and Scala programming languages, is open to the public and is available in NET, C ++, Ruby, Java, Python programming languages. And … supports.

Features of Neo4j

  • Flexible data model: Provides a simple yet robust data model that can be easily modified according to application.
  • Reliable: As volume increases, data coherence is maintained and speed is not reduced. It should be noted, however, that the Neo4j uses a machine to respond to the write request and also uses the duplication method to read, so it is best to use it when the write request is low and the read request is high.
  • Easy recovery: With Neo4j, not only can the record be displayed, but the data attached to it can be easily recovered for comparison. Therefore, using it, it is easy to display connected and semi-structured data.
  • Query Language: The Neo4j has a query language called Cypher to visualize charts using ASCII codes. Commands This language is highly readable and very easy to learn.
  • No need to join: Due to its graphical structure, there is no need for complex join to retrieve relevant information; Because it is very easy to retrieve the adjacent node or relationship details.