Blog Content

    티스토리 뷰

    [MongoDB] Overflow sort stage buffered data usage exceeds internal limit

     

    Overflow sort stage buffered data usage exceeds internal limit

     

     

    컬렉션 정렬조회 작업 시 Overflow sort stage buffered data usage of.... 에러가 발생하는 경우
    대부분의 원인은 해당 컬렉션에 인덱스가 누락되어 발생한 부분이며 (인덱스를 추가하여도 발생 가능성은 존재 합니다) 인덱스 생성을 통해 해결이 가능 합니다.

     

    참고로 MongoDB 정렬조회 작업 시 32MB를 초과하는 작업의 경우

    아래 화면과 같은 Overflow sort stage buffered data usage of....에러가 발생하게 됩니다.

     

    이는 MongoDB 에서 의도적으로 설정 한 sort buffer 제한 값으로 발생하는 사항이며

    가급적 결과집합을 줄이거나 색인 등을 사용하여 정렬을 수행하도록 가이드 해야 합니다.

     

    기본값인 32MB 에서 버퍼한계를 높일 수도 있으나 메모리를 많이 사용하게 될 경우

    데이터베이스가 중단되어 (한계가 설정된 이유…) 데이터베이스가 손상될 수 있음으로

    운영 중 변경 작업은 신중해야 할 거 같습니다.

     

     

     

     

    ■ 버퍼한계 조정작업

     

                ※
    해당 서버의 버퍼정보 확인작업
               > use admin
               switched to db admin
               > db.runCommand( { getParameter : 1, "internalQueryExecMaxBlockingSortBytes" : 1 } )
               { "internalQueryExecMaxBlockingSortBytes" : 33554432, "ok" : 1 }

     

                ※ 해당 서버의 버퍼한계 조정작업
               >  db.adminCommand({setParameter: 1, internalQueryExecMaxBlockingSortBytes:50151432})
               { "was" : 33554432, "ok" : 1 }

     

     

     MongoDB Document 참고정보

     

    Overflow sort stage buffered data usage exceeds internal limit

     

    If MongoDB cannot use an index to get documents in the requested sort order, the combined size of
    all documents in the sort operation, plus a small overhead, must be less than 32 megabytes.
    Pipeline stages have a limit of 100 megabytes of RAM. If a stage exceeds this limit, MongoDB will produce an error.
    To allow for the handling of large datasets, use the allowDiskUse option to enable aggregation pipeline stages to write data to temporary files.

    Comments