Skip to content

Commit 75c0df4

Browse files
authored
RS: Adjusted best practices for scalable Redis query engine & add benchmarks (#1687)
* DOC-4271 RS: Adjusted best practices for scalable Redis query engine & add benchmarks * Style guide fix for indexes * Fixed broken relrefs after AI/search reorg
1 parent 41a63d1 commit 75c0df4

File tree

1 file changed

+112
-5
lines changed

1 file changed

+112
-5
lines changed

content/operate/oss_and_stack/stack-with-enterprise/search/scalable-query-best-practices.md

Lines changed: 112 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ linkTitle: Best practices for scalable Redis Query Engine
1010
weight: 25
1111
---
1212

13-
[Vertical scaling of Redis Query Engine]({{<relref "/operate/oss_and_stack/stack-with-enterprise/search/query-performance-factor">}}) requires configuring query performance factors. With careful crafting of search indices and queries, query performance factors allow throughput scaling up to 16X. The following recommendations help queries avoid accessing the keyspace and enable Redis Query Engine to benefit from additional CPUs allocated by query performance factors.
13+
[Vertical scaling of Redis Query Engine]({{<relref "/operate/oss_and_stack/stack-with-enterprise/search/query-performance-factor">}}) requires configuring query performance factors. With careful crafting of search indexes and queries, query performance factors allow throughput scaling up to 16X. The following recommendations can help optimize your indexes and queries to maximize the performance benefits from additional CPUs allocated by query performance factors.
1414

1515
## Best candidates for query performance factor improvements
1616

@@ -22,13 +22,29 @@ weight: 25
2222

2323
- [Vector]({{<relref "/develop/ai/search-and-query/query/vector-search">}})
2424

25-
- Result set types:
25+
- [Numeric]({{<relref "/develop/ai/search-and-query/query/range">}})
26+
27+
- [Geo]({{<relref "/develop/ai/search-and-query/query/geo-spatial">}})
28+
29+
- Result set types:
2630

2731
- Small result sets
2832

2933
- Document subsets that are indexed in their [non-normalized]({{<relref "/develop/ai/search-and-query/advanced-concepts/sorting#normalization-unf-option">}}) form
3034

31-
## Indexing best practices
35+
## Best practices
36+
37+
If query performance factors have not boosted the performance of your queries as much as expected:
38+
39+
1. Verify your index includes all queried and returned fields.
40+
41+
1. Identify and avoid query [anti-patterns]({{<relref "/develop/ai/search-and-query/best-practices/scalable-query-best-practices#anti-patterns">}}) that limit scalability.
42+
43+
1. Follow best practices to [improve indexing](#improve-indexing).
44+
45+
1. Follow best practices to [improve queries](#improve-queries).
46+
47+
### Improve indexing
3248

3349
Follow these best practices for [indexing]({{<relref "/develop/ai/search-and-query/indexing">}}):
3450

@@ -40,9 +56,9 @@ Follow these best practices for [indexing]({{<relref "/develop/ai/search-and-que
4056

4157
- Use the `NOSTEM` option for `TEXT` fields.
4258

43-
## Query best practices
59+
### Improve queries
4460

45-
Follow these best practices for [queries]({{<relref "/develop/ai/search-and-query/query">}}):
61+
Follow these best practices to optimize [queries]({{<relref "/develop/ai/search-and-query/query">}}):
4662

4763
- Specify the result set fields in the `RETURN` or `LOAD` clauses and include them in the index definition. Don’t just return the default result set from [`FT.SEARCH`]({{< relref "commands/ft.search/" >}}) or `LOAD *` from [`FT.AGGREGATE`]({{< relref "commands/ft.aggregate/" >}}).
4864

@@ -97,3 +113,94 @@ FT.AGGREGATE jsonidx:profiles '@t:[1299 1299]'
97113
LIMIT 0 10
98114
DIALECT 3
99115
```
116+
117+
## Performance results
118+
119+
The following benchmarks show the performance improvements for different query types achieved with query performance factors. Vector, tag, and text queries strongly benefit, while numeric and geographic queries show more limited improvements.
120+
121+
### Vector schema type
122+
123+
#### Vector ingest
124+
125+
| Shards | Threads per shard | CPUs | Speedup factor |
126+
|--------|-------------------|------|----------------|
127+
| 1 | 0 | 1 | 0 |
128+
| 6 | 0 | 6 | 6.6 |
129+
| 1 | 6 | 6 | 2.5 |
130+
| 2 | 6 | 12 | 6.1 |
131+
| 4 | 6 | 24 | 24.3 |
132+
133+
#### Vector query
134+
135+
| Shards | Threads per shard | CPUs | Speedup factor |
136+
|--------|-------------------|------|----------------|
137+
| 1 | 0 | 1 | 0 |
138+
| 6 | 0 | 6 | 0.8 |
139+
| 1 | 6 | 6 | 4.7 |
140+
| 2 | 6 | 12 | 5.1 |
141+
| 4 | 6 | 24 | 5.6 |
142+
143+
### Tag schema type
144+
145+
| Worker threads | % change |
146+
|----------------|----------|
147+
| 0 | 0 |
148+
| 6 | 135.88 |
149+
150+
### Text schema type
151+
152+
#### Two-word union queries
153+
154+
| Worker threads | Queries per second | % change |
155+
|----------------|--------------------|----------|
156+
| 0 | 188 | 0 |
157+
| 6 | 1,072 | 470 |
158+
| 12 | 1,995 | 961 |
159+
| 18 | 2,834 | 1,407 |
160+
161+
#### Two-word intersection queries
162+
163+
| Worker threads | Queries per second | % change |
164+
|----------------|--------------------|----------|
165+
| 0 | 2,373 | 0 |
166+
| 6 | 12,396 | 422 |
167+
| 12 | 17,506 | 638 |
168+
| 18 | 19,764 | 733 |
169+
170+
#### Simple one-word match
171+
172+
| Worker threads | Queries per second | % change |
173+
|----------------|--------------------|----------|
174+
| 0 | 476 | 0 |
175+
| 6 | 2,837 | 496 |
176+
| 12 | 5,292 | 1,012 |
177+
| 18 | 7,512 | 1,478 |
178+
179+
### Numeric schema type
180+
181+
| Worker threads | Queries per second | % change |
182+
|----------------|--------------------|----------|
183+
| 0 | 33,584 | 0 |
184+
| 1 | 36,993 | 10.15 |
185+
| 3 | 36,504 | 8.69 |
186+
| 6 | 36,897 | 9.86 |
187+
188+
### Geo schema type
189+
190+
#### Geo queries without UNF
191+
192+
| Worker threads | Queries per second | % change |
193+
|----------------|--------------------|----------|
194+
| 0 | 48 | 0 |
195+
| 6 | 96 | 100 |
196+
| 12 | 96 | 100 |
197+
| 18 | 98 | 104 |
198+
199+
#### Geo queries with UNF
200+
201+
| Worker threads | Queries per second | % change |
202+
|----------------|--------------------|----------|
203+
| 0 | 61 | 0 |
204+
| 6 | 227 | 272 |
205+
| 12 | 217 | 256 |
206+
| 18 | 217 | 256 |

0 commit comments

Comments
 (0)