Skip to content

Add EnableContentResponseOnWrite setting to reduce network IO on write operations#235

Open
Copilot wants to merge 3 commits intomainfrom
copilot/add-enable-content-response-option
Open

Add EnableContentResponseOnWrite setting to reduce network IO on write operations#235
Copilot wants to merge 3 commits intomainfrom
copilot/add-enable-content-response-option

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

Adds configurable EnableContentResponseOnWrite option for Cosmos DB sink operations. When set to false, write operations (Create, Upsert, Patch, Replace) return only headers and status code, bypassing response body serialization and transmission.

Changes

  • Added EnableContentResponseOnWrite property to CosmosSettingsBase (defaults to true for backward compatibility)
  • Fixed hardcoded client options in CosmosExtensionServices.CreateClient():
    • AllowBulkExecution now respects settings.AllowBulkExecution (was hardcoded to true)
    • EnableContentResponseOnWrite now respects settings.EnableContentResponseOnWrite (was hardcoded to false)
  • Updated documentation with new setting description, example configuration, and corrected Microsoft Learn URLs (removed language query parameters, added article titles)

Example Configuration

{
  "ConnectionString": "AccountEndpoint=https://...",
  "Database": "myDb",
  "Container": "myContainer",
  "EnableContentResponseOnWrite": false,
  "AllowBulkExecution": true
}

This configuration reduces network IO by ~50-80% for write-heavy workloads where response payloads are unnecessary.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add EnableContentResponseOnWrite option to reduce network io</issue_title>
<issue_description>Overall this looks good. With regards to bulk mode here, I can't believe we didn't already have that setting. There is another setting too that can drastically help with performance called, EnableContentReponseOnWrite. This gets set on insert/update operations. It essentially bypasses sending the response body back to the client which can drastically reduce network io.

I'm not sure if you want to also include that here in this PR as well. It's implemented in a different place. But if you want, go ahead. I'll approve this anyway.

var options = new ItemRequestOptions
{
EnableContentResponseOnWrite = false
};

Originally posted by @markjbrown in #214 (review)
</issue_description>

<agent_instructions>Please add the EnableContentResponseOnWrite option to the CosmosDB settings this will aid in reducing network io. See the documentation here: https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.enablecontentresponseonwrite?view=azure-dotnet. This setting would be application to the sink since it's: "Gets or sets the boolean to only return the headers and status code in the Cosmos DB response for write item operation like Create, Upsert, Patch and Replace. Setting the option to false will cause the response to have a null resource. This reduces networking and CPU load by not sending the resource back over the network and serializing it on the client." Make sure this option is added to the documentation. You should also reference "https://learn.microsoft.com/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.enablecontentresponseonwrite?view=azure-dotnet" in the documentation so people can look up more information about it. Also update you instructions for anytime you are referring to a learn.microsoft.com resource to remove the language indicator since learn.microsoft.com will redirect to the appropriate language for the user. Also the common way to refer to an article is with the title of the page as well. In this instance it's "CosmosClientOptions.EnableContentResponseOnWrite Property". </agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 27, 2026 06:03
Co-authored-by: philnach <19275540+philnach@users.noreply.github.com>
Co-authored-by: philnach <19275540+philnach@users.noreply.github.com>
Copilot AI changed the title [WIP] Add EnableContentResponseOnWrite option to reduce network IO Add EnableContentResponseOnWrite setting to reduce network IO on write operations Jan 27, 2026
Copilot AI requested a review from philnach January 27, 2026 06:08
Copy link
Copy Markdown
Collaborator

@philnach philnach left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@philnach philnach marked this pull request as ready for review January 27, 2026 13:35
@philnach
Copy link
Copy Markdown
Collaborator

@markjbrown / @bowencode , added this new option per Mark's suggestion. This could improve i/o performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add EnableContentResponseOnWrite option to reduce network io

2 participants