Skip to content

Conversation

Ananya2
Copy link
Contributor

@Ananya2 Ananya2 commented Jun 4, 2025

This POC introduces a ByteBufferManager and BufferPool in the JDBC driver to optimize memory usage during TDS packet processing.

Test Results – CRD App
Dataset: 100 Million Records · 601 Columns
Metric Comparison: Average Heap Usage & Execution Time

JDBC Driver | Avg. Heap Usage | Execution Time (ms)
mssql-jdbc (Before Optimization) | 311.34 MB | 5,017,218
mssql-jdbc (After Optimization) | 309.11 MB | 4,944,792
jTDS | 374.64 MB | 3,499,575

@Ananya2 Ananya2 marked this pull request as draft June 4, 2025 08:09
@Ananya2 Ananya2 self-assigned this Jun 4, 2025
Copy link

codecov bot commented Jun 18, 2025

Codecov Report

Attention: Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.

Project coverage is 51.87%. Comparing base (52303d8) to head (30dd55e).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...om/microsoft/sqlserver/jdbc/ByteBufferManager.java 78.94% 1 Missing and 3 partials ⚠️
.../java/com/microsoft/sqlserver/jdbc/BufferPool.java 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2671      +/-   ##
============================================
+ Coverage     51.62%   51.87%   +0.24%     
- Complexity     4006     4045      +39     
============================================
  Files           147      149       +2     
  Lines         33804    33836      +32     
  Branches       5652     5654       +2     
============================================
+ Hits          17453    17553     +100     
+ Misses        13888    13811      -77     
- Partials       2463     2472       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

public void release(byte[] buffer) {
if (buffer.length == bufferSize) {
pool.offer(buffer);
Arrays.fill(buffer, (byte) 0); // Clear the array for re-use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to clear the buffer first, then put it pool. You lose ownership once added to pool and another thread might take the buffer, you can't touch it any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants