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

[Ingest Manager] Do not use @kbn/config-schema to validate Fleet request #76281

Closed
nchaulet opened this issue Aug 31, 2020 · 3 comments · Fixed by #76546
Closed

[Ingest Manager] Do not use @kbn/config-schema to validate Fleet request #76281

nchaulet opened this issue Aug 31, 2020 · 3 comments · Fixed by #76546
Assignees
Labels
Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@nchaulet
Copy link
Member

Description

When enrolling 1000 agents, Performing HTTP request validation is accounting for approximately 8% of the total CPU time.

@kbn/config-schema rely on Joi that is the most performance oriented library, we should probably use something else for validating Fleet request (enroll, ack, and checkin)

@kobelb @jfsiii both io-ts and ajv are already dependencies in Kibana, do you have any experiences or recommendation of using one or the other?

@nchaulet nchaulet added the Team:Fleet Team label for Observability Data Collection Fleet team label Aug 31, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@nchaulet nchaulet assigned nchaulet and unassigned nchaulet Aug 31, 2020
@nchaulet nchaulet changed the title [Ingest Manager] Do not @kbn/config-schema [Ingest Manager] Do not use @kbn/config-schema to validate Fleet request Aug 31, 2020
@nchaulet nchaulet self-assigned this Aug 31, 2020
@kobelb
Copy link
Contributor

kobelb commented Aug 31, 2020

do you have any experiences or recommendation of using one or the other?

I do not, unfortunately.

@jfsiii
Copy link
Contributor

jfsiii commented Aug 31, 2020

@nchaulet TL;DR: 👍 for Ajv

I haven't used io-ts myself but there an issue where a few teams talk about their usage #45074

I used Ajv quite a bit while trying different OpenAPI / TS experiments. I like it and it's also used by Fastify, fwiw https://github.com/fastify/fastify/blob/master/docs/Validation-and-Serialization.md

One drawback is that we can't currently[1] send the schema we have in the OpenAPI spec. However, I think even the current differences between the two might not matter for our simple case (iiuc).

[1]: OpenAPI 3.1 and JSON Schema 2019-09 (coming in Ajv 7) will make it so we can share the schema https://apisyouwonthate.com/blog/openapi-v31-and-json-schema-2019-09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants