Improve API call latency #28
Closed
jpbourgeon
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
node-fetchreferences no dependency toundiciin itspackage.json. AFAIKundicipowers thefetchfeature ofnode.js >= 18.xbut is not related tonode-fetch. Did you confusednode-fetchwithnode.js?If we do it well, we wouldn't be tied to
node.js. To me being able to useitty-awsin other runtime context is tied to our architecturing choices. This is why I suggest adopting an adapter/middleware architecture in another discussion. We could then have alternative implementation of common interfaces from any environment and inject any flavour of external dependency needed to make it work.This benchmark compares
node-fetchtoundici, and although it is a bit old, it shows thatundici fetchoutperformsnode-fetcheven with a custom HTTP agent. Furthermore, there are alternatives to fetch in theundiciAPI that need to be explored, since they are way faster than their ownfetchmethod (see their internal benchmark):stream,dispatch,requestorpipeline.All reactions