Can Redis be used as a Primary database?

  Рет қаралды 51,742

Hussein Nasser

Hussein Nasser

Күн бұрын

Пікірлер: 102
@hnasr
@hnasr 3 жыл бұрын
Note regarding consistency @5:20: Redis also provides strict serializability(Strong consistency) through the RedisRaft project. RedisRaft has passed the Jepsen tests, an industry standard for verifying the consistency of distributed database systems. Read more on RedisRaft here redislabs.com/blog/redisraft-new-strong-consistency-deployment-option/
@zaheeruddinfaiz7064
@zaheeruddinfaiz7064 3 жыл бұрын
Hey Hussein! Can you make a video on Jepsen Tests, how are they conducted?
@abhinavporwal4766
@abhinavporwal4766 2 жыл бұрын
redis raft out yet ?
@nesaluj
@nesaluj 7 ай бұрын
Very nice collation and explaination of insights on Redis, thanks Hussein!
@Music_song_Musurmonov_Mehroj
@Music_song_Musurmonov_Mehroj 3 жыл бұрын
Cool stuff, Hussein. But, every time you talk about some technology, you always say that everyting has its costs. Every technology has pros and cons. But that time you only talked about pros. I think this video is more like advertisement rather than regular discussion. But anyway, thank you for amazing videos. It would be great if you make another video about drawbacks of using Redis as a primary database.
@Squawkize
@Squawkize 3 жыл бұрын
I wholeheartedly agree! Being sponsored might have a contribution to this. I know one disadvantage is that it’s all in memory thus your entire database must fit in memory.
@Pifagorass
@Pifagorass 3 жыл бұрын
@@Squawkize memory mapped files can store more data than RAM, but definitely may impact performance of the department. What's really missing is uniform queries with optimisations. But yes, agree, in most cases can replace main service store.
@rakeshsarangi5161
@rakeshsarangi5161 3 жыл бұрын
@@Pifagorass can you elaborate more on what do you mean by uniform queries with optimisations?
@ultiumlabs4899
@ultiumlabs4899 3 жыл бұрын
My guess, the drawback is the price. The same reason memory is split into: CPU L1 cache, CPU L2 cache, main memory, and hard disk. price vs performance reason.
@jaxongirrahimov7908
@jaxongirrahimov7908 2 жыл бұрын
Bobosher are you uzbek?
@randomexcuse
@randomexcuse 3 жыл бұрын
"Is Redis amazing?" proudly sponsored by Redis. Disclaimer: I use redis everyday and love it.
@shaswatkumar4078
@shaswatkumar4078 2 жыл бұрын
There is so much content for software engineering on you tube, but yours is on a very different level, it may sometimes have less likes but the knowledge level and quality is higher than any other content available online.
@MrYokyScape
@MrYokyScape 3 жыл бұрын
This video felt more like an ad than a discussion like your usual videos.
@cepuofficial9025
@cepuofficial9025 3 жыл бұрын
Good video Hussein but, you still need to be balanced and explaining the pros and cons. Benefit and price.
@awikwok212
@awikwok212 3 жыл бұрын
I almost mistaken this fireship video lol, but thanks Hussein!
@rajaraodv
@rajaraodv 3 жыл бұрын
Very high quality
@Squawkize
@Squawkize 3 жыл бұрын
I believe you can use Redis as a primary database BUT the circumstances depends on what you need. AOF and snapshot can persist data yea but you’re limited to the ram you have available (which can be expensive). Not only that but less frequently visited data should be in your hd/disk instead of memory since that’s a waste of precious ram being used up. It’s a lot cheaper storing it in hd/disk. Would be cool if Redis could store less frequently visited data to the hd/disk in exchange for some loss in speed and once it starts getting many accesses move the data from hd/disk to RAM when needed. Not sure if the loss in speed would be significant implementing this though.
@Pifagorass
@Pifagorass 3 жыл бұрын
How would you do joins, aggregations, and query optimisation?
@yegeunator
@yegeunator 3 жыл бұрын
Just what I needed... I was literally just searching for this...
@amitkumargoldy
@amitkumargoldy 3 жыл бұрын
Nice video. We recenly did have to use redis for some use cases as the primary source of data. It can work for simpler use cases but falls apart when it comes to slicing and dicing the data. Imagine replacing the "students" table in postgres with data in redis. Say each record contains students name, age, and city. You want to be able to fetch all students whose name starts with "xyz" AND are b/w 12-14 years of age AND live in Vancouver. You will basically end up using 4 different data structures and and a lot of overhead. Store age as a sorted set where weight is the age and the value could be the all student ids. Then store city in another Hash where key is the city and values could be ids. and so on. And then try to fetch all ids and do an intersection in memory and then look up the object with that id. Managing and extending such a system will be a nightmare. :D
@madmanX1314
@madmanX1314 3 жыл бұрын
I had a similar requirement once and I ended up keeping the data in memory of the application itself which was performing way better than using redis while still being maintainable.
@aneksingh4496
@aneksingh4496 2 жыл бұрын
Amazing amazing videos ....your content is very crisp and clear 👍👍 ... please keep on updating new videos ...
@__redacted__
@__redacted__ 3 жыл бұрын
Maybe three things to think about are 1) what's the literal cost of I/O in memory vs persisted storage on disk needed 2) what's the average and foreseeable max space needed and 3) what's the probability of memory going down or being corrupted vs disk, and what are you willing to tolerate before resorting to backups (or a secondary db)
@nat6106
@nat6106 3 жыл бұрын
Also important, the types. Redis doesn't have booleans for example, nor does it have support for geolocation pluggins like postgis with postgres
@sgkln
@sgkln 3 жыл бұрын
I use Redis as the only database for a toy project. I model relations as sets. (after all, the mathematical definition of a relation is expressed as a set, right?) It works and the performance is great. However, it's quite challenging to maintain data and indexes using only bare Redis' data structures (though possible with transactionned pipelines). I did it for fun, and it was. But, relying on SQL is much easier IMO! It's also possible to rely on "hexastore" with zsets to express any complex relations, however, I didn't need to for my app.
@PhilipAlexanderHassialis
@PhilipAlexanderHassialis 2 жыл бұрын
As soon as your data start conforming to a normalized or even semi-normalized form with standard data fields per set-kind / "entity", the argument for Redis as a primary DB goes out of the window. RDBMses are highly optimized for this kind of work and with the right kind of caching strategies and query optimizations, the "Redis as a primary DB" argument becomes laughable at best and punishable-by-flagellation at worst.
@yooscripts5947
@yooscripts5947 Жыл бұрын
Amazing in depth video ❤🎉
@siya.abc123
@siya.abc123 3 жыл бұрын
Dude Redis can even do geo stuff. Redis rocks!!!
@jeet987
@jeet987 Жыл бұрын
What about data loss? In memories have a huge danger of data loss in cloud
@glennedgar5057
@glennedgar5057 3 жыл бұрын
Redos makes a good light weight event broker for micro services. This is particularly true at the edge.
@mtnrabi
@mtnrabi 3 жыл бұрын
When discussing choosing a database, you often dont consider the query language capabilities . Different databases has different query languages to suit different needs. How come you ignore it so often?
@dawsdep
@dawsdep 3 жыл бұрын
Hussein, I'd be interested in hearing your thoughts on FaunDB and thank you for covering Redis as a primary database too
@lexiaontube
@lexiaontube 2 жыл бұрын
Very useful, Thanks !
@prakashreddy9546
@prakashreddy9546 3 жыл бұрын
Not recommended , if there is a lot of data , you end up paying lot of money for redis compared to other DB's
@sagarrout007
@sagarrout007 3 жыл бұрын
I didn’t know if redis can do so much…..but I felt like you’re the redis developer advocate 😀
@rednafi
@rednafi 3 жыл бұрын
Whether Redis can be used as the primary database or not depends on what you need from your primary database. Redis is already better than a few other NoSQL DBs and heck, even "Postgresql is a better Mongo than Mongo". However, if your persistence requires RDBMS, then Redis is not that good of an option and honestly, it doesn't need to be. Redis is already awesome and can be used as a Swiss army knife while building your next application. PS. People who're complaining about the "advertisy" tone of the video should just stop. How else do you think he'll be able to pay for stuff and keep producing quality content?
@neel3297
@neel3297 3 жыл бұрын
We used Redis a primary database for one high performant requirement
@nafasm
@nafasm 3 жыл бұрын
Thanks Nasser Hussein
@michaelbitzer7295
@michaelbitzer7295 3 жыл бұрын
Would be intresting to hear some thoughts on keydb
@ionelCristianLupu_
@ionelCristianLupu_ 3 жыл бұрын
What about relational data, cascading and foreign key checks? If we use Redis as a primary database, we will have to do all of these things in the Application level, right?
@luqmansen
@luqmansen 3 жыл бұрын
Yes you're correct, that's the price you have to pay for
@BHAVYAMATHURBEE
@BHAVYAMATHURBEE 3 жыл бұрын
Key-value NoSQL databases aren't suitable for joining in the first place. Usually the data is stored in a de-normalized fassion to prevent joining. In redis they can still be handled at the database level though with LUA scripts. So instead of clients manually doing join, they can call a pre-cached script in the server that does the joins for them.
@ionelCristianLupu_
@ionelCristianLupu_ 3 жыл бұрын
@@BHAVYAMATHURBEE How do you handle the case when a product name is changed for example? You need to update all the orders and change the product name for each one?
@rajaraodv
@rajaraodv 3 жыл бұрын
This is an age-old NoSQL vs SQL paradigm question and not really about whether Redis is a Primary DB or not. In NoSQL DBs (Redis, MongoDB, etc), you model things differently where you optimize for speed over normalization.of data. Here you may embed product name into all the orders so you don't need to do slow Joins for every read (i.e. in a denormalized form). So if you are reading the order details millions of times, you don't do millions of slow Joins. On the other hand, if at some point the product name changes, you run a script to update the product name in all orders. So you end up with millions of fast reads and a few slower updates and overall you come out ahead. BTW, there are multiple, well established patterns to handle these sorts of SQL versus NoSQL questions.
@luqmansen
@luqmansen 3 жыл бұрын
@@rajaraodv Yeah I also agree with this, you have to model your data differently
@Prakashsharma-eh8uq
@Prakashsharma-eh8uq 3 жыл бұрын
Although it has Primary Database features however it cannot be used for highly OLTP applications due to its serializable trx isolation level
@atulchahande4966
@atulchahande4966 3 жыл бұрын
the only down side is it doesn't have a query language.. which make a things much easy
@xfoxawy
@xfoxawy 3 жыл бұрын
Thanks!
@kapssul
@kapssul 3 жыл бұрын
Hussein, can you schedule a video about limitations and performance benchmarking concerning (in-memory db vs buffer pool) since in both paradigm the memory is involved..
@promatic-code
@promatic-code 3 жыл бұрын
I have seen redis as cache. Never thought of it as primarily database. Can it be horizontally scaled without downtime?
@thenaman047
@thenaman047 3 жыл бұрын
Short answer Yes.
@javilionaire
@javilionaire 3 жыл бұрын
Long answer: No.
@kevinshah_tv
@kevinshah_tv 3 жыл бұрын
Realistic answer: It depends. what is your current configuration? Redis offers something called as a "Redis Cluster" which is a piece of art (coming from someone who wanted to scale Postgres) but it is some work not every library supports its 100% and / or you have to use different methods to interact with it. Also, you have to add nodes in groups i.e. suppose you have 2 replicas per master, you need to add (horizontal scale) 3 nodes at a time (1 writer and 2 replica nodes).
@jocke8277
@jocke8277 3 жыл бұрын
Never used Redis but it sure looks interesting. Is it good for modelling relational data? What are the downsides to Redis compared to say Postgres?
@thenaman047
@thenaman047 3 жыл бұрын
You can say redis is a data structure driven database. For relational data, a lot of operations need to be performed based on the use case. Postgres and redis are very different for doing a direct comparison of features. Do a basic reading about redis, to get a good idea about it and think in this way "is it applicable in my application use case or not"
@kunalmahajan7142
@kunalmahajan7142 3 жыл бұрын
But since we know that redis is an in memory database which means all the data will stored inside the RAM itself. Don't you think the pricing for this will be way higher?
@xelaswitch
@xelaswitch 3 жыл бұрын
Redis can actually persist to disk. Visit their site and you will be surprised.
@octanebd
@octanebd Жыл бұрын
It was 2013 that I built a tiny in-memory database and query system with Javascript. I lost interest in its development in couple of weeks as it seemed to me of the concept lacking serious applications. ... It was certainly not a good decision.
@aadill77
@aadill77 2 жыл бұрын
6:25 I am confused if it should be availability concern or reliability concern when the write fails with both master and slave replication?
@pdpro
@pdpro 3 жыл бұрын
I used redis as cache, good to know it can be used as dB also. However, is there any configuration to use it as hot, cold or glacier type?
@ultiumlabs4899
@ultiumlabs4899 3 жыл бұрын
I think redis drawback is the price. The same reason memory is split into CPU L1 cache, CPU L2 cache, main memory, and hard disk, price vs performance reason. any thoughts?
@prakharvijay8853
@prakharvijay8853 3 жыл бұрын
Please make a crash course for using Redis as a primary database
@aries185
@aries185 3 жыл бұрын
Check out Redis University
@mtnrabi
@mtnrabi 3 жыл бұрын
Can you explain how Isolation differs from Concurrency Control? It seems to me like Concurrency Control is part of Isolation
@Music_song_Musurmonov_Mehroj
@Music_song_Musurmonov_Mehroj 3 жыл бұрын
Isolation levels are related to the transaction you're executing. It helps you to isolate values being used during transaction from ones in actual database. Concurrency control is related to the values in database.
@wilsonovasea
@wilsonovasea 3 жыл бұрын
Since Redis is executing queries in single thread, why we even need optimistic locking?
@AparnaBushan
@AparnaBushan Жыл бұрын
I have a question, when we say it supports isolation , then does having watch violate it ? If my understanding about watch is correct, then watch will watch if there is any there operation that is trying to update the value I am referring, it will notify and probably fail the transaction. So meaning one transaction is knowing about the other transaction. Can you clarify ?
@balu.92
@balu.92 3 жыл бұрын
So, will there be a RERN stack soon? 😁
@apusingh1967
@apusingh1967 2 жыл бұрын
in a multi master deployment, the purpose of which is to shard data, what if a master fails. Is there automatic failover to some replica?
3 жыл бұрын
Of course it can. But should we?
@allanwind295
@allanwind295 3 жыл бұрын
"If you are using Redis in a very write-heavy application, while saving an RDB file on disk or rewriting the AOF log Redis may use up to 2 times the memory normally used." This means you data set has to be smaller than 50% of memory if using RDB. Point in time restore? I believe is no, other than restoring truncated AOF files. The documentation has always been awesome.
@rahuldeepattri9244
@rahuldeepattri9244 3 жыл бұрын
Didn't felt like your honest opinion..More like an advertisement.
@nikhilsrivastava9120
@nikhilsrivastava9120 3 жыл бұрын
why is a cache considered costly compared to a primary database? if we store everything on redis, wouldn't the COGS overshoot?
@MohammodnazmuSakiB
@MohammodnazmuSakiB 3 жыл бұрын
Redis is very feature rich, but that comes with a hight cost.
@kaushikraina8138
@kaushikraina8138 3 жыл бұрын
Great video man. Keep making epic stuff Will appreciate if you can change 'master slave' to 'active passive' terminology
@nicolabelli6928
@nicolabelli6928 3 жыл бұрын
Good content as always Hussein! You do not mention query fetures which are a key feature for a DB. For example how can I store a list of people in Redis and get only the people with age >18, I am supposed to get all keys of readis and cycle trough them in my application in order to filter them? How about paginating the results?
@peresypkin
@peresypkin 3 жыл бұрын
It is possible by means of sorted sets. Considering your example, you could add the records to a sorted set using the ZADD command redis.io/commands/zadd, where the score is the age and the member is the person ID, and then you could select a range utilising the ZRANGE command redis.io/commands/zrange. It basically means that you create indexes manually in Redis.
@thenaman047
@thenaman047 3 жыл бұрын
Redis is not your typical database, one needs to understand it's data structures and design their solutions around them.
@mohanraj-kr9xg
@mohanraj-kr9xg 3 жыл бұрын
Hey Hussain what is your thoughts on GitHub copilat?
@phamnhuthai6847
@phamnhuthai6847 3 жыл бұрын
I built an inventory system with redis as primary database. It require a lot of skills and logic in programming. The first build, i have to delete whole database logic and start again. You should very well in reading document and take time think about it before coding
@ikemeneke
@ikemeneke 2 жыл бұрын
Pls I need guidance. I want to build system with redis as primary database
@phamnhuthai6847
@phamnhuthai6847 2 жыл бұрын
@@ikemeneke just start with simple online retail store website. You will learn a lot while building it.
@burabura3861
@burabura3861 3 жыл бұрын
Great video Hussein. Thanks a lot. I just have one question though mate. At 4:25, there is just one word that my colleagues (Japan) can't make out. "The ?????? that you write ..... " What is the ?????? word? Please let me know, if you have the time. Thanks so much.
@roshanthapa25
@roshanthapa25 2 жыл бұрын
power?
@rishabhanand4270
@rishabhanand4270 3 жыл бұрын
High Quality.
@samchitgopekar8530
@samchitgopekar8530 3 жыл бұрын
A primary database... that costs an arm and a leg
@mrcrazyenough007
@mrcrazyenough007 3 жыл бұрын
a new camera tech eh?
@_prothegee
@_prothegee 3 жыл бұрын
Looks more sharper, right
@rajeevsingh758
@rajeevsingh758 3 жыл бұрын
I think Redis team has gave you a script and you aren't allowed to say beyond that script. Any way nice video. Video title can be change to All Pros of a Redis in 12 minutes.
@martiruda
@martiruda 2 жыл бұрын
I work with in memory data models built in MSSQL and I have an amazing T-SQL experience thus far & only having tiny hiccups around querying data from external databases and combining datasets with the in memory tables. Can anyone recommend a good t-sql client for Redis?
@zetadoop8910
@zetadoop8910 3 жыл бұрын
How does keydb compare to redis? It has master + master + slaves configure option. I can write in Master1 and if it fails then I will write Master2. Will keydb sponsor next video?
@md.fazlulkarim8847
@md.fazlulkarim8847 3 жыл бұрын
A few carefully written atomic Lua scripts is all we need to replicate all the most needed regular database features!
@esraaabdelaziz485
@esraaabdelaziz485 3 жыл бұрын
I don't think that redis can be used as a primary database cuz redis works at the rams what if the server is down would my data be lost, how even i can maintain my data if the server is down ?? I don't think that redis data persistence techniques is enough and I can't take a snapshot of the data every second
@ganeshdeshmukh8020
@ganeshdeshmukh8020 3 жыл бұрын
Ans: Yes, if it makes easy to do cache-invalidation. :) love you Hussain sir.
@rafaelmatsumoto
@rafaelmatsumoto 2 жыл бұрын
The answer is probably yes, but that depends on how much are you willing to pay
@missingfaktor
@missingfaktor 2 жыл бұрын
Does ElastiCache-managed Redis support all the features discussed in this video?
@jacocoetzee762
@jacocoetzee762 3 жыл бұрын
Dude great video with awe info. Let’s make it last longer by not talking about master & slave. It’s 2021.
@ElijahLynn
@ElijahLynn 3 жыл бұрын
Thanks!
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 18 МЛН
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
I've been using Redis wrong this whole time...
20:53
Dreams of Code
Рет қаралды 370 М.
What Happens When Redis Runs Out of Memory
14:03
Redis
Рет қаралды 20 М.
Understanding Redis Persistence - AOF & RDB + Docker
19:42
Coding with Raphael De Lio
Рет қаралды 7 М.
Redis Basics: Strings, Hashes, Lists, Pub/Sub
15:42
Engineer Man
Рет қаралды 36 М.
When should you shard your database?
21:20
Hussein Nasser
Рет қаралды 79 М.
Event-Driven Architecture (EDA) vs Request/Response (RR)
12:00
Confluent
Рет қаралды 171 М.
Understanding Redis Streams
15:59
Coding with Raphael De Lio
Рет қаралды 9 М.
What is Redis and What Does It Do?
6:47
CBT Nuggets
Рет қаралды 267 М.