Redis Stack for Application Modernization - Luigi Fugaro - E-Book

Redis Stack for Application Modernization E-Book

Luigi Fugaro

0,0
26,99 €

oder
-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

In modern applications, efficiency in both operational and analytical aspects is paramount, demanding predictable performance across varied workloads. This book introduces you to Redis Stack, an extension of Redis and guides you through its broad data modeling capabilities. With practical examples of real-time queries and searches, you’ll explore Redis Stack’s new approach to providing a rich data modeling experience all within the same database server.
You’ll learn how to model and search your data in the JSON and hash data types and work with features such as vector similarity search, which adds semantic search capabilities to your applications to search for similar texts, images, or audio files. The book also shows you how to use the probabilistic Bloom filters to efficiently resolve recurrent big data problems. As you uncover the strengths of Redis Stack as a data platform, you’ll explore use cases for managing database events and leveraging introduce stream processing features. Finally, you’ll see how Redis Stack seamlessly integrates into microservices architectures, completing the picture.
By the end of this book, you’ll be equipped with best practices for administering and managing the server, ensuring scalability, high availability, data integrity, stored functions, and more.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Veröffentlichungsjahr: 2023

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Redis Stack for Application Modernization

Build real-time multi-model applications at any scale with Redis

Luigi Fugaro

Mirko Ortensi

Redis Stack for Application Modernization

Copyright © 2023 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Kaustubh Manglurkar

Publishing Product Manager: Heramb Bhavsar

Book Project Manager: Kirti Pisat

Content Development Editor: Manikandan Kurup

Technical Editor: Kavyashree K S

Copy Editor: Safis Editing

Proofreader: Safis Editing

Indexer: Rekha Nair

Production Designer: Alishon Mendonca

Senior DevRel Marketing Coordinator: Nivedita Singh

First published: December 2023

Production reference: 1151223

Published by Packt Publishing Ltd.

Grosvenor House

11 St Paul’s Square

Birmingham

B3 1RB, UK.

ISBN 978-1-83763-818-5

www.packtpub.com

Dedications are always tough. To mention or not to mention your beloved ones is the real dilemma. Unfortunately, this year I lost a special person in my life, so I decided to dedicate this book to him – Grazie Oscarino.

– Luigi Fugaro

Dedicated to Angela, my remarkable 101-year-old grandmother. Your enduring patience, infectious good humor, melodious singing voice, and quiet resilience have imparted invaluable life lessons. This book is a tribute to you.

– Mirko Ortensi

Contributors

About the authors

Luigi Fugaro’s computer science career began with a fascination for video games on the Vic 20 and Atari ST1040, where he enjoyed manipulating game code. This interest sparked his journey into programming, leading to a varied career in mastering numerous languages, including Fortran, Java, Go, Delphi, Visual Basic, and Python. While he is ambivalent about JavaScript and doesn’t consider HTML a programming language, he appreciates its utility.

Luigi’s career expanded into observability, monitoring, and data management, with significant experiences at Red Hat and Redis, where he understood the importance of application performance. Despite many side projects, most unfinished, Luigi’s notable contributions to literature reflect his enduring passion and drive for technology and innovation in computer science.

In the journey of crafting a book, a myriad of dynamics come into play, mirroring the numerous individuals who grace our daily lives. This holds particularly true for my family, including my children, Giada, Filippo, and Viola. I’ve borrowed time from them – moments that I couldn’t spend by their side. Yet, they are the spark that kindles my hope and fuels my drive to be better. For this gift, my gratitude and love for them knows no bounds.

Mirko Ortensi wrote his first lines of code on a Commodore 64 in Basic when he was 10. It was love at first sight. Eventually, he earned a degree in electronic engineering and a master’s degree in software engineering at Università Politecnica delle Marche in Italy in 2002, with a thesis about pattern recognition at UPC in Barcelona, Spain. Mirko’s career has spanned several roles in software and services businesses, encompassing development and testing, system management, and support, mainly centered around databases and distributed systems. As a senior technical enablement architect at Redis, Mirko shares technical knowledge about Redis’s products, services, and features.

I extend heartfelt thanks to my incredible family – my loving wife, children, and Gizmo the cat – for their unwavering patience and support during the countless hours I disappeared into the world of writing and coding. Your understanding and encouragement were my pillars throughout this journey.

Luigi and Mirko express their deep gratitude to everyone at Redis who contributed to this book. They extend special thanks to Alexandre Vasseur, David Maier, Tal Shkolnik, Raffaele Landoni, Cody Henshaw, Myra El-Bayoumi, Claudia Di Martino, and all the contributors to Redis open source. Additionally, they thank Packt for believing in this project, particularly Heramb Bhavsar, Kirti Pisat, and Manikandan Kurup for their support throughout Luigi and Mirko’s journey.

About the reviewer

Sumit Shatwara, a solution architect, brings a wealth of expertise from his previous role at Redis, the global leader in real-time data platforms. At Redis, Sumit led the charge in designing and building cutting-edge, real-time data solutions, driving technology sales, and serving as a trusted advisor to enterprise clients within the banking, financial services, and digital native sectors. Sumit’s extensive career spans experiences with renowned companies such as Red Hat, NetApp, and Capgemini, where he facilitated the adoption of cloud-native technologies for numerous clients. Sumit’s future aspirations include becoming an artificial intelligence specialist and ultimately establishing himself as a thought leader in the realms of data and AI.

Table of Contents

Preface

Part 1: Introduction to Redis Stack

1

Introducing Redis Stack

Technical requirements

Exploring the history of Redis

The open source project

From key-value to multi-model real-time databases

Primary key lookup

Secondary key lookup

Pipelining

Using functions

Using indexes

Redis Stack capabilities

So, what is Redis Stack?

Redis Stack deployment types

Summary

2

Developing Modern Use Cases with Redis Stack

Technical requirements

Caching, rate-limiting, geo-positioning, and other Redis traditional use cases

Caching

Session store

Rate limiter

Leaderboards

Data deduplication

Geo-positioning

Message processing and delivery

Going beyond the real-time cache with Redis Stack

Querying, indexing, and search

Monitoring and analysis

Fraud detection

Feature store for machine learning

Designing microservice architectures with Redis Stack

API gateway

Summary

3

Getting Started with Redis Stack

Installing Redis Stack using binary packages

Installing Redis Stack using native packages

macOS-native package

Linux-native package

Running Redis Stack using Docker

Using Redis Cloud

Installing RedisInsight

Installing the Redis Stack client libraries

Java client library

JavaScript client library

Python client library

Golang client library

C#/.NET client library

Running health checks

Summary

4

Setting Up Client Libraries

Technical requirements

Redis Stack client libraries

Programming in Python using redis-py

Storing information in Redis Stack using Python

Redis OM for Python

Programming in Java using Jedis

Storing information in Redis Stack using Java

Redis OM for Java

Programming in JavaScript using node-redis

Redis OM for JavaScript

Programming in Go using go-redis

Storing information in Redis Stack using Go

Programming in C#/.NET using NRedisStack

Storing information in Redis Stack using C#/.NET

Redis OM for C#/.NET

Summary

Part 2: Data Modeling

5

Redis Stack as a Document Store

Technical requirements

Storing and querying documents in Redis Stack

The dialect and other configuration parameters

The query language

Simple terms

Using field modifiers

Intersection of results (AND)

Union of results (OR)

Exact query matches

Stop words

Negation and purely negative queries

Prefix, infix, and suffix queries

Wildcard matching

Fuzzy matching

Numeric filters

Tag filters

Geospatial filters

Aggregation and transformation

Cursor-based requests

Faceted search using aggregations

Updating an index in production

Temporary indexes

Additional commands

Working with Hashes

Highlighting and summarizing

Synonyms support

Spellchecking

Auto-completion

Phonetic matching

Working with JSON

The JSONPath syntax

Indexing a JSON document

Indexing arrays and objects

Multi-value indexing

Extracting partial data from JSON documents

Redis Stack as a recommendation engine

Recommendation using scores

Redis Stack as a session store

Redis data structures for session data

Additional Redis data structures

Modeling key-value pairs

Modeling objects

Modeling collections

Session management for real-time applications

Summary

6

Redis Stack as a Vector Database

Technical requirements

Vector embeddings for unstructured data modeling

Storing the embeddings

Hashes

JSON

Indexing the embeddings

The algorithms – FLAT and HNSW

Type

Index dimension

Distance metrics

Performing similarity search

Performing hybrid queries

Performing VSS range queries

Recommendations based on visual search

Integrating Redis with generative AI

Summary

7

Redis Stack as a Time Series Database

Technical requirements

Why Redis Stack for Time Series?

Working with time series

Adding labels to data points

Aggregation framework

Compaction rules for Time Series

Summary

8

Understanding Probabilistic Data Structures

Technical requirements

HyperLogLog

Bloom filter

Cuckoo filters

Count-Min sketch

Top-K

t-digest

Summary

Part 3: From Development to Production

9

The Programmability of Redis Stack

Technical requirements

The single-threaded architecture

Programming complex business logic with Redis Stack

Lua scripting

Redis functions

Triggers and functions

Anatomy of a function

Working with data

Batch processing

Asynchronous functions

Cluster awareness

Keyspace triggers

Stream triggers

Comparing Lua scripts, Lua functions, and JavaScript functions

Summary

10

RedisInsight – the Data Management GUI

Technical requirements

Connecting to the Redis Stack database

Browsing keys

Interacting with data

Analyzing data

Troubleshooting PubSub channels

Summary

11

Using Redis Stack as a Primary Database

Technical requirements

What is a primary database?

Redis as a primary database

The BASE and ACID properties

The BASE properties

The ACID properties

Configuring Redis for durability, consistency, and availability

Configuring snapshots

Configuring AOF

Configuring high availability

Configuring consistency

Summary

12

Managing Development and Production Environments

Technical requirements

Redis Stack as a development environment

HA

Scalability

Security

Limitations

Preparing for production with Redis Enterprise

Redis Enterprise architecture

A multi-tenancy architecture

HA

Horizontal and vertical scalability and dynamic auto-tiering

Security hardening

Observability and monitoring

Redis Cloud – an enterprise-ready Redis DBaaS

Summary

Index

Other Books You May Enjoy

Part 1: Introduction to Redis Stack

Redis Stack combines the core features of Redis with its most successful capabilities, offering a comprehensive understanding of Redis fundamentals and advanced functionalities. It distinguishes itself from Redis by its modular architecture, expanding its capabilities to serve as a document store, vector database, and time-series database. Redis Stack is versatile, functioning as an in-memory real-time cache, session store, leaderboard storage, and message broker. Its probabilistic data types enhance problem-solving efficiency, positioning it as a modern alternative to traditional relational databases for various applications.

The installation of Redis Stack is straightforward across popular operating systems such as Linux, macOS, and Windows, with native packages and Docker images available. To support developers, Redis Stack includes client libraries for major programming languages such as Python, Go, C#, Java, and JavaScript, along with the Redis OM framework for object mapping. This makes Redis Stack a user-friendly and adaptable solution for real-time data processing and management needs.

This part contains the following chapters:

Chapter 1, Introducing Redis StackChapter 2, Developing Modern Use Cases with Redis StackChapter 3, Getting Started with Redis StackChapter 4, Setting Up Client Libraries