중요
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
histogramsargument is an optional boolean. Ifhistograms: truethenlatencyStats()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.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
출력
latencyStats() returns a document containing a field latencyStats, containing the following fields:
필드 이름 | 설명 |
|---|---|
| 읽기 요청에 대한 지연 시간 통계입니다. |
| 쓰기 요청에 대한 지연 시간 통계입니다. |
| 데이터베이스 명령에 대한 지연 시간 통계입니다. |
| 데이터베이스 트랜잭션에 대한 지연 시간 통계입니다. |
이러한 각 필드에는 다음 필드가 있는 내장된 문서 포함되어 있습니다.
필드 이름 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|
| 총 지연 시간(마이크로초)입니다. | |||||||
| 스타트업 이후 컬렉션 에 대해 수행된 작업의 총 개수입니다. | |||||||
| 각각 지연 시간 범위 를 나타내는 내장된 문서의 배열 입니다. 각 문서 는 이전 문서 범위 의 두 배를 다룹니다. 2048 마이크로초에서 약 1 초 사이의 낮은 값의 경우 히스토그램에 반단계가 포함됩니다. 이 필드는 각 문서 에는 다음과 같은 필드가 있습니다.
예를 들어 This indicates that there were [1]:
|
| [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) } } }