Reader small image

You're reading from  Redis Stack for Application Modernization

Product typeBook
Published inDec 2023
PublisherPackt
ISBN-139781837638185
Edition1st Edition
Right arrow
Authors (2):
Luigi Fugaro
Luigi Fugaro
author image
Luigi Fugaro

Luigi Fugaro's first encounter with computers was in the early 80s when he was a kid. He started with a Commodore Vic-20, passing through a Sinclair, a Commodore 64, and an Atari ST 1040, where he spent days and nights giving breath mints to Otis. In 1998, he started his career as a webmaster doing HTML, JavaScript, Applets, and some graphics with Paint Shop Pro. He then switched to Delphi, Visual Basic, and then started working on Java projects. He has been developing all kinds of web applications, dealing with backend and frontend frameworks. In 2012, he started working for Red Hat and is now an architect in the EMEA Middleware team. He has authored WildFly Cookbook and Mastering JBoss Enterprise Application Platform 7 by Packt Publishing.
Read more about Luigi Fugaro

Mirko Ortensi
Mirko Ortensi
author image
Mirko Ortensi

Mirko Ortensi earned a degree in Electronic Engineering and a Master's degree in Software Engineering. Mirko's career has spanned several roles from Software Engineering to Customer Support, particularly centered around distributed database systems. As a Senior Technical Enablement Architect at Redis, Mirko shares technical knowledge about Redis's products and services.
Read more about Mirko Ortensi

View More author details
Right arrow

Developing Modern Use Cases with Redis Stack

Redis Stack can be used in many different scenarios. While Redis is traditionally used as an in-memory real-time cache and as a session store, or it can be used to store leaderboards or act as a message broker using different core data structures, Redis Stack extends Redis’s well-known features, thus becoming a flexible solution to many emerging problems. In this chapter, we will present an overview of the traditional use cases so that you will find solutions to classical problems. We will focus on the new use cases that are possible using Redis Stack’s multi-model capabilities.

In this chapter, you will learn how Redis Stack can prevent denial-of-service (DoS) attacks or spot attempts of fraud, thus helping secure the stability of an application and the confidentiality of data. You will also discover how to track the nearest available bikes of the urban bike-sharing service and how to efficiently count all the user authentications...

Technical requirements

To follow along with the examples in the chapter, you will need to install Redis Stack Server 7.2 or a later version on your development environment. Alternatively, you can create a free Redis Cloud subscription to get a free plan and use a managed Redis Stack database.

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

Implementing the many use cases that companies demand from their technical staff requires a technological stack and a competence development plan to sustain the efforts of designing, implementing, testing, and maintaining a solution. Evaluating and benchmarking the different options is time-consuming, and introducing a new technology demands processes and often increases the time to market for new features and products, thus slowing down the innovation and competitiveness of a company. Redis Stack is often regarded as a Swiss Army knife when it comes to solving different problems. As a data structures server, it allows you to transfer many responsibilities from application servers or specialized databases to a single, compact database server. In this section, we will recap the classical use cases that made Redis popular. Those uses include the following:

  • Caching
  • Session store
  • Rate limiter...

Going beyond the real-time cache with Redis Stack

With the addition of new capabilities, Redis Stack pushes Redis forward and meets the expectations of software architects and developers who are having to deal with myriad new requirements. However, it also pushes the old traditional ones to the next step, which means finding new ways to resolve traditional problems with real-time performance, scalability, and high availability easily and inexpensively. Since its inception, Redis’ objective has been to provide suitable data structures and algorithms to ensure speed and minimal footprint. As an example, think of the Bitmap data structure, which grants access down to the bit level. With such flexibility, we can flag the days in a given month when a user has authenticated to a certain service:

127.0.0.1:6379> SETBIT user:032023 0 1
(integer) 0
127.0.0.1:6379> SETBIT user:032023 5 1
(integer) 0
127.0.0.1:6379> SETBIT user:032023 10 1
(integer) 0
127.0.0.1:6379> SETBIT...

Designing microservice architectures with Redis Stack

Microservice architecture is a system design pattern that promotes subdividing large services into smaller units by decomposing the business logic into decoupled and independent services, each depending on the preferred technology stack, languages data models, and more. These services take the name of microservices and, communicating over a network, deliver the functionality of a larger system.

In this section, we will introduce some of the principal patterns for microservice architectures. These patterns are guidelines for designing, developing, and deploying microservices. We will approach this subject by presenting the value that the capabilities of Redis Stack provide at the time of choosing the suitable technology for the implementation. In this section, we will discuss the following patterns:

  • API gateway
  • API gateway caching
  • Domain-driven design
  • Query caching
  • Command query responsibility segregation...

Summary

In this chapter, we reviewed the common scenarios Redis is known for: a real-time store for caching, a compact session store, a flexible message broker, and more. We also introduced modern use cases that can be implemented using the capabilities of Redis Stack. You learned about the indexing features to implement a faceted search in an online retail store and the convenience of indexing a dataset partially. You also discovered how to work with unstructured data to implement a recommendation system based on VSS or to serve an ML pipeline when Redis Stack is used as an online feature store. Finally, you explored microservice architecture patterns and learned how to implement them with Redis Stack.

In Chapter 3, Getting Started with Redis Stack, you will learn how to install Redis Stack on different environments using binary packages, Docker images, and more. You will also prepare your environment so that you can work with the client libraries for the desired programming language...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Redis Stack for Application Modernization
Published in: Dec 2023Publisher: PacktISBN-13: 9781837638185
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Luigi Fugaro

Luigi Fugaro's first encounter with computers was in the early 80s when he was a kid. He started with a Commodore Vic-20, passing through a Sinclair, a Commodore 64, and an Atari ST 1040, where he spent days and nights giving breath mints to Otis. In 1998, he started his career as a webmaster doing HTML, JavaScript, Applets, and some graphics with Paint Shop Pro. He then switched to Delphi, Visual Basic, and then started working on Java projects. He has been developing all kinds of web applications, dealing with backend and frontend frameworks. In 2012, he started working for Red Hat and is now an architect in the EMEA Middleware team. He has authored WildFly Cookbook and Mastering JBoss Enterprise Application Platform 7 by Packt Publishing.
Read more about Luigi Fugaro

author image
Mirko Ortensi

Mirko Ortensi earned a degree in Electronic Engineering and a Master's degree in Software Engineering. Mirko's career has spanned several roles from Software Engineering to Customer Support, particularly centered around distributed database systems. As a Senior Technical Enablement Architect at Redis, Mirko shares technical knowledge about Redis's products and services.
Read more about Mirko Ortensi