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

feat(agenda): add drainJobsBeforeClose option to agenda settings #2558

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

Romakita
Copy link
Collaborator

Information

Type Breaking change
Feature No

Use agenda.drain() instead of agenda.stop() if the drainJobsBeforeClose option is true.

Copy link

Benchmarks

  • Machine: linux x64 | 4 vCPUs | 15.6GB Mem
  • Node: v16.20.2
  • Run: Thu Dec 28 2023 11:12:23 GMT+0000 (Coordinated Universal Time)
  • Method: autocannon -c 100 -d 10 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)
Version Router Requests/s Latency Throughput/Mb
fastify 3.29.4 56937.6 17.08 10.15
nest-fastify 8.4.3 50727.3 19.21 9.05
koa 2.13.4 39434.2 24.85 7.03
fastify-injector 3.29.4 28717.8 34.29 6.54
express 4.18.1 12122.5 81.77 2.16
tsed-koa 7.53.0 11774.4 84.18 10.29
fastify-big-json 3.29.4 11161.6 88.80 128.40
nest 8.4.3 10944.8 90.61 2.63
express-injector 4.18.1 10025.0 98.93 2.28
tsed-express 7.53.0 9550.2 103.81 1.75
express-morgan 4.18.1 7543.8 131.37 1.35

Explanation

The benchmark shows a performance difference between the frameworks. We note that Ts.ED is often last. In fact, Ts.ED uses features useful to a production application which reduce its performance.

For example, Ts.ED initializes a sandbox (async_hook) for each request in order to work in an isolated context if necessary.
It also initializes the elements necessary for monitoring requests in a log manager.

All this at a necessary cost that reflects the reality of a production application ;)

@Romakita Romakita merged commit 5a40cdb into production Jan 3, 2024
34 checks passed
@Romakita Romakita deleted the feat-agenda-drain branch January 3, 2024 08:46
@Romakita
Copy link
Collaborator Author

Romakita commented Jan 3, 2024

🎉 This PR is included in version 7.55.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant