<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Priyadarshan Singh</title>
    <description>The latest articles on DEV Community by Priyadarshan Singh (@pdrojack).</description>
    <link>https://dev.to/pdrojack</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F276613%2F4c2412c6-e946-4ff2-9b5a-85bddb3904ce.png</url>
      <title>DEV Community: Priyadarshan Singh</title>
      <link>https://dev.to/pdrojack</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pdrojack"/>
    <language>en</language>
    <item>
      <title>Enhancing FastAPI Request Parameters with Pydantic Validation Options</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Mon, 16 Nov 2026 19:08:52 +0000</pubDate>
      <link>https://dev.to/pdrojack/enhancing-fastapi-request-parameters-with-pydantic-validation-options-fp2</link>
      <guid>https://dev.to/pdrojack/enhancing-fastapi-request-parameters-with-pydantic-validation-options-fp2</guid>
      <description>&lt;h1&gt;
  
  
  Why Fine-Grained Validation on Request Parameters Matters
&lt;/h1&gt;

&lt;p&gt;When building modern APIs, validating incoming request data is crucial to ensure correctness, security, and maintainability. FastAPI, renowned for its seamless integration with Pydantic, already offers powerful data validation for request bodies. However, until recently, its support for expressive validation on request parameters — such as query strings, path variables, or headers — was limited to basic type checks. This gap meant developers often had to add extra manual validation or rely on less idiomatic workarounds.&lt;/p&gt;

&lt;p&gt;This article dives into a recent improvement in FastAPI that unlocks the full power of Pydantic's validation options for request parameters. We'll explore the problem FastAPI faced, how the underlying parameter functions were extended, and why exposing these validation options directly on parameters is a game-changer for API developers.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problem: Limited Validation on Request Parameters
&lt;/h1&gt;

&lt;p&gt;FastAPI leverages Pydantic models extensively to validate and parse request bodies. But for request parameters — such as query parameters, path parameters, headers, and cookies — the validation capabilities were comparatively basic. While you could specify types like &lt;code&gt;int&lt;/code&gt; or &lt;code&gt;str&lt;/code&gt;, more nuanced constraints like minimum or maximum values, string length limits, or regex patterns were not directly supported.&lt;/p&gt;

&lt;p&gt;This limitation arose because FastAPI's parameter functions, defined in &lt;code&gt;fastapi/param_functions.py&lt;/code&gt; and &lt;code&gt;fastapi/params.py&lt;/code&gt;, did not expose or forward Pydantic's &lt;code&gt;Field&lt;/code&gt; validation arguments. The &lt;code&gt;Field&lt;/code&gt; function in Pydantic allows you to define rich validation rules declaratively, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;min_length&lt;/code&gt; and &lt;code&gt;max_length&lt;/code&gt; for strings&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gt&lt;/code&gt; (greater than), &lt;code&gt;ge&lt;/code&gt; (greater or equal), &lt;code&gt;lt&lt;/code&gt; (less than), &lt;code&gt;le&lt;/code&gt; (less or equal) for numeric values&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;regex&lt;/code&gt; for pattern matching&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without forwarding these options, FastAPI's parameter declarations were limited to basic type enforcement, missing out on expressive, declarative validation.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Fix: Forwarding Pydantic Field Options in Parameter Functions
&lt;/h1&gt;

&lt;p&gt;The core of the improvement involved extending FastAPI's parameter functions (&lt;code&gt;Query&lt;/code&gt;, &lt;code&gt;Path&lt;/code&gt;, &lt;code&gt;Header&lt;/code&gt;, &lt;code&gt;Cookie&lt;/code&gt;) to accept and forward Pydantic validation options to the underlying &lt;code&gt;Field&lt;/code&gt; definitions.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works Under the Hood
&lt;/h2&gt;

&lt;p&gt;FastAPI's parameter functions are thin wrappers around Pydantic's &lt;code&gt;Field&lt;/code&gt; function. Previously, they accepted only a few arguments like &lt;code&gt;default&lt;/code&gt; and &lt;code&gt;description&lt;/code&gt;. The change introduced additional keyword arguments corresponding to Pydantic's validation parameters.&lt;/p&gt;

&lt;p&gt;For example, you can now write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Query&lt;/span&gt;

&lt;span class="nd"&gt;@app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/items/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;min_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"^fixedprefix_"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"q"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the &lt;code&gt;min_length&lt;/code&gt;, &lt;code&gt;max_length&lt;/code&gt;, and &lt;code&gt;regex&lt;/code&gt; constraints are directly passed to Pydantic's &lt;code&gt;Field&lt;/code&gt;, enabling validation of the query parameter &lt;code&gt;q&lt;/code&gt; against these rules.&lt;/p&gt;

&lt;p&gt;The implementation involved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Updating function signatures in &lt;code&gt;fastapi/param_functions.py&lt;/code&gt; to accept arbitrary keyword arguments (&lt;code&gt;**kwargs&lt;/code&gt;) representing Pydantic validation options.&lt;/li&gt;
&lt;li&gt;Passing these options through to &lt;code&gt;Field&lt;/code&gt; when constructing the parameter metadata.&lt;/li&gt;
&lt;li&gt;Adjusting &lt;code&gt;fastapi/params.py&lt;/code&gt; to handle and propagate these validation arguments appropriately.&lt;/li&gt;
&lt;li&gt;Adding comprehensive tests in &lt;code&gt;test_request_params/test_field_options.py&lt;/code&gt; to verify that validation errors are correctly raised when constraints are violated.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Impact on Developer Experience
&lt;/h2&gt;

&lt;p&gt;This change means developers can now declare rich validation rules directly on parameters without resorting to custom validators or manual checks. It aligns parameter validation capabilities with those already available for request bodies, making input validation more consistent and declarative across the board.&lt;/p&gt;

&lt;h1&gt;
  
  
  Takeaways: Leveraging Underlying Libraries for Expressive APIs
&lt;/h1&gt;

&lt;p&gt;This update to FastAPI highlights an important engineering principle: exposing the full feature set of underlying libraries through your framework's API avoids duplication and empowers users with expressive tools.&lt;/p&gt;

&lt;p&gt;Instead of reimplementing validation logic, FastAPI leverages Pydantic's battle-tested validation system by forwarding options transparently. This reduces bugs, improves maintainability, and provides a better developer experience.&lt;/p&gt;

&lt;p&gt;For API developers, this means cleaner, more readable code and fewer surprises in input validation behavior.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;By extending parameter functions to accept Pydantic validation options, FastAPI now enables fine-grained, declarative validation on query, path, header, and cookie parameters. This enhancement simplifies API development and aligns parameter validation with the robustness Pydantic brings to request bodies.&lt;/p&gt;

&lt;p&gt;If you build APIs with FastAPI, this improvement is worth exploring to write more expressive and maintainable validation logic.&lt;/p&gt;




&lt;p&gt;This article is based on the PR titled "✨ Add Pydantic validation options to request parameters" merged into the &lt;code&gt;tiangolo/fastapi&lt;/code&gt; repository. Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/fastapi-16542-add-pydantic-validation-options" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>fastapi</category>
      <category>pydantic</category>
      <category>validation</category>
      <category>api</category>
    </item>
    <item>
      <title>Enhancing llvm-strings with Explicit Encoding Support for Accurate String Extraction</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Tue, 10 Nov 2026 13:16:03 +0000</pubDate>
      <link>https://dev.to/pdrojack/enhancing-llvm-strings-with-explicit-encoding-support-for-accurate-string-extraction-2a9c</link>
      <guid>https://dev.to/pdrojack/enhancing-llvm-strings-with-explicit-encoding-support-for-accurate-string-extraction-2a9c</guid>
      <description>&lt;h1&gt;
  
  
  Why Encoding Matters in Binary String Extraction
&lt;/h1&gt;

&lt;p&gt;If you’ve ever used tools like &lt;code&gt;strings&lt;/code&gt; to extract readable text from binary files, you know how crucial correct encoding interpretation is. Misinterpreting the encoding can lead to garbled output or missed strings, especially with non-ASCII data. The LLVM project's &lt;code&gt;llvm-strings&lt;/code&gt; tool historically lacked an explicit encoding option, limiting its accuracy and compatibility with GNU &lt;code&gt;strings&lt;/code&gt; — until a recent update introduced a dedicated &lt;code&gt;--encoding&lt;/code&gt; flag.&lt;/p&gt;

&lt;p&gt;This article dives into the problem, the technical fix, and the broader lesson for anyone working with binary string extraction.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Problem: Implicit and Inflexible Encoding Assumptions
&lt;/h1&gt;

&lt;p&gt;Before this change, &lt;code&gt;llvm-strings&lt;/code&gt; assumed a single default character set without giving users control over encoding interpretation. This approach worked reasonably well for simple ASCII data but faltered with non-ASCII bytes or when running in different locales.&lt;/p&gt;

&lt;p&gt;The root cause was that the tool did not differentiate between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ASCII-only strings (where bytes with the high bit set should be rejected)&lt;/li&gt;
&lt;li&gt;Locale-dependent character sets (where the interpretation depends on the environment’s locale settings)&lt;/li&gt;
&lt;li&gt;UTF-8 encoded strings (which can use multiple bytes per character)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without explicit encoding selection, &lt;code&gt;llvm-strings&lt;/code&gt; could misinterpret bytes, either including invalid characters or missing valid multi-byte sequences. This divergence from GNU &lt;code&gt;strings&lt;/code&gt; behavior caused interoperability issues and made the tool less reliable in internationalized contexts.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Fix: Introducing the &lt;code&gt;--encoding&lt;/code&gt; Option
&lt;/h1&gt;

&lt;p&gt;The core of the solution was to add a new command-line option &lt;code&gt;--encoding&lt;/code&gt; with three possible values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;s&lt;/code&gt;: ASCII-only mode — reject any byte with the high bit set (non-ASCII bytes).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S&lt;/code&gt;: Locale-based mode — interpret bytes according to the current locale’s character set. This is the default and is POSIX-compliant.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;utf8&lt;/code&gt;: UTF-8 mode — interpret bytes as UTF-8 encoded characters, correctly handling multi-byte sequences.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How It Works Under the Hood
&lt;/h2&gt;

&lt;p&gt;The implementation involved updating the &lt;code&gt;llvm-strings.cpp&lt;/code&gt; source to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Parse the &lt;code&gt;--encoding&lt;/code&gt; argument:&lt;/strong&gt; The tool now accepts this option and validates the provided value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Adjust string extraction logic:&lt;/strong&gt; Depending on the selected encoding, the string extraction algorithm changes:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;In ASCII-only mode (&lt;code&gt;s&lt;/code&gt;), the code verifies each byte is below 0x80 and rejects sequences containing higher bytes.&lt;/li&gt;
&lt;li&gt;In locale-based mode (&lt;code&gt;S&lt;/code&gt;), the tool uses locale-aware character classification functions to determine valid characters.&lt;/li&gt;
&lt;li&gt;In UTF-8 mode (&lt;code&gt;utf8&lt;/code&gt;), the extraction logic validates UTF-8 sequences, ensuring multi-byte characters are correctly identified and extracted.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add tests and documentation:&lt;/strong&gt; Comprehensive tests were added to verify correct behavior across all encoding modes, including edge cases with invalid or mixed encodings.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By explicitly handling these encoding modes, &lt;code&gt;llvm-strings&lt;/code&gt; aligns more closely with GNU &lt;code&gt;strings&lt;/code&gt; and POSIX expectations, improving accuracy and user control.&lt;/p&gt;




&lt;h1&gt;
  
  
  Takeaway: Explicit Encoding Handling Is Essential
&lt;/h1&gt;

&lt;p&gt;This change highlights an important lesson for developers working with binary data and string extraction:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Relying on a single default encoding without explicit user control can lead to subtle bugs and interoperability issues, especially in internationalized environments.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Explicit encoding options empower users to tailor string extraction to their data’s character set, whether it’s simple ASCII, locale-specific encodings, or UTF-8. This flexibility is crucial for tools that operate on diverse binary inputs and need to be robust across platforms and locales.&lt;/p&gt;

&lt;p&gt;If you’re building or maintaining similar tools, consider how encoding assumptions affect correctness and usability.&lt;/p&gt;




&lt;p&gt;This article is based on the merged PR titled &lt;code&gt;[llvm-strings] Add --encoding={s,S,utf8} option&lt;/code&gt; in the llvm/llvm-project repository. Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/llvm-project-221794-llvm-strings-add-encoding" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llvm</category>
      <category>strings</category>
      <category>encoding</category>
      <category>localization</category>
    </item>
    <item>
      <title>Enabling Mutable Captures in Rust's Move Expressions: A Deep Dive</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Mon, 09 Nov 2026 16:31:15 +0000</pubDate>
      <link>https://dev.to/pdrojack/enabling-mutable-captures-in-rusts-move-expressions-a-deep-dive-3jop</link>
      <guid>https://dev.to/pdrojack/enabling-mutable-captures-in-rusts-move-expressions-a-deep-dive-3jop</guid>
      <description>&lt;h2&gt;
  
  
  Why Mutable Captures in Move Expressions Matter
&lt;/h2&gt;

&lt;p&gt;Rust’s ownership model is one of its defining features, enabling memory safety without a garbage collector. Move expressions—such as move closures and async blocks—are fundamental tools that transfer ownership of captured variables into a new environment. However, until recently, these constructs lacked support for mutable captures. This limitation hindered developers who needed to mutate variables captured by move expressions, forcing awkward workarounds or redesigns.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore how Rust’s compiler was enhanced to support mutable captures in move expressions, the technical challenges involved, and what this means for Rust programmers aiming to write more ergonomic and flexible async and closure code.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: No Mutable Captures in Move Expressions
&lt;/h2&gt;

&lt;p&gt;Before this change, the Rust compiler did not allow variables captured by move closures or async blocks to be mutably borrowed. For example, if you tried to mutate a variable inside a move closure, the compiler would reject it even if the capture was by value. This restriction was rooted in how the compiler analyzed and lowered these expressions internally.&lt;/p&gt;

&lt;p&gt;Move expressions require the compiler to transform high-level syntax into an abstract syntax tree (AST) representation, then analyze variable captures to enforce ownership and borrowing rules. The existing implementation in the &lt;code&gt;rustc_ast_lowering&lt;/code&gt; crate—specifically in &lt;code&gt;src/expr.rs&lt;/code&gt;—did not account for mutable captures during this lowering phase. As a result, the compiler’s borrow checker never saw mutable references in these contexts, making mutable captures impossible.&lt;/p&gt;

&lt;p&gt;This limitation was particularly painful when working with async blocks and generators, where mutation of captured state is often necessary to implement complex state machines or incremental computations.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Rust’s Compiler Was Updated to Support Mutable Captures
&lt;/h2&gt;

&lt;p&gt;The core of the fix involved updating the AST lowering logic that transforms move expressions to correctly recognize and allow mutable captures.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding AST Lowering and Capture Analysis
&lt;/h3&gt;

&lt;p&gt;Rust’s compiler front-end parses source code into an AST, a structured representation of the program. The lowering phase converts this AST into a form suitable for semantic analysis and borrow checking. During this process, variable captures—how variables from the surrounding environment are accessed inside closures or async blocks—are identified and annotated.&lt;/p&gt;

&lt;p&gt;Previously, the lowering logic treated captures in move expressions conservatively, defaulting to immutable captures only. This meant mutable borrows were never established, and the borrow checker had no opportunity to validate or permit mutation.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix in &lt;code&gt;rustc_ast_lowering/src/expr.rs&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The PR updated the lowering code to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect when a move expression captures a variable mutably.&lt;/li&gt;
&lt;li&gt;Annotate these captures accordingly in the lowered representation.&lt;/li&gt;
&lt;li&gt;Ensure that subsequent compiler stages, including borrow checking, receive the correct capture mutability information.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This involved modifying the capture analysis to differentiate between immutable and mutable captures explicitly and propagate this through the compiler’s internal data structures.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extensive Testing Across Expression Forms
&lt;/h3&gt;

&lt;p&gt;To validate the fix, the PR added numerous UI tests covering a variety of scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plain closures with mutable captures.&lt;/li&gt;
&lt;li&gt;Async blocks and async closures mutating captured variables.&lt;/li&gt;
&lt;li&gt;Generator blocks where mutable state capture is common.&lt;/li&gt;
&lt;li&gt;Nested move expressions to ensure consistent behavior in complex cases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tests not only confirmed that mutable captures were allowed but also verified that diagnostics (compiler error messages) behaved as expected when misuse occurred.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;p&gt;This change highlights several important lessons about compiler design and language feature evolution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Coordinated compiler phases:&lt;/strong&gt; Language features that affect variable capture semantics require changes in multiple compiler components—here, AST lowering and borrow checking had to be aligned.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accurate capture representation:&lt;/strong&gt; The compiler must precisely represent how variables are captured (immutable vs mutable) to enforce Rust’s strict ownership guarantees safely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Comprehensive testing:&lt;/strong&gt; Supporting a feature across diverse expression forms (closures, async, generators) demands thorough testing to prevent regressions and ensure uniform behavior.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Rust developers, this improvement means more expressive and flexible code when working with move expressions, particularly in asynchronous and generator contexts.&lt;/p&gt;




&lt;p&gt;This enhancement was merged into the Rust compiler repository. Read the full breakdown on nossletter.tech to dive even deeper into the implementation details and testing strategies.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/rust-165571-support-mutable-captures-in" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>compiler</category>
      <category>async</category>
      <category>closures</category>
    </item>
    <item>
      <title>How Terraform Improved Large HCL Output Performance by Replacing Repeated String Concatenation</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Sat, 07 Nov 2026 08:50:05 +0000</pubDate>
      <link>https://dev.to/pdrojack/how-terraform-improved-large-hcl-output-performance-by-replacing-repeated-string-concatenation-1jbg</link>
      <guid>https://dev.to/pdrojack/how-terraform-improved-large-hcl-output-performance-by-replacing-repeated-string-concatenation-1jbg</guid>
      <description>&lt;h2&gt;
  
  
  Why String Concatenation Can Kill Performance in Large Text Generation
&lt;/h2&gt;

&lt;p&gt;Generating large configuration files efficiently is critical for infrastructure-as-code tools like Terraform. When Terraform's &lt;code&gt;query -generate-config-out&lt;/code&gt; command produces huge HCL outputs, slowdowns and high memory usage can frustrate users and complicate automation pipelines. This performance bottleneck stemmed from a seemingly innocent pattern: repeated string concatenation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem with Repeated String Concatenation
&lt;/h2&gt;

&lt;p&gt;In Go, strings are immutable. Each time you concatenate strings with the &lt;code&gt;+&lt;/code&gt; operator or &lt;code&gt;+=&lt;/code&gt;, a new string is allocated and the contents copied over. This is fine for small or fixed-size strings but becomes problematic when building very large outputs incrementally.&lt;/p&gt;

&lt;p&gt;Terraform’s &lt;code&gt;internal/cloud/backend_query.go&lt;/code&gt; was accumulating generated HCL text for each resource address by repeatedly concatenating strings. As the output grew, each concatenation copied the entire accumulated string plus the new addition, leading to quadratic time complexity and ballooning memory allocations. This inefficiency was especially visible in large-scale queries, causing significant runtime delays and increased garbage collection pressure.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Per-Address *strings.Builder Instances
&lt;/h2&gt;

&lt;p&gt;To address this, the PR introduced a more scalable approach: instead of a single string accumulating all output via concatenation, Terraform now uses a dedicated &lt;code&gt;*strings.Builder&lt;/code&gt; for each resource address. &lt;/p&gt;

&lt;p&gt;A &lt;code&gt;strings.Builder&lt;/code&gt; in Go provides an efficient way to build strings by writing bytes to an internal buffer without repeated reallocations and copying. By having a separate builder per logical unit (each address), the code can append lines of HCL incrementally and linearly.&lt;/p&gt;

&lt;p&gt;This approach preserves the original grouping and ordering of HCL blocks, which is important for maintaining the output’s structure, especially when lists are interleaved. After all builders have accumulated their respective blocks, their contents are concatenated once at the end, minimizing copying and memory overhead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why This Matters
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linear Time Complexity:&lt;/strong&gt; Each piece of text is appended exactly once to a builder buffer, avoiding repeated copying.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduced Memory Allocations:&lt;/strong&gt; Builders allocate internal buffers with exponential growth, reducing the number of allocations and GC pressure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserved Output Semantics:&lt;/strong&gt; The output remains logically grouped per address, maintaining correctness.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;This change highlights a common pitfall in large-scale text generation: naive string concatenation can cause severe performance degradation. When dealing with large or numerous text fragments, consider using dedicated builders or buffers for each logical unit. This strategy achieves linear time complexity and drastically reduces memory usage.&lt;/p&gt;

&lt;p&gt;For Go developers, &lt;code&gt;strings.Builder&lt;/code&gt; is the idiomatic tool for efficient string assembly. More generally, buffering outputs per group or segment before a final concatenation can be a powerful pattern in many languages.&lt;/p&gt;

&lt;p&gt;If you are building tools that generate large configuration files, logs, or reports, watch out for repeated concatenation patterns. Profiling your code and inspecting memory allocation patterns can reveal these hidden inefficiencies.&lt;/p&gt;




&lt;p&gt;This article is based on the merged PR "TF-42218 Replaces repeated generated-HCL string concatenation with per-address builders" in the &lt;a href="https://github.com/hashicorp/terraform" rel="noopener noreferrer"&gt;hashicorp/terraform&lt;/a&gt; repository. Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/terraform-39470-tf-42218-replaces-repeated" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>performance</category>
      <category>terraform</category>
      <category>strings</category>
    </item>
    <item>
      <title>Optimizing DuckDB Scalar Aggregates: Merging Multiple Scans into One Pass</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Thu, 05 Nov 2026 09:15:13 +0000</pubDate>
      <link>https://dev.to/pdrojack/optimizing-duckdb-scalar-aggregates-merging-multiple-scans-into-one-pass-2j1p</link>
      <guid>https://dev.to/pdrojack/optimizing-duckdb-scalar-aggregates-merging-multiple-scans-into-one-pass-2j1p</guid>
      <description>&lt;h1&gt;
  
  
  Why This Optimization Matters
&lt;/h1&gt;

&lt;p&gt;If you’ve ever run complex analytical queries on large datasets, you know that scanning the same data multiple times can be painfully expensive. In DuckDB, queries with multiple scalar aggregates over the same file or table used to trigger redundant full data scans — one for each aggregate. This inefficiency bloated IO costs and slowed down query execution significantly, especially for formats like Parquet, CSV, and JSON.&lt;/p&gt;

&lt;p&gt;This article dives into a recent DuckDB improvement that tackles this problem head-on by merging sibling scalar aggregates into a single scan. We’ll explore the root cause, the technical fix, and the broader lessons for query optimization.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Problem: Redundant Full Scans for Each Scalar Aggregate
&lt;/h1&gt;

&lt;p&gt;Scalar aggregates are functions like COUNT(), SUM(), or AVG() that return a single value for an entire dataset or partition. When multiple scalar aggregates operate on the same table or file, DuckDB’s optimizer previously treated each aggregate independently. That meant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each scalar aggregate triggered its own full scan of the underlying data source.&lt;/li&gt;
&lt;li&gt;For large files or table functions, this multiplied IO costs and CPU time.&lt;/li&gt;
&lt;li&gt;The query plan duplicated scanning effort instead of sharing it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, consider a query that calculates both &lt;code&gt;COUNT(*)&lt;/code&gt; and &lt;code&gt;SUM(sales)&lt;/code&gt; on a large Parquet file. Under the old plan, DuckDB would scan the Parquet file twice — once for each aggregate — even though the data read was identical.&lt;/p&gt;

&lt;p&gt;This inefficiency was especially pronounced for external data sources like Parquet, CSV, or JSON files, where IO costs dominate query performance.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Root Cause: Lack of Aggregate Merging in the Optimizer
&lt;/h1&gt;

&lt;p&gt;The core issue was that DuckDB’s optimizer lacked a rewrite rule to combine sibling scalar aggregates operating on the same table or table function. Without this, each aggregate subquery independently triggered a full scan.&lt;/p&gt;

&lt;p&gt;The ideal approach is to merge these aggregates into a single scan that computes all aggregates simultaneously, using conditional aggregation to distinguish which rows contribute to which aggregate.&lt;/p&gt;

&lt;p&gt;However, implementing this is non-trivial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The optimizer must detect when multiple aggregates scan the same table or table function.&lt;/li&gt;
&lt;li&gt;It must merge those aggregates into a single scan node.&lt;/li&gt;
&lt;li&gt;Each aggregate needs a FILTER clause that acts as a predicate to compute the aggregate only over relevant rows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Furthermore, this optimization must be cost-aware. For native DuckDB tables, adding FILTER predicates can introduce overhead that outweighs the benefits of merging scans. Thus, the rewrite should be gated by a configurable threshold.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Fix: Introducing the &lt;code&gt;scalar_aggregate_merge&lt;/code&gt; Optimizer Rule
&lt;/h1&gt;

&lt;p&gt;To address this, the DuckDB team introduced a new optimizer rule called &lt;code&gt;scalar_aggregate_merge&lt;/code&gt;. This rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detects sibling scalar aggregates over the same table function or large catalog tables.&lt;/li&gt;
&lt;li&gt;Merges these aggregates into a single scan node.&lt;/li&gt;
&lt;li&gt;Adds per-aggregate FILTER predicates to ensure each aggregate computes over the correct subset of rows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This rewrite is implemented in &lt;code&gt;scalar_aggregate_merger.cpp&lt;/code&gt;. The code tracks identical table function calls and merges their aggregates accordingly.&lt;/p&gt;

&lt;p&gt;The optimization is gated by a configurable threshold to avoid regressions on native DuckDB tables, where the overhead of applying FILTER predicates might exceed the savings from scanning once.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works in Practice
&lt;/h3&gt;

&lt;p&gt;Imagine a query with two scalar aggregates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;read_parquet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'data.parquet'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;read_parquet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'data.parquet'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;big_sales_sum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before this change, DuckDB would scan &lt;code&gt;data.parquet&lt;/code&gt; twice: once for the COUNT and once for the SUM.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;scalar_aggregate_merge&lt;/code&gt;, DuckDB merges these scans into one pass over &lt;code&gt;data.parquet&lt;/code&gt;, computing both aggregates simultaneously. It applies FILTER clauses internally so that &lt;code&gt;SUM(amount)&lt;/code&gt; only sums rows where &lt;code&gt;amount &amp;gt; 100&lt;/code&gt;, but the file is read just once.&lt;/p&gt;

&lt;p&gt;This reduces IO significantly and speeds up query execution.&lt;/p&gt;




&lt;h1&gt;
  
  
  Takeaway: Cost-Based Aggregate Merging is Key for Performance
&lt;/h1&gt;

&lt;p&gt;This optimization highlights an important principle in query optimization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When multiple aggregates scan the same data independently, merging them into a single scan with conditional aggregation can drastically reduce IO and improve performance.&lt;/li&gt;
&lt;li&gt;However, this optimization must be cost-aware. If the overhead of filtering exceeds the saved scans, performance can degrade.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DuckDB’s approach of gating the rewrite by a configurable threshold ensures the optimization applies only when beneficial.&lt;/p&gt;

&lt;p&gt;For database engineers and optimizer developers, this serves as a reminder that seemingly straightforward optimizations require careful cost modeling to avoid regressions.&lt;/p&gt;




&lt;p&gt;This improvement in DuckDB not only boosts performance for common analytical queries over external data sources but also demonstrates how thoughtful optimizer design can yield significant real-world gains.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Credits: This article is based on the PR "Compute sibling scalar aggregates over the same table in one pass" merged into the DuckDB repository.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/duckdb-28257-compute-sibling-scalar-aggregates" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>duckdb</category>
      <category>queryoptimization</category>
      <category>database</category>
      <category>performance</category>
    </item>
    <item>
      <title>How Cilium Cut Restart Times by Reusing Compiled BPF Objects</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Mon, 02 Nov 2026 13:04:43 +0000</pubDate>
      <link>https://dev.to/pdrojack/how-cilium-cut-restart-times-by-reusing-compiled-bpf-objects-3o3k</link>
      <guid>https://dev.to/pdrojack/how-cilium-cut-restart-times-by-reusing-compiled-bpf-objects-3o3k</guid>
      <description>&lt;h1&gt;
  
  
  How Cilium Cut Restart Times by Reusing Compiled BPF Objects
&lt;/h1&gt;

&lt;p&gt;If you’ve ever worked with eBPF programs in production, you know that compiling them can be a time-consuming bottleneck, especially during restarts. In Cilium, a popular networking and security project, the agent used to recompile all BPF programs from scratch on every restart. This led to delays stretching into minutes and even caused missed regeneration deadlines in continuous integration (CI) environments.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore the root cause of this inefficiency, the technical details of the caching solution introduced, and the broader engineering lesson about build artifact reuse.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: Unnecessary Recompilation on Every Restart
&lt;/h2&gt;

&lt;p&gt;Cilium’s agent manages a set of BPF programs that it compiles using clang. Before the change, each time the agent restarted, it triggered a full recompilation of all BPF programs. This was painfully slow — in some cases, endpoint template compilations took up to 553 seconds.&lt;/p&gt;

&lt;p&gt;Why did this happen? Because the agent had no way to detect if the BPF source code or its build environment had changed since the last compilation. Without such detection, it always assumed it needed to recompile everything.&lt;/p&gt;

&lt;p&gt;This behavior caused two main issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Long startup delays:&lt;/strong&gt; Developers and CI pipelines had to wait for lengthy recompilations even if nothing changed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missed deadlines:&lt;/strong&gt; In CI, where quick feedback loops matter, these delays led to missed regeneration deadlines and slowed down testing.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Root Cause: Lack of Input Hashing and Cache
&lt;/h2&gt;

&lt;p&gt;The core reason for the redundant recompilation was the absence of a mechanism to track build inputs and reuse previously compiled artifacts.&lt;/p&gt;

&lt;p&gt;The agent’s compilation process depends on multiple inputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;BPF source files&lt;/li&gt;
&lt;li&gt;Clang compiler configuration and environment&lt;/li&gt;
&lt;li&gt;Go build ID (which can affect generated headers)&lt;/li&gt;
&lt;li&gt;Generated headers and other build artifacts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before this change, none of these inputs were hashed or checked for differences. The compilation was always triggered unconditionally, causing expensive clang invocations even if the inputs were identical.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: Input Hashing and Caching Compiled Objects
&lt;/h2&gt;

&lt;p&gt;The fix introduced a robust caching mechanism keyed by a hash that uniquely identifies the compilation inputs. Here’s how it works in detail:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hashing all relevant inputs:&lt;/strong&gt; The system computes a single hash that combines the contents of all BPF source files, the clang configuration and environment variables, the Go build ID, and any generated headers. This produces a unique fingerprint representing the exact compilation context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cache lookup on agent restart:&lt;/strong&gt; When the agent starts, it calculates this hash and checks if compiled BPF objects for this hash already exist on disk.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reuse or recompile:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If a matching cached object is found, the agent loads it directly, skipping the expensive compilation.&lt;/li&gt;
&lt;li&gt;If not, it proceeds with a normal compilation and then caches the resulting objects under the new hash.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This caching logic is primarily implemented in &lt;code&gt;pkg/datapath/loader/cache.go&lt;/code&gt;. To ensure correctness, new tests were added in &lt;code&gt;cache_test.go&lt;/code&gt; and &lt;code&gt;hash_test.go&lt;/code&gt; verifying that the hashing accurately reflects input changes and that cached objects are reused appropriately.&lt;/p&gt;

&lt;p&gt;This approach ensures that recompilation only happens when something truly changes, drastically reducing restart times.&lt;/p&gt;




&lt;h2&gt;
  
  
  Takeaway: Hashing Inputs to Cache Build Artifacts Saves Time and Resources
&lt;/h2&gt;

&lt;p&gt;Build systems and runtime components often depend on multiple inputs that rarely change between runs. Without tracking these inputs, systems waste time recompiling or rebuilding unnecessarily.&lt;/p&gt;

&lt;p&gt;By hashing all relevant inputs and caching build artifacts keyed by this hash, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid redundant expensive work&lt;/li&gt;
&lt;li&gt;Speed up restarts and deployments&lt;/li&gt;
&lt;li&gt;Reduce CPU and memory usage during builds&lt;/li&gt;
&lt;li&gt;Improve developer and CI pipeline productivity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Cilium’s case, this change turned restart times from minutes down to seconds, enabling faster iteration and more reliable CI.&lt;/p&gt;

&lt;p&gt;If you’re building systems that compile code or generate artifacts dynamically, consider implementing a similar input hashing and caching mechanism.&lt;/p&gt;




&lt;p&gt;This improvement came from the pull request titled "loader: Reuse compiled BPF objects across agent restarts" in the &lt;a href="https://github.com/cilium/cilium" rel="noopener noreferrer"&gt;cilium/cilium&lt;/a&gt; repository.&lt;/p&gt;

&lt;p&gt;Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/cilium-49087-loader-reuse-compiled-bpf" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>bpf</category>
      <category>cilium</category>
      <category>performance</category>
      <category>buildsystems</category>
    </item>
    <item>
      <title>Enhancing ggml with Fused Sparse-Attention Masks and Precision Introspection in v0.28.0</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Wed, 28 Oct 2026 21:26:05 +0000</pubDate>
      <link>https://dev.to/pdrojack/enhancing-ggml-with-fused-sparse-attention-masks-and-precision-introspection-in-v0280-3p40</link>
      <guid>https://dev.to/pdrojack/enhancing-ggml-with-fused-sparse-attention-masks-and-precision-introspection-in-v0280-3p40</guid>
      <description>&lt;h1&gt;
  
  
  Why Fused Sparse-Attention Masks Matter for ML Performance
&lt;/h1&gt;

&lt;p&gt;Sparse attention mechanisms have become a cornerstone of efficient transformer implementations, enabling models to scale by focusing computation on the most relevant parts of the input. However, supporting these sparse patterns efficiently in low-level ML compute libraries requires careful design of operations and data flow. The recent ggml v0.28.0 release tackles this challenge head-on by introducing a fused sparse-attention mask operation, alongside precision introspection APIs and cleaner mechanisms for skipping computation slots. These improvements not only simplify backend implementations but also unlock performance gains across CPU, CUDA, and Metal platforms.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problem: Inefficient Sparse-Attention Support and Skipping Logic
&lt;/h1&gt;

&lt;p&gt;Prior to this release, ggml lacked a dedicated operation to fuse sparse-attention masks with top-k selection, forcing users to rely on separate steps or less efficient workarounds. This fragmented approach increased overhead and complexity in model implementations that rely heavily on sparse attention.&lt;/p&gt;

&lt;p&gt;Additionally, the way ggml handled skipping matrix slots was problematic. Instead of an explicit sentinel value, invalid or skipped matrix IDs were treated as out-of-range indices, which complicated backend logic. This meant that the compute engines had to interpret "magic" out-of-range values as signals to skip computations, leading to brittle and error-prone code.&lt;/p&gt;

&lt;p&gt;Moreover, introspecting the precision of compute nodes was limited, which made it harder for developers and optimizations to adapt based on the exact precision used during computation.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Solution: Introducing GGML_OP_TOP_K_MASK and Cleaner APIs
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Fused Sparse-Attention Mask Operation
&lt;/h2&gt;

&lt;p&gt;The centerpiece of this release is the new &lt;code&gt;GGML_OP_TOP_K_MASK&lt;/code&gt; operation. This operator fuses the top-k selection with the application of a sparse-attention mask into a single kernel. By doing so, it reduces intermediate memory usage and kernel launch overhead, leading to more efficient execution.&lt;/p&gt;

&lt;p&gt;Implementations of this op have been provided across all major backends:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CPU:&lt;/strong&gt; Optimized multi-threaded code paths leverage SIMD instructions where possible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CUDA:&lt;/strong&gt; GPU kernels utilize efficient parallel reductions and masking to minimize warp divergence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Metal:&lt;/strong&gt; Metal shaders are crafted to exploit Apple GPUs' architecture for sparse attention.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This cross-platform consistency ensures that models using sparse attention can benefit regardless of hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  Explicit Skip Index with -1
&lt;/h2&gt;

&lt;p&gt;To simplify logic around skipping matrix slots, the release introduces support for &lt;code&gt;-1&lt;/code&gt; as a sentinel skip index in the &lt;code&gt;MUL_MAT_ID&lt;/code&gt; and &lt;code&gt;ADD_ID&lt;/code&gt; operations. This explicit value signals the backend to zero out the corresponding output row and skip computation cleanly.&lt;/p&gt;

&lt;p&gt;This change removes the ambiguity of out-of-range indices and allows backends to implement skipping more robustly and efficiently. For example, instead of checking for invalid indices and guessing their meaning, the backend can directly branch on &lt;code&gt;-1&lt;/code&gt; and avoid unnecessary work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Precision Introspection APIs
&lt;/h2&gt;

&lt;p&gt;Two new APIs, &lt;code&gt;ggml_prec_get_acc()&lt;/code&gt; and &lt;code&gt;ggml_prec_get_src()&lt;/code&gt;, have been added to query the precision of accumulation and source data on compute nodes. This enables more adaptive optimizations and debugging, as developers can programmatically determine if a node is using FP16, FP32, or other precisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Improvements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Scale and sum operations have been relaxed to support non-contiguous inputs, increasing flexibility in tensor layouts.&lt;/li&gt;
&lt;li&gt;Various throughput improvements and bug fixes have been applied to all backends, further enhancing stability and performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Why This Matters: Takeaways for ML Library Design
&lt;/h1&gt;

&lt;p&gt;This update to ggml highlights several important engineering principles for ML compute libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fused operations for common patterns:&lt;/strong&gt; Sparse attention is ubiquitous in modern transformers. Providing fused ops tailored to these patterns reduces overhead and improves maintainability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Explicit sentinel values simplify backend logic:&lt;/strong&gt; Using a dedicated skip index makes the code clearer and less error-prone than relying on out-of-range or magic indices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Precision introspection aids optimization:&lt;/strong&gt; APIs that expose compute node precision help downstream tooling and adaptive kernels tune performance dynamically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cross-platform consistency:&lt;/strong&gt; Implementing new ops across CPU, CUDA, and Metal ensures broad hardware support and consistent behavior.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these changes make ggml a more robust and performant foundation for ML workloads involving sparse attention and complex tensor operations.&lt;/p&gt;




&lt;p&gt;Credit for this deep-dive to the original PR in the ggml-org/ggml repository. Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/ggml-1676-ggml-bump-version-to" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>performance</category>
      <category>gpu</category>
      <category>sparseattention</category>
    </item>
    <item>
      <title>Breaking Down Milvus QueryView Coordinator for Better Modularity and Maintainability</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Tue, 27 Oct 2026 15:53:14 +0000</pubDate>
      <link>https://dev.to/pdrojack/breaking-down-milvus-queryview-coordinator-for-better-modularity-and-maintainability-3g31</link>
      <guid>https://dev.to/pdrojack/breaking-down-milvus-queryview-coordinator-for-better-modularity-and-maintainability-3g31</guid>
      <description>&lt;h1&gt;
  
  
  Why Modular Design Matters in Complex Systems
&lt;/h1&gt;

&lt;p&gt;In large-scale distributed systems like Milvus, coordination components often grow complex as they accumulate diverse responsibilities. The QueryView coordinator in Milvus, responsible for managing load, scheduling, schema lifecycle, and readiness, had become a tightly coupled monolith. This complexity made it challenging to maintain, extend, or even reason about individual parts independently — a common pain point in production systems where scalability and agility are critical.&lt;/p&gt;

&lt;p&gt;This article dives into how the Milvus team tackled this challenge by extracting distinct, immutable components within the QueryView coordinator. This change not only improved modularity but also paved the way for more robust scheduling and schema management with clear, stable interfaces.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problem: A Monolithic Coordinator
&lt;/h1&gt;

&lt;p&gt;Originally, the QueryView coordinator bundled several responsibilities together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Load snapshot handling:&lt;/strong&gt; Capturing the state of data load and replica distribution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replica allocation and scheduling:&lt;/strong&gt; Deciding where and how data replicas should be placed and balanced.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheduling cost calculations:&lt;/strong&gt; Using metrics to reconcile the placement of data efficiently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Schema lifecycle management:&lt;/strong&gt; Tracking schema versions and ensuring consistent reads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Readiness protocols:&lt;/strong&gt; Managing component readiness and synchronization progress.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these concerns lived in one coordinator module, leading to complex interdependencies. For example, load snapshots were mutable and intertwined with scheduling logic, making it hard to isolate bugs or introduce new scheduling strategies without risking side effects. Similarly, schema management was tightly coupled with readiness checks, complicating schema evolution.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Fix: Extracting Immutable Components and Interfaces
&lt;/h1&gt;

&lt;p&gt;The core idea behind the fix was to split the monolithic coordinator into well-defined, immutable components with clear interfaces. This separation enables each part to evolve independently and be tested in isolation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Immutable Load Snapshots and Placement Management
&lt;/h2&gt;

&lt;p&gt;Instead of mutable shared state, load information is now captured as immutable snapshots. These snapshots represent a consistent view of the cluster load and replica placements at a given point in time. By treating them as immutable, the system avoids side effects and race conditions during scheduling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scheduling with Cost-Based Reconciliation Using LogicalSize Weights
&lt;/h2&gt;

&lt;p&gt;Scheduling was enhanced by introducing cost calculations based on immutable &lt;code&gt;LogicalSize&lt;/code&gt; weights. This abstraction allows the scheduler to evaluate placement decisions quantitatively, facilitating more efficient and balanced replica allocation. The cost-based reconciliation process compares current and desired placements, driving incremental adjustments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Schema Lifecycle Management with Certified Read Schemas
&lt;/h2&gt;

&lt;p&gt;Schema handling was extracted into its own component that manages certified read schemas and snapshot bindings. This ensures that schema versions are tracked consistently and that reads always operate against a known-good schema snapshot. It decouples schema evolution from load and scheduling concerns, improving reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Readiness Protocols with Scoped Loading and Progress Fences
&lt;/h2&gt;

&lt;p&gt;Readiness checks now use scoped loading and progress fences to track component states precisely. This mechanism helps coordinate startup and recovery sequences without conflating readiness with other logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  New Interfaces to Decouple Dependencies
&lt;/h2&gt;

&lt;p&gt;To glue these components together while maintaining loose coupling, the PR introduces interfaces like &lt;code&gt;LoadInfoCatalog&lt;/code&gt; and &lt;code&gt;PrepareDataViewSchema&lt;/code&gt;. These interfaces abstract data access and preparation logic, allowing components to interact via contracts rather than concrete implementations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Maintaining Legacy Support While Removing Unreleased Formats
&lt;/h2&gt;

&lt;p&gt;The change preserves legacy recovery paths to ensure backward compatibility with existing deployments. At the same time, it removes support for unreleased or experimental formats, reducing maintenance overhead and potential confusion.&lt;/p&gt;

&lt;h1&gt;
  
  
  Lessons Learned: The Power of Clear Boundaries
&lt;/h1&gt;

&lt;p&gt;This refactoring highlights the importance of splitting complex coordination logic into immutable, well-defined components. Clear interfaces enable teams to reason about each part independently, facilitate testing, and reduce the risk of unintended side effects.&lt;/p&gt;

&lt;p&gt;For engineers working on distributed systems or large coordination modules, this approach encourages incremental integration of new features without disrupting existing workflows. It also paves the way for future optimizations, such as more advanced scheduling algorithms or schema versioning strategies.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;The Milvus team's extraction of QueryView coordinator components exemplifies how thoughtful modularization can tame complexity in distributed systems. By embracing immutability, cost-based scheduling, and interface-driven design, they improved maintainability and extensibility — a valuable blueprint for similar challenges elsewhere.&lt;/p&gt;




&lt;p&gt;Credit to the original PR in the milvus-io/milvus repository. Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/milvus-54547-feat-extract-queryview-coordinator" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>milvus</category>
      <category>distributedsystems</category>
      <category>scheduling</category>
      <category>modularity</category>
    </item>
    <item>
      <title>Optimizing JSON Column Storage in ClickHouse with SHARED Typed Paths</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Mon, 26 Oct 2026 14:51:04 +0000</pubDate>
      <link>https://dev.to/pdrojack/optimizing-json-column-storage-in-clickhouse-with-shared-typed-paths-306c</link>
      <guid>https://dev.to/pdrojack/optimizing-json-column-storage-in-clickhouse-with-shared-typed-paths-306c</guid>
      <description>&lt;h1&gt;
  
  
  Why JSON Storage Efficiency Matters in ClickHouse
&lt;/h1&gt;

&lt;p&gt;ClickHouse is a high-performance analytical database designed for fast queries on large datasets. JSON columns, which can be deeply nested and have many paths, are increasingly common as applications ingest semi-structured data. However, storing each JSON typed path as separate files quickly becomes a bottleneck, especially on object storage systems where thousands of small files cause high request overhead and degrade performance.&lt;/p&gt;

&lt;p&gt;This article explores a recent improvement in ClickHouse's JSON column storage model that introduces a &lt;code&gt;SHARED&lt;/code&gt; modifier for typed paths. This change significantly reduces the number of files and object storage requests while preserving efficient read access.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problem: File Explosion with JSON Typed Paths
&lt;/h1&gt;

&lt;p&gt;Prior to this change, each typed path in a JSON column was stored as its own set of files within MergeTree parts. For example, a JSON column with hundreds of typed paths would generate thousands of files per data part. This file explosion leads to several issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High object storage request overhead:&lt;/strong&gt; Object stores like S3 charge per request, so thousands of small files cause increased costs and latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance degradation:&lt;/strong&gt; Managing and opening many small files slows down query execution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational complexity:&lt;/strong&gt; Large numbers of files complicate maintenance and increase metadata management overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The root cause is that the storage model treats each typed path as an independent data stream, resulting in many small files instead of consolidated storage.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Solution: Introducing SHARED Typed Paths
&lt;/h1&gt;

&lt;p&gt;To address this, the PR adds a &lt;code&gt;SHARED&lt;/code&gt; modifier for JSON typed paths. Instead of creating separate files for each path, all &lt;code&gt;SHARED&lt;/code&gt; paths within a data part are grouped into a constant set of shared files.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shared files per part:&lt;/strong&gt; All &lt;code&gt;SHARED&lt;/code&gt; typed paths write their data into the same set of files rather than separate files per path.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Marks file for indexing:&lt;/strong&gt; A marks file stores offsets within granules that index the data for each path. This allows the system to locate the data for a particular path efficiently.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficient partial reads:&lt;/strong&gt; Because the marks file provides offsets, queries can read only the relevant portions of the shared files, preserving fine-grained access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compatibility:&lt;/strong&gt; The approach maintains compatibility with existing features such as &lt;code&gt;ALTER&lt;/code&gt; operations, ensuring seamless integration.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Technical Details
&lt;/h2&gt;

&lt;p&gt;The marks file acts as a directory mapping each path's data offsets within the shared files. When a query requests data for a specific path, ClickHouse uses the marks to seek to the correct position in the shared files and reads only the necessary bytes. This avoids loading all paths' data and keeps query performance high.&lt;/p&gt;

&lt;p&gt;This design cleverly balances the trade-off between file count reduction and read efficiency. By consolidating many small data streams into shared files indexed by offsets, it reduces overhead without sacrificing the ability to perform selective reads.&lt;/p&gt;

&lt;h1&gt;
  
  
  Takeaway: Consolidate Small Data Streams to Improve Storage Efficiency
&lt;/h1&gt;

&lt;p&gt;This improvement highlights an important engineering principle when dealing with many small data substreams: consolidating storage into shared files indexed by offsets can drastically reduce file system or object storage overhead.&lt;/p&gt;

&lt;p&gt;Especially in cloud environments where object storage request costs and latencies matter, reducing file counts minimizes operational costs and improves performance. At the same time, maintaining an index of offsets preserves the ability to read data selectively and efficiently.&lt;/p&gt;

&lt;p&gt;This balance is crucial for production-grade systems handling complex data types like JSON, which can easily generate many small data streams.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;The addition of &lt;code&gt;SHARED&lt;/code&gt; typed paths in ClickHouse's JSON type storage model is a practical and elegant solution to the problem of excessive file counts for wide JSON columns. By grouping paths into shared files and indexing offsets with a marks file, ClickHouse reduces object storage overhead and improves query performance without losing fine-grained read capabilities.&lt;/p&gt;

&lt;p&gt;This change exemplifies how thoughtful storage design can address real-world scalability challenges in analytical databases.&lt;/p&gt;




&lt;p&gt;Credit: This article is based on the merged PR "Add &lt;code&gt;SHARED&lt;/code&gt; typed paths to the JSON type" in the ClickHouse repository.&lt;/p&gt;

&lt;p&gt;Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/clickhouse-127000-add-shared-typed-paths" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>clickhouse</category>
      <category>json</category>
      <category>storage</category>
      <category>performance</category>
    </item>
    <item>
      <title>How Python's ssl Module Gained Support for Encrypted Client Hello (ECH) to Enhance TLS Privacy</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Sun, 25 Oct 2026 08:40:22 +0000</pubDate>
      <link>https://dev.to/pdrojack/how-pythons-ssl-module-gained-support-for-encrypted-client-hello-ech-to-enhance-tls-privacy-9bj</link>
      <guid>https://dev.to/pdrojack/how-pythons-ssl-module-gained-support-for-encrypted-client-hello-ech-to-enhance-tls-privacy-9bj</guid>
      <description>&lt;h2&gt;
  
  
  Why Encrypted Client Hello Matters for TLS Privacy
&lt;/h2&gt;

&lt;p&gt;Transport Layer Security (TLS) is the backbone of secure communication on the internet. However, until recently, a critical piece of the TLS handshake—the ClientHello message—was sent in plaintext, exposing metadata like the server name and client preferences to network observers. Encrypted Client Hello (ECH) is an emerging TLS extension designed to encrypt this initial handshake message, significantly improving user privacy and preventing passive surveillance or censorship.&lt;/p&gt;

&lt;p&gt;Python's standard library &lt;code&gt;ssl&lt;/code&gt; module is widely used for secure communications in countless applications. Yet, before this change, it lacked support for ECH, limiting developers who wanted to leverage this privacy enhancement in their Python programs.&lt;/p&gt;

&lt;p&gt;This article dives into the technical challenges and implementation details behind adding ECH support to Python's &lt;code&gt;ssl&lt;/code&gt; module, illustrating how evolving cryptographic protocols require careful integration across language boundaries.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: Missing ECH Support in Python's ssl Module
&lt;/h2&gt;

&lt;p&gt;The TLS ClientHello message initiates the handshake by communicating client capabilities and the desired server name. Traditionally, this message is unencrypted, allowing observers to see which sites a client is connecting to, even if the rest of the session is encrypted.&lt;/p&gt;

&lt;p&gt;Encrypted Client Hello (ECH) aims to fix this by encrypting the entire ClientHello message, hiding sensitive metadata from on-path adversaries. This is especially important in environments where network censorship or traffic analysis is a concern.&lt;/p&gt;

&lt;p&gt;Despite ECH's growing adoption and draft standardization, Python's &lt;code&gt;ssl&lt;/code&gt; module and its underlying C extension &lt;code&gt;_ssl&lt;/code&gt; did not support ECH. This meant Python applications could not benefit from this privacy feature, putting them at a disadvantage compared to other TLS implementations that had begun adopting ECH.&lt;/p&gt;

&lt;p&gt;The root cause was that the &lt;code&gt;_ssl&lt;/code&gt; C extension lacked the necessary hooks and logic to construct, send, and process the ECH extension data during the TLS handshake. Additionally, the Python-level &lt;code&gt;ssl.py&lt;/code&gt; interface did not expose any means to configure or enable ECH.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Fix: Extending _ssl and Python APIs to Handle ECH
&lt;/h2&gt;

&lt;p&gt;Adding ECH support required coordinated changes at multiple layers:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Enhancing the _ssl C Extension
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;_ssl&lt;/code&gt; module, implemented in C, interfaces directly with OpenSSL to perform TLS operations. To support ECH, it needed to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accept ECH configuration data (e.g., public keys and parameters) from Python code.&lt;/li&gt;
&lt;li&gt;Integrate with OpenSSL's APIs for constructing and encrypting the ClientHello message with ECH extensions.&lt;/li&gt;
&lt;li&gt;Handle server-side decryption of the ECH payload when acting as a TLS server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This involved adding new data structures and logic to parse and include ECH extension bytes in the handshake messages.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Updating the Python ssl.py Interface
&lt;/h3&gt;

&lt;p&gt;On the Python side, the &lt;code&gt;ssl&lt;/code&gt; module was extended to expose new APIs allowing developers to specify ECH configurations. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Methods to load or specify ECH keys and configurations.&lt;/li&gt;
&lt;li&gt;Options to enable or disable ECH for client connections.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By exposing these options in pure Python, developers can now opt into ECH without dealing with low-level C code.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Adding Tests and Documentation
&lt;/h3&gt;

&lt;p&gt;Supporting a complex and evolving standard like ECH requires robust testing. The PR introduced comprehensive tests that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify correct construction and encryption of ClientHello messages.&lt;/li&gt;
&lt;li&gt;Ensure server-side decryption works as expected.&lt;/li&gt;
&lt;li&gt;Test interoperability with different ECH configurations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, documentation was updated to guide users on how to use the new ECH features.&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling the Evolving Draft Specification
&lt;/h3&gt;

&lt;p&gt;ECH is still evolving, and the implementation tracks the latest draft standards. This means the code is designed to be adaptable, with clear pathways to update cryptographic parameters and message formats as the standard matures.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lessons Learned: Integrating Emerging TLS Features is a Cross-Layer Effort
&lt;/h2&gt;

&lt;p&gt;Adding support for new TLS extensions like ECH is far from trivial. It requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deep integration in the underlying TLS library bindings (_ssl in Python).&lt;/li&gt;
&lt;li&gt;Thoughtful API design to expose new features in a user-friendly way.&lt;/li&gt;
&lt;li&gt;Rigorous testing to ensure security and correctness.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This change exemplifies how evolving cryptographic standards necessitate collaboration between C-level system code and high-level language interfaces.&lt;/p&gt;

&lt;p&gt;For Python developers, this means more privacy-preserving TLS connections out of the box. For the broader community, it highlights the importance of keeping standard libraries up to date with security innovations.&lt;/p&gt;




&lt;p&gt;This work was originally contributed in the PR titled "gh-89730: Implement support for Encrypted Client Hello (ECH) in &lt;code&gt;ssl&lt;/code&gt;" in the python/cpython repository.&lt;/p&gt;

&lt;p&gt;Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/cpython-160318-gh-89730-implement-support" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>tls</category>
      <category>security</category>
      <category>cryptography</category>
    </item>
    <item>
      <title>Enhancing Distributed Streaming in Milvus: Remote TransformLog Subscriptions and MVCC Barriers</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Fri, 23 Oct 2026 17:23:24 +0000</pubDate>
      <link>https://dev.to/pdrojack/enhancing-distributed-streaming-in-milvus-remote-transformlog-subscriptions-and-mvcc-barriers-3dnj</link>
      <guid>https://dev.to/pdrojack/enhancing-distributed-streaming-in-milvus-remote-transformlog-subscriptions-and-mvcc-barriers-3dnj</guid>
      <description>&lt;h1&gt;
  
  
  Enhancing Distributed Streaming in Milvus: Remote TransformLog Subscriptions and MVCC Barriers
&lt;/h1&gt;

&lt;p&gt;Distributed systems that rely on streaming replication face a delicate balance between efficiency, consistency, and fault tolerance. Milvus, a popular vector database, recently tackled a subtle but critical issue in its streaming replication mechanism. By introducing remote TransformLog subscriptions with ordered, resumable delivery and multi-version concurrency control (MVCC) barriers, Milvus now supports more reliable recovery and consistent query progress tracking.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore the problem Milvus faced, the technical mechanisms introduced in the fix, and the broader lessons for anyone implementing distributed streaming with strong consistency guarantees.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: Inefficient Recovery and Inconsistent Streaming Progress
&lt;/h2&gt;

&lt;p&gt;Before this change, Milvus’s streaming replication lacked support for remote TransformLog subscriptions that could deliver entries in order and resume from interruptions. This gap led to two main issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inefficient recovery:&lt;/strong&gt; Without resumable cursors and ordered delivery, replaying logs during recovery was unreliable and potentially redundant.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inconsistent query progress tracking:&lt;/strong&gt; The system did not preserve MVCC barriers properly, which are essential for snapshot isolation during queries. This caused checkpoints to advance prematurely and queries to see inconsistent or stale data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, the backpressure mechanism was simplistic — it relied on a scanner mode rather than actual cache occupancy, which failed to regulate load effectively and maintain stable delivery rates.&lt;/p&gt;

&lt;p&gt;These issues combined to create a streaming replication system that was fragile under failure conditions and complicated to maintain strong consistency guarantees.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Fix: Remote Subscriptions, MVCC Barriers, and Cache-Aware Backpressure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Remote TransformLog Subscriptions with Resumable Cursors
&lt;/h3&gt;

&lt;p&gt;The core innovation was introducing a new &lt;code&gt;SubscribeTransform&lt;/code&gt; RPC mechanism that supports both local and remote owner routing. This subscription model includes a handshake protocol to establish and close subscriptions gracefully. Key features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ordered Entry and SyncUp delivery:&lt;/strong&gt; Ensuring that TransformLog entries arrive in the correct sequence, which is crucial for consistent replay and state updates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Resumable cursors:&lt;/strong&gt; If a connection drops or is interrupted, the subscription can resume from the last known position, avoiding redundant processing and speeding up recovery.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Backoff and reconnect strategies:&lt;/strong&gt; Failed subscription attempts back off exponentially, and reconnects are suspended when there are no active subscriptions, conserving resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Idle stream reclamation:&lt;/strong&gt; Streams that are no longer in use are cleaned up promptly, preventing resource leaks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Aligning Recovery with WAL Consumer
&lt;/h3&gt;

&lt;p&gt;Recovery logic was aligned with the Write-Ahead Log (WAL) Consumer by filtering replay events before they reach data-only handlers. This ensures that replayed events are consistent and that recovery proceeds in a controlled manner.&lt;/p&gt;

&lt;h3&gt;
  
  
  MVCC Barrier Coordination
&lt;/h3&gt;

&lt;p&gt;MVCC barriers are preserved and scoped progress is published in WAL order without advancing durable checkpoints prematurely. This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Volatile barriers are queued until RecoveryStorage confirms prefix completeness:&lt;/strong&gt; This prevents queries from seeing inconsistent snapshots.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Durable checkpoints advance only after safe conditions:&lt;/strong&gt; Avoiding premature checkpoint advancement maintains snapshot isolation and query correctness.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cache-Aware Backpressure
&lt;/h3&gt;

&lt;p&gt;The previous backpressure mechanism based on scanner mode was replaced with a more sophisticated cache-occupancy-based admission control:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WAB cache uses capacity and TTL eviction:&lt;/strong&gt; This ensures that the cache does not overflow and that stale entries are evicted timely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RecoveryStorage consumption constraints:&lt;/strong&gt; These constraints help regulate admission based on actual resource usage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Configurable slowdown and rejection thresholds:&lt;/strong&gt; When the cache occupancy crosses certain thresholds, the system slows down or rejects new entries to maintain stability.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Additional Improvements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WALSummary reads reuse verified chunk footers:&lt;/strong&gt; This optimization prevents repopulation of retired entries, improving efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Support for independent reader cancellation and GC snapshot protection:&lt;/strong&gt; This enhances the robustness of concurrent reads and garbage collection.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Takeaway: Combining Resumable Cursors, MVCC Barriers, and Backpressure for Strong Consistency
&lt;/h2&gt;

&lt;p&gt;Implementing distributed streaming subscriptions with strong consistency is challenging. Milvus’s approach highlights several key principles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Resumable cursors and handshake protocols are essential&lt;/strong&gt; for robust, ordered, and fault-tolerant delivery.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MVCC barriers must be carefully coordinated&lt;/strong&gt; to preserve snapshot isolation and prevent premature checkpoint advancement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Backpressure should be cache-aware and resource-sensitive,&lt;/strong&gt; not simplistic or mode-based, to maintain stability under load.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these mechanisms enable efficient recovery, consistent query progress tracking, and reliable streaming replication.&lt;/p&gt;

&lt;p&gt;For engineers building distributed streaming systems, this case study underscores the importance of integrating consistency controls with resource management and connection resilience.&lt;/p&gt;




&lt;p&gt;This article is based on the merged PR in the &lt;a href="https://github.com/milvus-io/milvus" rel="noopener noreferrer"&gt;milvus-io/milvus&lt;/a&gt; repository titled "feat: add remote TransformLog subscriptions and MVCC barriers." Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/milvus-54344-feat-add-remote-transformlog" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>distributedsystems</category>
      <category>streaming</category>
      <category>consistency</category>
      <category>replication</category>
    </item>
    <item>
      <title>How Milvus Improved Distributed Resource Loading with Streaming and Centralized Management</title>
      <dc:creator>Priyadarshan Singh</dc:creator>
      <pubDate>Thu, 22 Oct 2026 13:34:36 +0000</pubDate>
      <link>https://dev.to/pdrojack/how-milvus-improved-distributed-resource-loading-with-streaming-and-centralized-management-4b60</link>
      <guid>https://dev.to/pdrojack/how-milvus-improved-distributed-resource-loading-with-streaming-and-centralized-management-4b60</guid>
      <description>&lt;h2&gt;
  
  
  Why Resource Loading Matters in Distributed Query Systems
&lt;/h2&gt;

&lt;p&gt;In distributed systems like Milvus, efficient and reliable resource management is critical. Analyzer files—key resources used during query processing—must be fetched, validated, and kept consistent across multiple components. Failures or stale data in this process can cause query errors, inconsistent results, or even system instability. This article explores a recent Milvus improvement that overhauled how analyzer file resources are prepared, moving from legacy RPCs and local caches prone to transient failures, to a robust streaming client with centralized metadata management.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem with Legacy Resource Loading
&lt;/h2&gt;

&lt;p&gt;Previously, Milvus fetched analyzer file resources using older RPC mechanisms and local caching strategies. These legacy approaches suffered from several issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No batch fetching:&lt;/strong&gt; Resources were requested individually, increasing overhead and latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lack of centralized metadata:&lt;/strong&gt; Without a single source of truth, metadata could become inconsistent or stale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Poor concurrency coordination:&lt;/strong&gt; Multiple components might redundantly download the same resource without coordination.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inadequate retry and expiration handling:&lt;/strong&gt; Transient IO errors often caused failures, and caches lacked time-to-live (TTL) policies, leading to stale data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These limitations led to validation failures in the query coordinator and runners, inconsistent resource states, and unreliable query execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  The New Streaming Client and AnalyzerResourceManager
&lt;/h2&gt;

&lt;p&gt;The core of the fix is introducing a streaming client that supports a new batch FetchFileResources RPC. This API can fetch multiple resource metadata and content items by their IDs or names in a single request, dramatically improving efficiency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Centralized Metadata Management
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;AnalyzerResourceManager&lt;/code&gt; acts as the central authority for managing resource metadata. It:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetches metadata in batches via the streaming client.&lt;/li&gt;
&lt;li&gt;Coordinates concurrent download requests to avoid duplicate work.&lt;/li&gt;
&lt;li&gt;Implements shared cancellation so that if one component cancels, others depending on the same resource are notified.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Robust Download and Caching
&lt;/h3&gt;

&lt;p&gt;Downloads are retried locally on transient failures, reducing the chance of query errors due to momentary network glitches. Files are cached with TTL-based expiration, ensuring that stale data is refreshed proactively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Validation Integration
&lt;/h3&gt;

&lt;p&gt;Validation logic is routed through the streaming client, which verifies resource integrity against the fetched metadata. This ensures that corrupted or incomplete resources are detected early, with precise status errors returned to the caller.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runner Lifecycle Improvements
&lt;/h3&gt;

&lt;p&gt;Runners—components that execute queries—now pin exact resource bindings and include schema IDs in their identity. This guarantees that the runner's resource environment is stable and consistent throughout its lifecycle.&lt;/p&gt;

&lt;p&gt;Additionally, if a runner is unavailable, it can be prepared on demand using retry logic after releasing its admission scope. This ensures that resources are always available during write-ahead log (WAL) replay and query execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;This change highlights several important principles for distributed resource management:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Batching and streaming reduce overhead:&lt;/strong&gt; Fetching multiple resources in a single streaming RPC is more efficient than many individual requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Centralized metadata prevents inconsistency:&lt;/strong&gt; A single source of truth for resource metadata avoids stale or conflicting information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coordinated concurrency avoids redundant work:&lt;/strong&gt; Managing concurrent downloads and cancellations reduces wasted network and computation resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explicit lifecycle management improves stability:&lt;/strong&gt; Pinning resources to runner lifecycles and including schema IDs ensures consistent execution environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Robust retry and caching policies reduce transient failures:&lt;/strong&gt; Handling IO errors locally and using TTL caches minimizes query disruptions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these improvements make Milvus's distributed query execution more reliable and performant.&lt;/p&gt;




&lt;p&gt;This article is based on the PR "fix: prepare analyzer file resources through streaming client" merged into the milvus-io/milvus repository. Read the full breakdown on nossletter.tech.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nossletter.tech/digest/milvus-54302-fix-prepare-analyzer-file" rel="noopener noreferrer"&gt;Nossletter&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>distributedsystems</category>
      <category>rpc</category>
      <category>resourcemanagement</category>
      <category>milvus</category>
    </item>
  </channel>
</rss>
