4 Architecting IoT Cloud
203
Key
“This is a a plain text string”
C
B
B
C
A
A
B
C
D
E
A: 0.1
B: 0.4
C:50
D:60
E:460
Key 1
Val 1
Key 2
Val 2
String
Linked list
Sets
Sorted sets
Hash
Fig. 4.21 An example of the Redis data model
• Transaction Property Support – Able to support atomicity, consistency, isolation,
and durability (ACID) transactions.
• Efficient Writing – Runs on low-cost commodity hardware and writes astonishingly quickly while storing hundreds of terabytes of data without slowing down
reading capability.
4.6.1.3 Redis
Redis, also known as REmote DIctionary Server, was created in 2009 as an inmemory, open-source key-value database. Redis is mainly used as a message broker
or as a cache layer for other databases. Redis is known as a unique option in the
key-value database arena because it can handle complex data types including (see
Fig. 4.21) [20]:
• Binary-safe strings: A Redis string is binary safe, meaning that it can contain
any kind of data (e.g., a JPEG image); however, its size should be maximum 512
megabytes.
• Lists: A list is a linked list of string elements meaning that it keeps the order of
data insertion.
• Sets: A set is a collection of unique, unsorted string elements/members.
• Sorted sets: It is very similar to sets; they are a non-repeating collection of strings.
However, in a sorted set, a numerical value (score) is assigned to each string
element. The elements are always taken sorted by their score. Note that while
members are unique, scores may be repeated. Sorted sets are a great means to
index data to be able to add, remove, update, or retrieve elements.
• Hashes: Hashes are a map between string fields and string value.
As an in-memory, database, it is guaranteed that all data is in memory resulting
in an incredible performance. Redis is also persistent on-disk database; however,
writing to disk is optional. Another advantage offered by Redis is that all operations
are atomic, guaranteeing that if clients access the database simultaneously, Redis
203
Key
“This is a a plain text string”
C
B
B
C
A
A
B
C
D
E
A: 0.1
B: 0.4
C:50
D:60
E:460
Key 1
Val 1
Key 2
Val 2
String
Linked list
Sets
Sorted sets
Hash
Fig. 4.21 An example of the Redis data model
• Transaction Property Support – Able to support atomicity, consistency, isolation,
and durability (ACID) transactions.
• Efficient Writing – Runs on low-cost commodity hardware and writes astonishingly quickly while storing hundreds of terabytes of data without slowing down
reading capability.
4.6.1.3 Redis
Redis, also known as REmote DIctionary Server, was created in 2009 as an inmemory, open-source key-value database. Redis is mainly used as a message broker
or as a cache layer for other databases. Redis is known as a unique option in the
key-value database arena because it can handle complex data types including (see
Fig. 4.21) [20]:
• Binary-safe strings: A Redis string is binary safe, meaning that it can contain
any kind of data (e.g., a JPEG image); however, its size should be maximum 512
megabytes.
• Lists: A list is a linked list of string elements meaning that it keeps the order of
data insertion.
• Sets: A set is a collection of unique, unsorted string elements/members.
• Sorted sets: It is very similar to sets; they are a non-repeating collection of strings.
However, in a sorted set, a numerical value (score) is assigned to each string
element. The elements are always taken sorted by their score. Note that while
members are unique, scores may be repeated. Sorted sets are a great means to
index data to be able to add, remove, update, or retrieve elements.
• Hashes: Hashes are a map between string fields and string value.
As an in-memory, database, it is guaranteed that all data is in memory resulting
in an incredible performance. Redis is also persistent on-disk database; however,
writing to disk is optional. Another advantage offered by Redis is that all operations
are atomic, guaranteeing that if clients access the database simultaneously, Redis
