question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

undici pipelining & idempotent

See original GitHub issue

If you want to take advantage of HTTP pipelining with undici you should probably set the idempotent: true option to the POST/PUT requests that are idempotent, e.g. /_bulk. Otherwise undici won’t pipeline them.

Refs: https://undici.nodejs.org/#/docs/api/Dispatcher?id=parameter-dispatchoptions

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
delvedorcommented, Feb 21, 2022

It is very important that the client fully consumes any and all response bodies. Might be worth to add to documentation if end-users are able to have streaming responses.

By default, the client will always consume the body (you can find here how undici is being used), but advanced users can pass the asStream option which will give them back the raw stream from undici. You are right that we should mention the risks of doing so in the docs 😃

1reaction
ronagcommented, Feb 21, 2022

Elasticsearch has no timeout or pipelining limit and sends no hints 😃

Then you might want to set keepAliveTimeout: 5 * 60e3 or something so that undici doesn’t aggressively disconnect. The default is quite short to be safe.

Read more comments on GitHub >

github_iconTop Results From Across the Web

undici/README.md - UNPKG
27, undici - pipeline x 31,321 ops/sec ±0.77% (276 runs sampled) ... 111, * `idempotent: Boolean`, whether the requests can be safely retried...
Read more >
undici - npm
Start using undici in your project by running `npm i undici`. ... Non-idempotent requests will not be pipelined in order to avoid indirect...
Read more >
undici 4.5: A Modern HTTP/1.1 Client for Node.js - Morioh
idempotent : Boolean, whether the requests can be safely retried or not. If false the request won't be sent until all preceding requests...
Read more >
HTTP pipelining - Wikipedia
HTTP pipelining is a feature of HTTP/1.1 which allows multiple HTTP requests to be sent over a single TCP connection without waiting for...
Read more >
github.com-nodejs-undici_-_2021-02-17_21-48-37
An HTTP/1.1 client, written from scratch for Node.js undici A HTTP/1.1 ... Non-idempotent requests will not be pipelined in orderto avoid ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found