You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add SMB connection pool, pipelined reads, and TCP socket tuning
Eliminate the single-TCP-connection serialization bottleneck by pooling
N authenticated SMB sessions (default 4, configurable via
SPICEIO_SMB_CONNECTIONS). Concurrent S3 requests now fan out across
connections via round-robin instead of queuing behind one mutex.
Streaming GetObject sends batches of 8 read requests before collecting
responses (pipelined reads), hiding per-request round-trip latency.
Additional changes:
- Enlarge SO_SNDBUF/SO_RCVBUF to 1 MB on SMB TCP sockets
- Add configurable standalone I/O cap via SPICEIO_SMB_MAX_IO (default
64 KB; raisable for servers that handle larger I/O)
- Parse MaxTransactSize from negotiate response
- Separate compound-safe sizes (64 KB) from standalone I/O sizes
- New smb::pool module with SmbPool round-robin dispatcher
- ShareSession backed by pool; FileHandle pinned to opening connection
-`SPICEIO_BUCKET` — virtual S3 bucket name (defaults to `SPICEIO_SMB_SHARE`)
36
36
-`SPICEIO_REGION` — AWS region to advertise (default `us-east-1`)
37
+
-`SPICEIO_SMB_CONNECTIONS` — number of SMB TCP connections in the pool (default `4`)
38
+
-`SPICEIO_SMB_MAX_IO` — max standalone read/write I/O size in bytes (default `65536`; raise for servers that handle larger I/O)
37
39
-`SPICEIO_LOG_FILE` — append logs to this file in addition to stderr (optional; non-blocking, never stalls the proxy)
38
40
39
41
## Architecture
@@ -42,7 +44,7 @@ The codebase has three modules:
42
44
43
45
-**`s3`** — HTTP layer. Parses incoming S3 API requests and produces XML responses. `router.rs` is the central dispatch (path-style bucket routing). Covers GetObject, PutObject, CopyObject, DeleteObject, HeadObject, ListObjectsV1/V2, multipart uploads, and stub endpoints for ACL/tagging/versioning. `xml.rs` is a hand-rolled XML builder. `multipart.rs` manages upload state in-memory, with parts stored as temp files under `.spiceio-uploads/` on the SMB share. `body.rs` implements `SpiceioBody`, a zero-copy streaming response body (channel-backed for large reads, inline for XML/errors).
-**`crypto`** — FFI bindings to macOS CommonCrypto (`Security.framework`/`libcommonCrypto`). Exposes MD4, SHA-256, and HMAC-MD5. No Rust crypto crates.
48
50
@@ -52,6 +54,9 @@ The codebase has three modules:
52
54
53
55
- Zero external crypto dependencies — all crypto goes through `crypto::ffi` to CommonCrypto.
54
56
- No `async-trait` — the SMB client uses `tokio::sync::Mutex` around the TCP stream with manual `async` methods.
57
+
- Connection pool — N TCP connections (default 4) to the same SMB server, round-robin dispatched. Concurrent S3 requests fan out across connections instead of serializing on a single mutex. File handles are pinned to the connection that opened them.
58
+
- Pipelined reads — streaming GetObject sends batches of 8 read requests before collecting responses, hiding per-request round-trip latency.
59
+
- Configurable I/O cap — standalone read/write ops default to 64 KB (safe for commodity NAS); raisable via `SPICEIO_SMB_MAX_IO` for compliant servers. Compound operations always cap at 64 KB.
55
60
- GetObject streams SMB read chunks directly to the HTTP response via `SpiceioBody::channel` — no full-file buffering.
56
61
- PutObject streams HTTP request body chunks directly to SMB write calls — no full-body collection.
57
62
- Body is collected into `Bytes` only for operations that require the full payload (multi-delete, multipart complete, upload-part for ETag hashing).
0 commit comments