Simple question, could I conceivably use redis instead of mysql for all sorts of web applications: social networks, geo-location services etc?
Redis has limited ability to create relationships between data objects — it's not a replacement for a relational (e.g. MySQL) or document-based (e.g. MongoDB) database.
But the most important difference we'll discuss is the type of database. As we know, MySQL is a relational database. With Redis being a NoSQL database, it instead is a Key-Value Store. In a Key-Value database, data is stored like a JSON object.
Redis is a type of database that's commonly referred to as No SQL or non-relational . In Redis, there are no tables, and there's no database-defined or -enforced way of relating data in Redis with other data in Redis.
As you can see from the graphs above, using Redis to store and query the quota for each HTTP request, instead of doing it in the DB is a lot quicker, in fact, on average, over the 5 runs of each script that we did we saw a 51.4% reduction in both the whole process to complete and the time to store each record into the ...
Nothing is impossible in IT. But some things might get extremely complicated.
Using key-value storage for things like full-text search might be extremely painfull.
Also, as far as I see, it lack support for large, clustered databases: so on MySQL you have no problems if you grow over 100s of Gb in Database, and on Redis... Well, it will require more effort :-)
So use it for what it was developed for, storing simple things which just need to be retreived by id.
ACID compliance is a must, if data integrity is important. Medical records and financial transactions would be an example. Most of the NoSQL solutions, including Redis, are fast because they trade ACID properties for speed.
Sometimes data is simply more convenient to represent using a relational database and the queries are simpler.
Also, thanks to foreign relationships and constraints in relational databases, your data is more likely to be correct. Keeping data in sync in NoSQL solutions is more difficult.
So, no I don't think we can talk about full replacement. They are different tools for different jobs. I wouldn't trade my hammer for a screwdriver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With