AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

세그먼트 간 쿼리 실행 병렬화Parallelize Query Execution Across Segments

concurrent 옵션은 쿼리 내 병렬 처리를 활성화합니다. 이 모드 에서는 MongoDB Search가 더 많은 리소스를 사용하지만 각 개별 쿼리 지연 시간 향상됩니다. 이 기능은 전용 검색 노드에서만 사용할 수 있습니다.

When you run queries with the concurrent option, MongoDB Search doesn't guarantee that each query executes concurrently. For example, when too many concurrent queries are queued, MongoDB Search might fallback to single-threaded execution.

concurrent 의 구문은 다음과 같습니다:

{
"$searchMeta"|"$search": {
"index": "<index name>", // optional, defaults to "default"
"<operator>": {
<operator-specifications>
},
"concurrent": true | false,
...
}
}

The concurrent boolean option allows you to request MongoDB Search to parallelize query execution across segments, which often improves the response time. You can set one of the following values for the concurrent option:

  • true - MongoDB Search에 쿼리 멀티스레드로 실행 하도록 요청

  • false - 쿼리를 단일 스레드로 실행(기본값)

MongoDB Search는 쿼리별로 이러한 동작을 제어하여 사용량이 많고 오래 실행되는 쿼리에 대해서만 동시 실행을 활성화 경합을 최소화하고 전체 쿼리 처리량 향상시킵니다. 동시 실행은 세그먼트 수가 많기 때문에 대규모 데이터 세트에서 특히 효율적입니다.

MongoDB Search runs a concurrent query on multiple threads, so the query completes faster. But the query consumes more CPU on your Search Nodes while it runs. Enabling the concurrent option for high-volume or short-running queries can saturate the CPU on your Search Nodes and reduce overall query throughput. To limit the impact on CPU, enable the concurrent option only for the heavy and long-running queries that benefit from lower latency.

To measure the CPU cost of an individual query, run the query with explain and review the userTimeMs, systemTimeMs, and maxReportingThreads fields in the resourceUsage document.

To monitor CPU usage across your deployment, view the Atlas cluster metrics and the Review MongoDB Search Metrics. Atlas can also trigger MongoDB Search alerts that measure the amount of CPU that MongoDB Search processes use. If CPU usage approaches the limits of acceptable performance, scale your Search Nodes vertically or horizontally. To learn more, see Tips for Sizing and Scaling Search Nodes.

Consider the following query against the sample_mflix.movies collection in the sample data. The query indicates a concurrent search for movies that contain the term new york in the title.

1db.movies.aggregate([
2 {
3 "$search": {
4 "text": {
5 "path": "title",
6 "query": "new york"
7 },
8 "concurrent": true
9 }
10 }
11])