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

네트워크 트래픽 압축

MongoDB 드라이버는 MongoDB Server 와 주고받는 메시지를 압축할 수 있습니다. 이렇게 하면 각 작업에 대해 전송되는 데이터 양이 줄어듭니다. 압축은 제한된 네트워크에서 성능을 향상시키고 MongoDB Atlas 실행 과 관련된 데이터 전송 비용을 낮출 수 있습니다.

압축은 유선 프로토콜 수준에서 작동하므로 애플리케이션 수행하는 모든 작업에 적용됩니다. 알고리즘 두 개 이상 지정하는 경우 운전자 MongoDB Server 도 지원하는 목록의 첫 번째 알고리즘 사용합니다.

MongoDB 드라이버는 다음 압축 알고리즘을 지원 .

MongoDB Atlas charges for data transferred across cloud regions, cloud providers, and between your infrastructure and MongoDB Atlas. Network compression reduces the amount of data that your application sends and receives, which can lower these data transfer costs. To learn more about pricing, see Data Transfer Costs.

네트워크 압축은 생산성 이점도 있습니다. 압축된 메시지는 네트워크를 통해 전송되는 데 시간이 덜 걸리므로 애플리케이션의 응답 시간을 개선할 수 있습니다. 또한 압축은 MongoDB 트래픽이 사용하는 대역폭을 줄여 동일한 네트워크의 다른 애플리케이션에서 사용할 수 있는 대역폭을 더 많이 확보합니다.

압축 알고리즘 선택할 때 다음 지침을 고려하세요.

  • 압축 효율성 과 리소스 사용량의 균형을 맞추려면 Zstandard를 사용하세요. Zstandard는 대부분의 애플리케이션에 적합한 기본값 선택입니다.

  • 최소한의 계산 오버헤드 필요한 지연 시간에 민감한 애플리케이션에는 Snappy를 사용하세요.

  • MongoDB 드라이버 및 환경 전반에서 광범위한 호환성을 위해 Zlib를 사용하세요.

CPU 사용량 모니터링

Compression trades network bandwidth for CPU usage. After you enable network compression, monitor your application's CPU utilization to confirm that the trade-off benefits your workload. To learn more about these trade-offs, see the CPU Utilization and Network Compression in MongoDB blog post.

다음 표에는 각 압축 알고리즘 에 대해 지원되는 최소 운전자 및 MongoDB Server 버전이 나열되어 있습니다.

압축 알고리즘
최소 드라이버 버전
최소 서버 버전

3.0

4.2

3.0

4.2

4.7

4.2

MongoDB 연결에 네트워크 압축을 활성화 하려면 필요한 종속성을 설치하고 사용할 압축 알고리즘을 지정합니다.

다음 표에는 각 알고리즘 과 필수 종속성(있는 경우)이 나열되어 있습니다.

Compression Algorithm
Dependencies

스내피

Add the snappy package to your application. To install, run the npm install --save snappy command.

zlib

none

Zstandard

Add the @mongodb-js/zstd package to your application. To install, run the npm install --save @mongodb-js/zstd command.

다음 두 가지 방법 중 하나로 알고리즘을 지정하여 MongoDB 인스턴스 연결에 대한 압축을 활성화할 수 있습니다.

  1. 연결 문자열에 매개변수를 추가합니다.

  2. MongoClientOptionscompressors 옵션을 지정합니다.

연결 문자열을 사용하여 압축을 사용하려면 연결 문자열에 compressors 매개 변수를 추가합니다. 쉼표로 구분하여 하나 이상의 압축 알고리즘을 지정할 수 있습니다.

const uri =
"mongodb+srv://<user>:<password>@<cluster-url>/?compressors=snappy,zlib";
const client = new MongoClient(uri);

To enable compression using the MongoClientOptions, pass the compressors option and the compression algorithm you want to use. You can specify one or more compression algorithms, separating them with commas:

const uri =
"mongodb+srv://<user>:<password>@<cluster-url>";
const client = new MongoClient(uri,
{
compressors: ["snappy"]
});

다음 문자열을 사용하여 압축 알고리즘을 지정합니다.