supabase / edge-runtime

A server based on Deno runtime, capable of running JavaScript, TypeScript, and WASM services.
MIT License
691 stars 62 forks source link

feat: use `DuplexStream` instead of `UnixStream` to communicate with workers #320

Closed nyannyacha closed 7 months ago

nyannyacha commented 7 months ago

What kind of change does this PR introduce?

Refactor

Description

This PR changes the stream type used to communicate between workers to DuplexStream instead of UnixStream to improve request throughput.

It was tested on a local machine, so it's imprecise, but it showed an improvement of about 10% in request throughput per second.

List of arguments to be created due to the introduction of this PR

Figure1. UnixStream, Debug

unixstream_debug

Figure2. DuplexStream, Debug

duplexstream_debug

Figure3. UnixStream, Release

unixstream_release

Figure4. DuplexStream, Release

duplexstream_release

Figure5. DuplexStream, Debug (examples/chunked-text, TCP_NODELAY OFF)

duplex-chunked-debug

Figure6. DuplexStream, Debug (examples/chunked-text, TCP_NODELAY ON)

스크린샷 2024-04-17 오후 1 32 45
nyannyacha commented 7 months ago

Note: Please keep a close eye on stage infra to ensure that there are no runtime issues after merging this PR. (But I don't expect any issues.)

laktek commented 7 months ago

@nyannyacha Can you prefix this PR as a feat (so it will create a minor release)

github-actions[bot] commented 7 months ago

:tada: This PR is included in version 1.44.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: