Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Valkey 101 - Southern California Linux Expo (SC...

Valkey 101 - Southern California Linux Expo (SCaLE) 22x

VALKEY 101 - A Superfast in-memory database

Dave Stokes
Audience: Developer
Topic: OpenInfra Days

VALKEY is a superfast in-memory distributed database with clustering, redundancy, and low latency. If you need a cache, then you need to look at VALKEY. The VALKEY project started when REDIS changed from an open-source license to extort money from its community. VALKEY is a much-improved fork of REDIS, and the Linux Foundation supports the project. AWS, Microsoft, and others have contributed significantly to this success.

This session briefly covers the fork's 'why,' explores some exciting new features, and shows you how to start with VALKEY.

Room:
Room 106
Time:
Friday, March 7, 2025 - 13:30 to 14:00

David Stokes

March 07, 2025
Tweet

More Decks by David Stokes

Other Decks in Programming

Transcript

  1. Valkey 101 Valkey 101 A Superfast A Superfast in-memory database

    in-memory database Dave Stokes Dave Stokes @Stoker @Stoker [email protected] [email protected] 1 speakerdeck.com/Stoker speakerdeck.com/Stoker speakerdeck.com/Stoker
  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
  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
  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?
  5. 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
  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
  7. $ 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
  8. 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>
  9. 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' >>>