Skip to content

async_hooks: prototype for v8 reimplementation of AsyncLocalStorage - #42393

Closed
Qard wants to merge 1 commit into
nodejs:mainfrom
Qard:v8-context-storage
Closed

Qard wants to merge 1 commit into
nodejs:mainfrom
Qard:v8-context-storage

Conversation

@Qard

@Qard Qard commented Mar 18, 2022

Copy link
Copy Markdown
Member

This is an experiment in moving the machinery necessary for AsyncLocalStorage away from async_hooks and into V8 itself. The purpose is for better performance by entirely eliminating the unnecessary event sequence component of async_hooks and to enable sharing storage state with V8. This is very much a proof-of-concept in its current state. It's failing a bunch of tests still, that's expected, it's not complete yet.

Feel free to have a look and provide feedback on the direction if you like, just keep in mind this is not done yet.

@Qard Qard added v8 engine Issues and PRs related to the V8 dependency. async_hooks Issues and PRs related to the async hooks subsystem. labels Mar 18, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Mar 18, 2022
@Qard
Qard force-pushed the v8-context-storage branch from e0323df to 1c0f44a Compare March 18, 2022 19:45
@RaisinTen

Copy link
Copy Markdown
Member

The purpose is for better performance

Do you have an estimate of how much of a performance gain this has?

@Qard

Qard commented Mar 21, 2022

Copy link
Copy Markdown
Member Author

Not yet. Still just focused on making it work. I'll do measurements later.

@Qard

Qard commented Apr 19, 2022

Copy link
Copy Markdown
Member Author

Had some discussions with V8 folks and they're not keen on moving this much of the API into V8. However, there are some new things in V8 that should help to accommodate this need with a bit of alterations. Certainly https://chromium-review.googlesource.com/c/v8/v8/+/2005849 should be helpful. I'll work on this some more soon. :)

@Qard

Qard commented May 18, 2022

Copy link
Copy Markdown
Member Author

Pretty sure I'll be able to find a bit more time for this soon. Just challenging with some big projects on my plate getting wrapped up soon and currently being a one person team. My team is hiring if you're looking for piles of stuff to do. 😅

@Qard
Qard force-pushed the v8-context-storage branch from 1c0f44a to 87c363b Compare June 28, 2022 03:12
Reimplementation of AsyncLocalStorage to bypass async_hooks.
@Qard
Qard force-pushed the v8-context-storage branch from 87c363b to d5507ce Compare June 28, 2022 23:41
@Qard

Qard commented Jul 11, 2022

Copy link
Copy Markdown
Member Author

Did a bit of restructuring recently to move away from V8 changes. Still more work to do and needs some refactoring to work better when I add support for promises and timers.

@Qard

Qard commented Jan 24, 2023

Copy link
Copy Markdown
Member Author

Closing as I haven't had the time for this and it sounds like there's some other similar efforts incoming. 😅

@Qard Qard closed this Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooks Issues and PRs related to the async hooks subsystem. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants