Compacting Pseudo Linear Byte Arrays for Database Driver Memory Optimization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In database environments, caching result sets in byte arrays leads to memory pressure on client database drivers and frequent resource-intensive calculations to determine data size, reducing the ability to cache additional data and increasing processor usage.
Innovation Solution
A system and method for compacting pseudo linear dynamic byte arrays by creating a static byte array when the dynamic array is underfilled, calculating the data size, and storing it as metadata, allowing for efficient access and reducing the need for frequent recalculations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If result sets are cached in dynamic byte arrays, then data can be stored and retrieved, but memory pressure increases and the ability to cache additional data is reduced
Solution Approach 1:
The patent changes the structure parameter of the byte array from dynamic to static allocation. By pre-allocating a fixed size buffer and tracking the actual data size separately, the system transforms the memory consumption pattern from unbounded growth to controlled allocation, thereby reducing memory pressure while maintaining caching functionality.
2Measurement precision
If the size of the byte array is constantly calculated for status reporting and cache management, then accurate cache size information is available, but processor usage increases and performance decreases
Solution Approach 1:
The patent performs the size calculation action in advance by maintaining a running counter of the actual data size as data is written to the byte array. This preliminary tracking eliminates the need for repeated size calculations during cache management operations, significantly reducing processor usage while maintaining accurate size information.
Solution Approach 2:
The system makes the byte array structure self-aware of its own size by maintaining an internal counter that automatically tracks the amount of data stored. This self-service mechanism provides accurate size information without requiring external calculation or intervention, improving both measurement precision and processor efficiency.
3Adaptability or versatility
If a dynamic byte array is used to store result sets, then flexible data storage is achieved, but frequent size calculations are required which are resource-expensive
Solution Approach 1:
The patent segments the byte array into two functional parts: a pre-allocated static buffer for data storage and a separate size counter for tracking. This segmentation allows the system to maintain the flexibility of dynamic data storage while eliminating the computational overhead of frequent size calculations, as the size is continuously tracked rather than recalculated.
Data Source
AI summary
In accordance with an embodiment, described herein is a system and method for compacting a pseudo linear byte array, for use with supporting access to a database. A database driver (e.g., a Java Database Connectivity (JDBC) driver) provides access by software application clients to a database. When a result set (e.g., ResultSet) is returned for storage in a dynamic byte array (DBA), in response to a database query (e.g., a SELECT), the database driver determines if the DBA is underfilled and, if so, calculates the data size of the DBA, creates a static byte array (SBA) in a cache at the client, compacts the returned data into the SBA, and stores the data size as part of the metadata associated with the cache. In accordance with an embodiment, the DBA and the SBA can use a same interface for access by client applications.


