Skip to content

Conversation

@mcollina
Copy link
Member

Fixes #1330

To avoid conflicts, this is based on #1328, and it will need to be rebased once that lands.

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows Code of conduct

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I left a couple of comments.


const fastify = Fastify()

fastify.get('/', { schema: { response } }, function (req, reply) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test with promises as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be included in #1328

@delvedor delvedor added bugfix Issue or PR that should land as semver patch backport 1.x Issue or pr that should be backported to Fastify v1 labels Dec 19, 2018
@mcollina
Copy link
Member Author

I've rebased on top of master. PTAL.

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@cemremengu cemremengu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@allevo
Copy link
Member

allevo commented Dec 19, 2018

Can you run some benchmarks?

@mcollina
Copy link
Member Author

sent-refactor:


$ autocannon -c 100 -d 5 -p 10 localhost:3000
Running 5s test @ http://localhost:3000
100 connections with 10 pipelining factor

┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬──────────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg     │ Stdev   │ Max      │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼──────────┤
│ Latency │ 0 ms │ 0 ms │ 9 ms  │ 9 ms │ 1.19 ms │ 3.03 ms │ 39.73 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴──────────┘
┌───────────┬─────────┬─────────┬───────┬─────────┬─────────┬────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%   │ 97.5%   │ Avg     │ Stdev  │ Min     │
├───────────┼─────────┼─────────┼───────┼─────────┼─────────┼────────┼─────────┤
│ Req/Sec   │ 75775   │ 75775   │ 79231 │ 80319   │ 78854.4 │ 1637   │ 75774   │
├───────────┼─────────┼─────────┼───────┼─────────┼─────────┼────────┼─────────┤
│ Bytes/Sec │ 12.4 MB │ 12.4 MB │ 13 MB │ 13.2 MB │ 12.9 MB │ 267 kB │ 12.4 MB │
└───────────┴─────────┴─────────┴───────┴─────────┴─────────┴────────┴─────────┘

Req/Bytes counts sampled once per second.

394k requests in 5.04s, 64.7 MB read

master:

$ autocannon -c 100 -d 5 -p 10 localhost:3000
Running 5s test @ http://localhost:3000
100 connections with 10 pipelining factor

┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬──────────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg     │ Stdev   │ Max      │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼──────────┤
│ Latency │ 0 ms │ 0 ms │ 9 ms  │ 9 ms │ 1.19 ms │ 3.03 ms │ 48.69 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴──────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg     │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec   │ 76543   │ 76543   │ 78783   │ 80703   │ 78726.4 │ 1324.42 │ 76510   │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 12.6 MB │ 12.6 MB │ 12.9 MB │ 13.2 MB │ 12.9 MB │ 217 kB  │ 12.5 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘

Req/Bytes counts sampled once per second.

394k requests in 5.04s, 64.6 MB read

Copy link
Member

@allevo allevo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina mcollina merged commit 09becaf into master Dec 20, 2018
@mcollina mcollina deleted the sent-refactor branch December 20, 2018 09:03
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport 1.x Issue or pr that should be backported to Fastify v1 bugfix Issue or PR that should land as semver patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants