Post

Redis Nedir ? - Redis Hakkında

Redis; is one of the most used and known NoSQL databases by developers. Redis is open source and its source codes are available on GitHub. It gives high performance results because it is written in C language. It is supported by Linux and derivative operating systems, but is supported by the community, although there is no official support for the Windows side.

Redis is the most used key-value database in today's systems and is generally used for caching, session management, pub/sub, message broker.

  • It is an abbreviation for Remote Dictionary Service.
  • Written in C language.
  • The starting point is "speed".
  • It has the feature of being a NoSQL database designed as “Key : value”.
  • It has -In memory Database approach. Optionally, it also has the ability to be written on the disc. (It happens automatically)
  • It is an advanced key-value store.
  • It is not an alternative to Relational Database or Document-based Database systems.
  • If you are using databases such as MySQL, PostgreSQL, it would not be the right approach if you say to use Redis instead of these databases. On the contrary, it can be used as a middleware to define the relationships of these DB types.
  • Best use for structures with rapidly growing data with predictable DB size.

What Data Types Does It Support?

-String
-Hash
-list
-Set
-Sorted Set
-Geospatial Index
-HyperLogLog can store data types in it.

What are the Usage Areas?

-Can be used as a database.
-It can write the stored data on the disk with its Persist capability.
-Caching Layer is widely used.
-It's very fast.
-Message Broker
-It doesn't just work as a key-value store. It can also be used as a message broker like RabbitMQ.

Use Case:

It can be used in cache mechanisms.
It can be used where the Publish/Subscribe model can be applied.
For example, the user publishes a message (pub) that goes to all followers (sub).
-In the blocking and delaying of queues.
-In short live data
-Fraud detection (Fraud detection)
-In session controls
-Filtering services
-Comment counts
It is very fast in listing the products on a site like Amazon, and in viewing the comments made on these products.

-By keeping a copy of the database on redis, operations can be performed quickly without tiring the database.
-In analysis of real data

-Each time a unique data is stored.

When should we use it?

-When very high speed is needed
When you need more than -key-value pair
-Where dataset is not critical.
-It works as (in memory) by default.

-If the disk write feature is not active, the data will be deleted when the server is shut down.

What to Consider When Using?

-Data is stored on memory, so there are a lot of memory constraints.
-An empty instance uses 1Mb of memory. (When a client is created in Rediste, it takes up 1MB of memory.)
-1 Million small key-value (string) pairs use 100Mb of memory.
-1 Million small key-value pairs (hash consisting of 5 fields) use 200Mb of memory.

Performance?

Since Redis does not work synchronously, the data is processed one by one. It processes 80,000 requests at less than 1msec (milliseconds). If we activate the Redis pipelined feature, it will gain incredible speed. When the Pipeline feature is activated, it does all the work collectively. The number of transactions made under 1 msec (milliseconds) increases up to 250,000.

The picture shows the number of processes and times of different applications.

Scaling?

-Persistence: Redis provides two different mechanisms for persistence.
-RDB (Redis Database Snapshot): It takes an exact copy of the database.
-AOF (Append Only Files): It offers us the feature of adding only to the file.
-Replication
-One redis instance comes as master and other instances comes as slave.
-Instances that come as slaves are copies of the master instance.
-Client connects to one of the slave or master instances.
-Slave only reads by default.
-Partitioning: We can divide and share data.
-Failover: Undesirable situations may occur in network flows and may cause interruptions. It is the mechanism that specifies how to behave in such situations.
-Manual
-Automatic: Redis Sentiel – for master-slave(replication) topology
-Auto: Redis Cluster – for cluster(partitioning) topology

Which companies use Redis today?

-Twitter
-Github
-Pinterest
-StackOverFlow
-Snapchat

This post is licensed under CC BY 4.0 by the author.