feat: add packet_size configuration for LOGIN7 message #400
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add the ability to configure the TDS packet size in the LOGIN7 message. Larger packet sizes can significantly improve bulk insert performance by reducing network round-trips and protocol overhead.
Motivation
While working on a high-throughput data migration tool, we discovered that the default 4KB packet size was a significant bottleneck for bulk insert operations. Benchmarking showed:
This is a 42% improvement in bulk insert performance simply by increasing the packet size.
For comparison, Go's
go-mssqldbdriver also defaults to 4KB packets, but exposes configuration. After this change, Rust/tiberius performance matches or exceeds Go for bulk operations.Changes
packet_size: Option<u32>field toConfigstructpacket_size(&mut self, size: u32)setter method with documentationget_packet_size(&self) -> Option<u32>getter methodLoginMessagein the connection flowpacket_size(&mut self, size: u32)setter toLoginMessageExample Usage
Technical Notes
Test Plan
cargo test --features rustls)🤖 Generated with Claude Code