-
Type:
Task
-
Resolution: Duplicate
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
timothy-kim-mongo has created PR #1699: GODRIVER-3090 Optimize logging truncation for large documents in mongo-go-driver
Issue Text:
GODRIVER-3090(https://jira.mongodb.org/browse/GODRIVER-3090)
-
- Summary
The goal of this pull request is to optimize the logging truncation process for large documents in the Go Driver. This optimization aims to improve driver performance when handling and truncating large extensive BSON documents and payloads, specifically addressing issues related to logging large documents, which can adversely affect driver performance and can cause resource containment and are critical for maintaining application performance and operational efficiency.
Key changes introduced include the implementation of a StringN method for bsoncore.Document. This method allows BSON documents to be stringified up to a specified byte limit (N), incorporating precise truncation logic that accounts for multi-byte characters. By leveraging the existing logging truncation algorithm, the method ensures accurate and efficient handling of BSON documents in extended JSON format, thereby maintaining data integrity and aligning with BSON specifications.
Furthermore, the pull request updates various BSON element string methods (Array.StringN, Value.StringN, etc.) to utilize the new StringN functionality. This ensures consistent and optimized truncation across different BSON element types, such as arrays and nested documents, when exceeding specified byte limits. Comprehensive unit tests and benchmark tests accompany these changes, validating the performance improvements in terms of reduced execution time (ns/op), decreased memory allocations (B/op), and enhanced efficiency in handling large BSON payloads.
Therefore, this pull request significantly improves driver performance by optimizing BSON document truncation for logging purposes. It addresses scalability challenges and enhances the reliability of the MongoDB Go Driver in handling large BSON payloads, thereby benefiting applications with critical logging and operational needs.
- duplicates
-
GODRIVER-3090 Optimize logging truncation for large documents
-
- Closed
-