E
E
Eugenue Cesarevich2021-02-12 21:27:10
Java
Eugenue Cesarevich, 2021-02-12 21:27:10

Why is Redis recommended for Spring Session?

I have a Spring MVC application with a PostgreSQL database. I want to connect Spring Session in order to make my application stateless. Very many sources mention REDIS as a database for storing sessions. However, here I also found a JDBC connection option. In this case, as far as I understand, my database (PostgreSQL in my case) will be used to store sessions .

Several questions arose:

  1. Why is Redis so popular for session storage? Why is it better than MySQL or PostgreSQL?
  2. If I want to simultaneously save my objects in PostgreSQL, and sessions in Redis, then Spring will not swear at this? Will I need additional settings, like the one described here ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Shatokhin, 2021-02-13
@Sovigod

Redis is more popular for this sort of thing - it's faster than MySQL or PostgreSQL.
The range of problems that can be solved using radish is quite small, but almost always it will be a quick and easy solution.

I
Igor Cherny, 2021-02-13
@freeg0r

How can Redis compare to MySQL or PostgreSQL? They are completely different products with different purposes.
Not only is Redis a key-value database, while MySQL and PostgreSQL are RDBMS, but Redis is an in-memory database. That is, they are completely different things used for different purposes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question