Valkey 101 - SCaLE 22x March 2025 Stokes.pdf

davidmstokes 53 views 14 slides Mar 04, 2025
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

An Introduction to Valkey, Presented March 2025 at the Southern California Linux Expo, Pasadena CA. Valkey is a replacement for Redis and is a very fast in memory database, used to caches and other low latency applications. Valkey is open-source software and very fast.


Slide Content

Valkey 101
A Superfast
in-memory database
Dave Stokes
@Stoker
[email protected]
1

Nobody was talking about Valkey!
2

Original author(s): Salvatore Sanfilippo
Developer(s): Linux Foundation
Initial release: March 28, 2024; 10 months ago
Stable release: 8.0.2 January 7, 2025; 28 days ago
Repository: github.com/valkey-io/valkey
Written in C
Operating system Unix-like
Available in English
Type: Data structure store, key–value database
License BSD license
Website valkey.io
Valkey
3

What Is Valkey?
Valkey is an open-source in-memory storage, used as a distributed, in-memory
key–value database, cache and message broker, with optional durability.
Because it holds all data in memory and because of its design, Valkey offers
low-latency reads and writes, making it particularly suitable for use cases that
require a cache. Valkey is a successor to Redis, the most popular NoSQL
database, and one of the most popular databases overall. Valkey or its
predecessor Redis are used in companies like Twitter, Airbnb, Tinder, Yahoo,
Adobe, Hulu, Amazon, and OpenAI. -https://en.wikipedia.org/wiki/Valkey
4

5
The predecessor Redis was developed and maintained by Salvatore Sanfilippo, starting in 2009. From 2015 until 2020,
he led a project core team sponsored by Redis Labs.
In 2018, Redis Ltd., the company managing Redis development, licensed some modules under the proprietary SSPL.
In 2024, the Redis company switched the licensing for the Redis core code repository from the BSD license to
proprietary licenses.

This prompted a large portion of the user and developer community, led by the Linux Foundation, to fork the
code under the new name Valkey, retaining the BSD license, Valkey's candidates for release 8.0, five months after
the fork, improved its threading and significantly improved its performance.
Why Valkey?

Valkey Uses
Valkey may be seen ‘generally’ as a
replacement for Memcache or Redis.
It Supports many different data types and
can represent complex data structures
easily.
Valkey is in-memory but persists the data
on disk.
Use as a fast in-memory key-value
database
01
Use as a LRU cache for another
database, MySQL or PostgreSQL
02
Use as a message queue
03
Use as a distributed lock manager
04
6

7
$ sudo apt install -y valkey
[sudo] password for stoker:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'valkey-server' instead of 'valkey'
The following additional packages will be installed:
libjemalloc2 liblzf1 valkey-tools
Suggested packages:
ruby-redis
The following NEW packages will be installed:
libjemalloc2 liblzf1 valkey-server valkey-tools
0 upgraded, 4 newly installed, 0 to remove and 7 not upgraded.
Need to get 1,581 kB of archives.
After this operation, 7,946 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu noble/universe amd64 libjemalloc2 amd64 5.3.0-2build1 [256 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu noble/universe amd64 liblzf1 amd64 3.6-4 [7,624 B]
Get:3 http://us.archive.ubuntu.com/ubuntu noble-updates/universe amd64 valkey-tools amd64 7.2.7+dfsg1-0ubuntu0.24.04.1 [1,268 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu noble-updates/universe amd64 valkey-server amd64 7.2.7+dfsg1-0ubuntu0.24.04.1 [49.2 kB]
Fetched 1,581 kB in 1s (2,201 kB/s)
Selecting previously unselected package libjemalloc2:amd64.
(Reading database ... 205877 files and directories currently installed.)
Preparing to unpack .../libjemalloc2_5.3.0-2build1_amd64.deb ...
Unpacking libjemalloc2:amd64 (5.3.0-2build1) ...
Selecting previously unselected package liblzf1:amd64.
Preparing to unpack .../liblzf1_3.6-4_amd64.deb ...
Unpacking liblzf1:amd64 (3.6-4) ...
Selecting previously unselected package valkey-tools.
Preparing to unpack .../valkey-tools_7.2.7+dfsg1-0ubuntu0.24.04.1_amd64.deb ...
Unpacking valkey-tools (7.2.7+dfsg1-0ubuntu0.24.04.1) ...
Selecting previously unselected package valkey-server.
Preparing to unpack .../valkey-server_7.2.7+dfsg1-0ubuntu0.24.04.1_amd64.deb ...
Unpacking valkey-server (7.2.7+dfsg1-0ubuntu0.24.04.1) ...
Setting up libjemalloc2:amd64 (5.3.0-2build1) ...
Setting up liblzf1:amd64 (3.6-4) ...
Setting up valkey-tools (7.2.7+dfsg1-0ubuntu0.24.04.1) ...
Setting up valkey-server (7.2.7+dfsg1-0ubuntu0.24.04.1) ...
Created symlink /etc/systemd/system/valkey.service → /usr/lib/systemd/system/val
key-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/valkey-server.servic
e → /usr/lib/systemd/system/valkey-server.service.
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.3) ...
$
Easy to install
Available in tarball, apt,
rpm,and apk

$ valkey-cli ping
PONG
$
Does it work?
$ valkey-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
Using the cli interactively
8

9
127.0.0.1:6379> set myvalue "001"
OK
127.0.0.1:6379> get myvalue
"001"
127.0.0.1:6379>
Simple set & get

10
Write a value that expires after 60 seconds
127.0.0.1:6379> set willexpire "002" EX 60
OK
127.0.0.1:6379> get willexpire
"002"
< wait one minute >
127.0.0.1:6379> get willexpire
(nil)
127.0.0.1:6379>

11
Support for popular programming languages
$ python3
Python 3.12.3 (main, Jan 17 2025, 18:03:48) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import valkey
>>> r = valkey.Valkey()
>>> r.ping()
True
>>> r.set("foo","bar")
True
>>> r.get("foo")
b'bar'
>>>

Where to get more information
Valkey.io
Valkey.io
github.com/valkey-io/valkey valkey-oss-developer.slack.com
12

THANK YOU!
Dave Stokes
Actively Seeking Employment!
https://stokerpostgresql.blogspot.com/
@Stoker
[email protected]
13
linkedin.com/in/davidmstokes/

Resource Page
14