@@ -28,10 +28,16 @@ namespace AdbcDrivers.Databricks.Reader.CloudFetch
2828 /// </summary>
2929 internal sealed class CloudFetchConfiguration
3030 {
31- // Default values
32- internal const int DefaultParallelDownloads = 3 ;
33- internal const int DefaultPrefetchCount = 2 ;
34- internal const int DefaultMemoryBufferSizeMB = 200 ;
31+ // Default values — tuned for CloudFetch parity with JDBC driver.
32+ // ParallelDownloads: HTTP concurrency. 5 is a conservative bump from 3 that
33+ // improves network utilization without excessive TCP/TLS overhead.
34+ // PrefetchCount: controls resultQueue capacity (PrefetchCount * 2). This is
35+ // the implicit sliding window — when full, downloader blocks until reader consumes.
36+ // MemoryBufferSizeMB: byte-level cap on in-flight compressed data.
37+ internal const int DefaultParallelDownloads = 16 ;
38+ internal const int DefaultPrefetchCount = 16 ;
39+ internal const int DefaultMemoryBufferSizeMB = 400 ;
40+ internal const int DefaultLinkPrefetchWindowSize = 128 ;
3541 internal const int DefaultTimeoutMinutes = 5 ;
3642 internal const int DefaultMaxRetries = 0 ; // 0 = no limit (use timeout only)
3743 internal const int DefaultRetryTimeoutSeconds = 300 ; // 5 minutes
@@ -45,10 +51,18 @@ internal sealed class CloudFetchConfiguration
4551 public int ParallelDownloads { get ; set ; } = DefaultParallelDownloads ;
4652
4753 /// <summary>
48- /// Number of files to prefetch ahead of the reader.
54+ /// Number of files to prefetch ahead of the reader (controls download window / result queue size) .
4955 /// </summary>
5056 public int PrefetchCount { get ; set ; } = DefaultPrefetchCount ;
5157
58+ /// <summary>
59+ /// Size of the link prefetch window — how many chunk links to fetch ahead of downloads.
60+ /// The fetcher runs on a background task and can fetch links far ahead while downloads
61+ /// are paced by memory and download slots. This matches JDBC's LinkPrefetchWindow=128.
62+ /// Links are lightweight metadata (URL + offsets), so a large window uses minimal memory.
63+ /// </summary>
64+ public int LinkPrefetchWindowSize { get ; set ; } = DefaultLinkPrefetchWindowSize ;
65+
5266 /// <summary>
5367 /// Memory buffer size limit in MB for buffered files.
5468 /// </summary>
@@ -151,7 +165,8 @@ public static CloudFetchConfiguration FromProperties(
151165 RetryTimeoutSeconds = PropertyHelper . GetPositiveIntPropertyWithValidation ( properties , DatabricksParameters . CloudFetchRetryTimeoutSeconds , DefaultRetryTimeoutSeconds ) ,
152166 RetryDelayMs = PropertyHelper . GetPositiveIntPropertyWithValidation ( properties , DatabricksParameters . CloudFetchRetryDelayMs , DefaultRetryDelayMs ) ,
153167 MaxUrlRefreshAttempts = PropertyHelper . GetPositiveIntPropertyWithValidation ( properties , DatabricksParameters . CloudFetchMaxUrlRefreshAttempts , DefaultMaxUrlRefreshAttempts ) ,
154- UrlExpirationBufferSeconds = PropertyHelper . GetPositiveIntPropertyWithValidation ( properties , DatabricksParameters . CloudFetchUrlExpirationBufferSeconds , DefaultUrlExpirationBufferSeconds )
168+ UrlExpirationBufferSeconds = PropertyHelper . GetPositiveIntPropertyWithValidation ( properties , DatabricksParameters . CloudFetchUrlExpirationBufferSeconds , DefaultUrlExpirationBufferSeconds ) ,
169+ LinkPrefetchWindowSize = PropertyHelper . GetPositiveIntPropertyWithValidation ( properties , DatabricksParameters . CloudFetchLinkPrefetchWindowSize , DefaultLinkPrefetchWindowSize )
155170 } ;
156171
157172 return config ;
0 commit comments