- Home
- >
- Software Development
- >
- Redis’ RediSearch Secondary Index Responds Faster, Streamlines Indexing – InApps
Redis’ RediSearch Secondary Index Responds Faster, Streamlines Indexing – InApps is an article under the topic Software Development Many of you are most interested in today !! Today, let’s InApps.net learn Redis’ RediSearch Secondary Index Responds Faster, Streamlines Indexing – InApps in today’s post !
Key Summary
- Overview: The 2022 article by InApps Technology explores Redis and its RediSearch module, focusing on the secondary index feature, which enhances query performance and streamlines indexing for real-time search applications, highlighting its impact on scalability and efficiency.
- What is Redis?:
- An open-source, in-memory data structure store used as a database, cache, and message broker, known for its high performance and versatility.
- Supports various data types (e.g., strings, lists, sets, hashes) and is widely used for real-time applications like caching, session management, and analytics.
- What is RediSearch?:
- A Redis module that adds full-text search and secondary indexing capabilities, enabling complex queries on Redis data without external search engines.
- Designed for real-time search use cases, such as e-commerce product searches, autocomplete, or log analysis.
- Secondary Index in RediSearch:
- Definition: A secondary index is an additional data structure that maps specific fields (e.g., product name, category) to enable faster lookups and filtering without scanning the entire dataset.
- Key Features:
- Fast Query Response: Accelerates searches by indexing fields like text, numbers, or geographic data, reducing query latency.
- Dynamic Indexing: Supports real-time updates to indexed fields, maintaining performance as data changes.
- Full-Text Search: Enables keyword searches with features like stemming, synonyms, and fuzzy matching.
- Aggregation: Allows grouping, sorting, and summarizing data (e.g., average price by category) directly in Redis.
- Multi-Field Queries: Combines multiple indexed fields for complex searches (e.g., “laptop under $500 with 4-star rating”).
- How It Works:
- Developers define a schema with indexed fields (e.g., title, description) using RediSearch commands.
- Data is stored in primary Redis structures (e.g., hashes), and RediSearch maintains secondary indexes for queried fields.
- Queries are executed against the index, returning results in milliseconds, ideal for high-traffic applications.
Example Implementation:
// Create an index for products
FT.CREATE idx:products ON HASH PREFIX 1 product:
SCHEMA name TEXT SORTABLE price NUMERIC SORTABLE category TAG
// Add a product
HSET product:1 name “Laptop Pro” price 999.99 category “Electronics”
// Search for electronics under $1000
FT.SEARCH idx:products “@category:{Electronics} @price:[0 1000]” RETURN 2 name price
- Benefits:
- Performance: Secondary indexes reduce query times, enabling sub-millisecond responses for large datasets.
- Simplicity: Eliminates the need for external search engines (e.g., Elasticsearch), consolidating data and search in Redis.
- Scalability: Handles high query volumes and real-time updates, suitable for enterprise applications.
- Cost Efficiency: Offshore development in Vietnam ($20-$50/hour via InApps Technology) optimizes costs for Redis-RediSearch projects, saving 20-40% compared to U.S./EU rates ($80-$150/hour).
- Use Cases:
- E-commerce platforms for product search and recommendation systems.
- Real-time analytics for log or event data (e.g., monitoring dashboards).
- Autocomplete and search-as-you-type features in web or mobile apps.
- Filtering and aggregating data in CRM or inventory systems.
- Challenges:
- Memory Usage: Secondary indexes increase memory consumption, requiring careful schema design and capacity planning.
- Learning Curve: Configuring RediSearch and optimizing queries may be complex for developers new to Redis or search indexing.
- Scalability Limits: High write throughput with frequent index updates can strain single-node setups, mitigated by Redis clustering.
- InApps Technology’s Role:
- Offers expertise in Redis and RediSearch implementation, building high-performance, search-optimized applications.
- Leverages Vietnam’s 200,000+ IT professionals, providing cost-effective rates ($20-$50/hour) for scalable solutions.
- Supports Agile workflows with tools like Jira and Slack, ensuring efficient collaboration across global teams (GMT+7).
- Recommendations:
- Use RediSearch for applications requiring fast, real-time search without external dependencies.
- Start with a minimal schema, indexing only frequently queried fields to optimize memory usage.
- Leverage Redis clustering for high-traffic applications to distribute indexing and query loads.
- Partner with InApps Technology for expert Redis-RediSearch development, utilizing Vietnam’s skilled developers to deliver cost-effective, high-performance search solutions.
Read more about Redis’ RediSearch Secondary Index Responds Faster, Streamlines Indexing – InApps at Wikipedia
You can find content about Redis’ RediSearch Secondary Index Responds Faster, Streamlines Indexing – InApps from the Wikipedia website
With the launch of version 2.0, the RediSearch in-memory index for Redis is over twice as fast as its previous iteration and offers additional ways to makes it easier for developers to create and exploit indices.
Built by Redis Labs, RediSearch is a secondary index on top of Redis that eliminates internal data structures to increase responsiveness as well as make it easier for developers to harness advanced tasks such as multifield queries, aggregation and full-text search capabilities like exact phrase matching and numeric filtering for text queries.
In addition to a purported maximum 2.4-times increase in speed compared to RediSearch 1.6, RediSearch 2.0 supports Redis Labs’ Active-Active geo-distribution technology, is scalable without downtime and includes support for running on Flash drives, Redis on Flash (currently in private preview mode).
“The addition of RediSearch to your technology stack simplifies the data infrastructure, extends applications with rich search experiences, and unlocks the power of analytics within Redis,” Pieter Cailliau, director of product, Redis Labs, told InApps.
Redis Labs changed RediSearch’s architecture for RediSearch 2.0 to achieve two main goals, Cailliau said: to improve the developer experience and to enable RediSearch to support almost all Redis Enterprise capabilities.
“Creating an index is now easier than before — you just define the schema of the index on top of your existing data and you can start searching,” Cailliau said. “No need to move data around, no need to restart Redis, and no need to update your code.”
In furtherance of its goal to support as many Redis Enterprise capabilities as possible, RediSearch 2.0 now supports, for example, Redis on Flash, which Cailliau said: “is a more cost-effective way for running Redis.”
Always On
RediSearch can also be deployed in a “globally distributed manner by leveraging Redis Enterprise’s Active-Active technology to deliver five-nines (99.999%) availability across multiple geo-distributed replicas,” Cailliau said. This capability enables read operations, such as querying and aggregation, and write operations, such as indexing, that can be executed at the speed of local RediSearch deployments without worrying about conflict resolution, Cailliau said.
RediSearch also brings more sophisticated data modeling to Redis by providing several indexing strategies for the value part of the key, including full-text, geo-location, numbers and tags, Cailliau said.
“Without indexes, Redis must perform a SCAN operation for every query, which can be extremely slow and inefficient,” Cailliau said. “And creating and maintaining these indexes manually is complex and error-prone. RediSearch maintains these indexes for the user and allows you to query across data structures in a clustered database.”
Cailliau described RediSearch as an in-memory index built on top of an in-memory database. “Together, they not only provide low-latency response times for both writing and reading, but also synchronous operations,” Cailliau said. “These two features are mandatory for real-time applications, where you have the need to be able to update your data frequently and instantaneously.”
The Benchmarks
To support its claims of up to a 2.4x improvement in indexing speeds and ingestion performance for RediSearch 2.0, Cailliau described in a blog post how Redis Labs used its full-text search benchmark (FTSB) to test publicly available data about New York City taxis. This dataset included text, tag, geographic and numeric data, as well as “a large number of documents.”
Among the results, RediSearch was able to index 132K docs/sec at an overall p50 ingestion latency of 0.4ms, compared to RediSearch 1.6’s indexing-speed rate of 96K documents per second.
“Not only will you benefit from the boost in the throughput, but each ingestion also becomes faster,” Cailliau said. “Apart from the overall ingestion improvement due to the changes in architecture, you can now also rely on the open source Redis Cluster API capabilities to linearly scale the ingestion of your search database. “
Feature image via Pixabay.
Source: InApps.net
Let’s create the next big thing together!
Coming together is a beginning. Keeping together is progress. Working together is success.