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

db. 컬렉션.latencyStats() (mongosh 메서드)

중요

Mongo쉬 방법

This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.

데이터베이스 명령의 경우 collStats 명령에서 반환된 latencyStats 필드를 참조하세요.

MongoDB API 드라이버의 경우 언어별 MongoDB 드라이버 설명서를 참조하세요.

db.collection.latencyStats(options)

db.collection.latencyStats() returns latency statistics for a given collection. It is a wrapper around $collStats.

이 메서드에는 다음과 같은 형식이 있습니다.

db.collection.latencyStats( { histograms: <boolean> } )

The histograms argument is an optional boolean. If histograms: true then latencyStats() adds latency histograms to the return document.

이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

참고

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

latencyStats() returns a document containing a field latencyStats, containing the following fields:

필드 이름
설명

reads

읽기 요청에 대한 지연 시간 통계입니다.

writes

쓰기 요청에 대한 지연 시간 통계입니다.

commands

데이터베이스 명령에 대한 지연 시간 통계입니다.

transactions

데이터베이스 트랜잭션에 대한 지연 시간 통계입니다.

이러한 각 필드에는 다음 필드가 있는 내장된 문서 포함되어 있습니다.

필드 이름
설명

latency

총 지연 시간(마이크로초)입니다.

ops

스타트업 이후 컬렉션 에 대해 수행된 작업의 총 개수입니다.

histogram

각각 지연 시간 범위 를 나타내는 내장된 문서의 배열 입니다. 각 문서 는 이전 문서 범위 의 두 배를 다룹니다. 2048 마이크로초에서 약 1 초 사이의 낮은 값의 경우 히스토그램에 반단계가 포함됩니다.

이 필드는 latencyStats: { histograms: true } 옵션이 있는 경우에만 존재합니다. count가 0인 빈 범위는 출력에서 생략됩니다.

각 문서 에는 다음과 같은 필드가 있습니다.

  • micros: 현재 지연 시간 범위의 하한값(마이크로초)입니다.

    문서의 범위는 이전 문서의 micros 값(배타적)과 이 문서의 micros 값(포괄적) 사이입니다.

  • count: 지연 시간 micros 이하인 작업의 수입니다.

예를 들어 collStats가 다음과 같은 히스토그램을 반환하는 경우입니다.

histogram: [
{ micros: Long(0), count: Long(10) },
{ micros: Long(2), count: Long(1) },
{ micros: Long(4096), count: Long(1) },
{ micros: Long(16384), count: Long(1000) },
{ micros: Long(49152), count: Long(100) }
]

This indicates that there were [1]:

  • 마이크로초 이하로10 걸리는 작업 2

  • [2, 4) 마이크로초 범위 의 1 작업

  • [4096, 6144) 마이크로초 범위 의 1 작업

  • [16384, 24576) 마이크로초 범위 의 1000 작업

  • [49152, 65536) 마이크로초 범위 의 100 작업

[1]
  • 이 페이지의 ( 기호 표기는 값이 배타적임을 의미합니다.

  • 이 페이지의 ] 기호 표기법은 값이 포괄적임을 의미합니다.

You can run latencyStats() in mongosh as follows:

db.data.latencyStats( { histograms: true } ).pretty()

latencyStats() 다음과 같은 문서를 반환합니다.

{
"ns" : "test.data",
"localTime" : ISODate("2016-11-01T21:56:28.962Z"),
"latencyStats" : {
"reads" : {
"histogram" : [
{
"micros" : Long(16),
"count" : Long(6)
},
{
"micros" : Long(512),
"count" : Long(1)
}
],
"latency" : Long(747),
"ops" : Long(7)
},
"writes" : {
"histogram" : [
{
"micros" : Long(64),
"count" : Long(1)
},
{
"micros" : Long(24576),
"count" : Long(1)
}
],
"latency" : Long(26845),
"ops" : Long(2)
},
"commands" : {
"histogram" : [ ],
"latency" : Long(0),
"ops" : Long(0)
}
}
}
이 페이지 평가하기

이 페이지의 내용