2 Haziran 2021 Çarşamba

Redis Transaction

Giriş
Açıklaması şöyle
The concept of transaction in Redis is very different from its counterpart in traditional RDBMS. A client can submit an operations sequence to a Redis server as a transaction. The Redis server will guarantee the sequence is executed as an atomic unit without changing context to serve other requests, until the transaction is finished. However, unlike an RDBMS, if one of the steps in the sequence fails, Redis will not roll back the entire transaction. 
...
Furthermore, a Redis cluster can only support transactions if the sequence of operations works on data structures in the same shard.
Açıklaması şöyle.
Redis offers two mechanisms for handling transactions – MULTI/EXEC based transactions and Lua scripts evaluation. Redis Lua scripting is the recommended approach and is fairly popular in usage.
MULTI ve EXEC
Kullanılan komutlar şöyle
MULTI - begin transaction
EXEC - commit transaction
DISCARD - rollback transaction
WATCH - prevent committing the current transaction if some keys are changed outside the current transaction
UNWATCH - cancel the watching process on the related key
Örnek
Şöyle yaparız
> MULTI
OK
> INCR foo
QUEUED
> INCR bar
QUEUED
> EXEC
1) (integer) 1
2) (integer) 1
OLAP
Açıklaması şöyle
Both Redis and Tarantool are poorly tailored for OLAP tasks. Online Analytical Processing deals with historic or archive data. OLAP has relatively few transactions, queries are often complex and contain aggregation.

In both cases, data is stored line-by-line. This makes aggregation algorithms less effective as compared to column-oriented databases.

Redis and Tarantool use one-thread for data which makes parallelizing analytical queries impossible.

Hiç yorum yok:

Yorum Gönder