Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(serverless): concurrent requests #616

Merged
merged 6 commits into from
Feb 25, 2023

Conversation

QuiiBz
Copy link
Member

@QuiiBz QuiiBz commented Feb 25, 2023

About

This is the first step to support concurrent requests.

Previously, only a single isolate could run at the same time, due to a lock being acquired on a global map. If a request was blocking due to e.g a setTimeout, all subsequent requests (including other deployments) would block and resume after the first was completed.

This PR allows multiple isolates to run at the same time, across a pool of workers to better dispatch the work. It also introduces a new LAGON_WORKERS environment variable to easily customize the size of the worker's pool. The next step is to start multiple times an isolate for a given deployment if it receives requests at the same time.

As such, requesting multiple deployments at the same time (< LAGON_WORKERS) improves the number of req/s instead of decreasing it:

Before:

  • Single deployment ~58k req/s
  • Multiple deployments ~54k req/s
    image

After:

  • Single deployment ~70k req/s
  • Multiple deployments ~82k req/s
    image

@vercel
Copy link

vercel bot commented Feb 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated
dashboard ⬜️ Ignored (Inspect) Visit Preview Feb 25, 2023 at 5:48PM (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Feb 25, 2023 at 5:48PM (UTC)
storybook ⬜️ Ignored (Inspect) Visit Preview Feb 25, 2023 at 5:48PM (UTC)
www ⬜️ Ignored (Inspect) Visit Preview Feb 25, 2023 at 5:48PM (UTC)

@QuiiBz QuiiBz marked this pull request as ready for review February 25, 2023 17:44
@QuiiBz QuiiBz merged commit 16b0a43 into main Feb 25, 2023
@QuiiBz QuiiBz deleted the refactor/serverless-concurrent-worker branch February 25, 2023 18:27
@QuiiBz QuiiBz mentioned this pull request Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant