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

poc: server #1933

Closed
wants to merge 2 commits into from
Closed

poc: server #1933

wants to merge 2 commits into from

Conversation

Uzlopak
Copy link
Collaborator

@Uzlopak Uzlopak commented Nov 26, 2023

This is a poc for octokit/webhooks.js#932

I think I will also take some parts of this PR to the beta. E.g. loglevel is not passed through every layer, resulting in logging everything, which can slow down significantly.

I used npm link on the @octokit/webhooks.js branch I proposed to test it here. So the ci wont work.

Anyway here some naive benchmarks.

before:


┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬───────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg     │ Stdev   │ Max   │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼───────┤
│ Latency │ 1 ms │ 2 ms │ 6 ms  │ 7 ms │ 2.28 ms │ 1.45 ms │ 40 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴───────┘
┌───────────┬────────┬────────┬────────┬────────┬─────────┬────────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%    │ 97.5%  │ Avg     │ Stdev  │ Min    │
├───────────┼────────┼────────┼────────┼────────┼─────────┼────────┼────────┤
│ Req/Sec   │ 2167   │ 2167   │ 3813   │ 4009   │ 3607.91 │ 546.98 │ 2166   │
├───────────┼────────┼────────┼────────┼────────┼─────────┼────────┼────────┤
│ Bytes/Sec │ 321 kB │ 321 kB │ 565 kB │ 593 kB │ 534 kB  │ 81 kB  │ 321 kB │
└───────────┴────────┴────────┴────────┴────────┴─────────┴────────┴────────┘

Req/Bytes counts sampled once per second.
# of samples: 11

40k requests in 11.01s, 5.87 MB read

Because logging is not passed through the original performance is about 30 k/ 10 secs.

after:

Running 10s test @ http://127.0.0.1:3000/
10 connections


┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬───────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg     │ Stdev   │ Max   │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼───────┤
│ Latency │ 0 ms │ 0 ms │ 4 ms  │ 4 ms │ 0.57 ms │ 1.04 ms │ 31 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴───────┘
┌───────────┬────────┬────────┬─────────┬─────────┬────────┬────────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%     │ 97.5%   │ Avg    │ Stdev  │ Min    │
├───────────┼────────┼────────┼─────────┼─────────┼────────┼────────┼────────┤
│ Req/Sec   │ 4727   │ 4727   │ 8047    │ 8187    │ 7675.2 │ 994.42 │ 4726   │
├───────────┼────────┼────────┼─────────┼─────────┼────────┼────────┼────────┤
│ Bytes/Sec │ 591 kB │ 591 kB │ 1.01 MB │ 1.02 MB │ 959 kB │ 124 kB │ 591 kB │
└───────────┴────────┴────────┴─────────┴─────────┴────────┴────────┴────────┘

Req/Bytes counts sampled once per second.
# of samples: 10

77k requests in 10.02s, 9.59 MB read

@Uzlopak Uzlopak requested a review from a team as a code owner November 26, 2023 01:52
'use strict';

const { sign } = require("@octokit/webhooks-methods");
const { Server, createProbot } = require("../lib");

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable createProbot.
async (req: IncomingMessage, res: ServerResponse) => {
const handler =
simpleRouter[req.method as "POST"]?.[req.url!] || notFoundHandler;
await handler(req, res);

Check failure

Code scanning / CodeQL

Unvalidated dynamic method call High

Invocation of method with
user-controlled
name may dispatch to unexpected target and cause an exception.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, yes :) prototype pollution is possible :P

@Uzlopak Uzlopak closed this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant