[DRIVERS-2581] Benchmark and use `mongocrypt_binary_t` definition to improve performance of In-Use Encryption Created: 24/Mar/23  Updated: 02/Oct/23

Status: Implementing
Project: Drivers
Component/s: Client Side Encryption, Performance
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Jeffrey Yemin Assignee: Kevin Albertson
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2021-09-27 at 3.04.35 PM.png    
Issue Links:
Issue split
split to GODRIVER-2907 Benchmark and use `mongocrypt_binary_... Backlog
split to NODE-5455 Benchmark and use `mongocrypt_binary_... Backlog
split to RUBY-3299 Benchmark and use `mongocrypt_binary_... Backlog
split to CDRIVER-4685 Benchmark and use `mongocrypt_binary_... Closed
split to CSHARP-4719 Benchmark use of `mongocrypt_binary_t... Closed
split to CXX-2716 Benchmark and use `mongocrypt_binary_... Closed
split to JAVA-5073 Benchmark and use `mongocrypt_binary_... Closed
split to MOTOR-1155 Benchmark and use `mongocrypt_binary_... Closed
split to PHPC-2304 Benchmark and use `mongocrypt_binary_... Closed
split to PYTHON-3838 Benchmark and use `mongocrypt_binary_... Closed
split to RUST-1704 Benchmark and use `mongocrypt_binary_... Closed
Related
related to DRIVERS-2718 Enable use of native crypto in libmon... Implementing
related to MONGOCRYPT-589 Export mongocrypt_binary_t Closed
related to MONGOCRYPT-595 Pool Cipher instances Closed
Driver Changes: Needed
Quarter: FY24Q3
Downstream Changes Summary:

Goal: Improve performance of In-Use Encryption for the workload identified in HELP-27047.

Proposed changes for drivers:

Refer to the changes made for the Java driver bindings:

The benchmark may be useful for testing future performance improvements (DRIVERS-2718).

Proposed changes may not apply to languages with no extra cost for calling into a C library: (C, C++, PHP via C driver)

Engineering Lead: James Kovacs James Kovacs
Program Manager: Esha Bhargava Esha Bhargava
Start date:
Driver Compliance:
Key Status/Resolution FixVersion
CDRIVER-4685 Works as Designed
CXX-2716 Works as Designed
CSHARP-4719 Done 2.24.0
GODRIVER-2907 Backlog
JAVA-5073 Duplicate
NODE-5455 Backlog
MOTOR-1155 Won't Do
PYTHON-3838 Fixed pymongocrypt-1.8.0
PHPC-2304 Works as Designed
RUBY-3299 Backlog
RUST-1704 Won't Do

 Description   

Summary

Reduce overhead of encryption callbacks by providing bulk-oriented encryption and decryption callbacks

Motivation

HELP-27047 identified a slow workload with In-Use Encryption: decrypting documents with many encrypted fields. The crypto callbacks in libmongocrypt were identified as a possible cause.

Driver bindings optionally set crypto callbacks to provide the crypto functions (HMAC, AES, SHA). Setting the callback enables using libmongocrypt without taking a dependency on OpenSSL or a system native crypto library. On last survey, Java, Python, C#, Ruby, Node, and Rust implement the crypto callbacks.

The crypto callbacks showed in profiling HELP-27047. MONGOCRYPT-589 exports the fields of mongocrypt_binary_t. This allows bindings to use fields of mongocrypt_binary_t in callbacks directly and avoid calls to mongocrypt_binary_data and mongocrypt_binary_len.

Who is the affected end user?

Applications using implicit encryption where a single command requires many encryption/decryption operations

How does this affect the end user?

They are annoyed because implicit encryption/decryption is slower than they expect

How likely is it that this problem or use case will occur?

Fairly likely for users of implicit encryption.

If the problem does occur, what are the consequences and how severe are they?

It's a performance concern. 

Is this issue urgent?

No

Is this ticket required by a downstream team?

No

Is this ticket only for tests?

No

Acceptance Criteria

Implicit decryption is benchmarked. Implicit decryption performance is improved.



 Comments   
Comment by Githook User [ 02/Oct/23 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: DRIVERS-2581 specify bindings benchmark (#1463)
Branch: master
https://github.com/mongodb/specifications/commit/db3114e957f7c0976a1af09882dbb46cb4a70049

Generated at Thu Feb 08 08:25:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.