You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that in current implementation under the hood axios client is used. However since this lib is a client to DB, the performance could be critical.
There's a http client https://github.com/nodejs/undici that doesn't rely on node's http implementation which make it faster. Also it likely become a underlying implementation of fetch in future versions of node.
I see that you're passing in most cases http request function as a dependency, so maybe it worth to allow passing custom request function to connection-factory.ts functions as well? Or just replace axios with undici by default to achieve maximum performance?
The text was updated successfully, but these errors were encountered:
Thank you for your suggestion. I wasn't aware of that library's existence and have only used axios (somewhat bloaty and opinionated - features some default behaviors that are difficult to opt-out of), node-fetch and Node.js native fetch (a recent addition, still deemed unstable, doesn't support req timeouts and needs AbortController/AbortSignal boilerplate for that purpose) for server-side HTTP requests.
undici looks promising and having seen the benchmarks, I'm certainly in favor of removing axios dependency. It also supports timeouts (with the possibility to set headersTimeout and bodyTimeout separately).
I reckon that the best option would be to use undici by default and also allow the user to optionally pass a custom HTTP GET/POST function that satisfies the type. The latter could be useful i.e. when instrumenting the app for distributed tracing or timing the DB requests for metrics collection.
Hi.
I see that in current implementation under the hood
axios
client is used. However since this lib is a client to DB, the performance could be critical.There's a http client https://github.com/nodejs/undici that doesn't rely on node's http implementation which make it faster. Also it likely become a underlying implementation of
fetch
in future versions of node.I see that you're passing in most cases http request function as a dependency, so maybe it worth to allow passing custom request function to
connection-factory.ts
functions as well? Or just replace axios with undici by default to achieve maximum performance?The text was updated successfully, but these errors were encountered: