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

MGMT-19929: Use sonic instead of standard json library #7352

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adriengentil
Copy link
Contributor

@adriengentil adriengentil commented Feb 26, 2025

Last investigations have shown that assisted spend a lot of time de-serializing json, and it can struggle at processing large inventories.

sonic is a performant json library that can help the assisted at coping with these scalability issues. The advantage of this library is that is it an almost drop-in library for the standard json library: to keep the maximum compatibility, I ensured that we used ConfigStd on marshaling operations because it makes the json strings comparable (keys will be sorted).

I did not update the pkg/ folder to avoid public users of our library to be forced to use this library.

Memory is slightly higher (3 hosts with 3MB inventory):
image

CPU usage is divided by 2 (3 hosts with 3MB inventory):
image

p90 time to monitor a host is divided by 5 (3 hosts with 3MB inventory):
image

average time to monitor a host is divided by 3.5 (3 hosts with 3MB inventory):
image

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 26, 2025
Copy link

openshift-ci bot commented Feb 26, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 26, 2025
Copy link

openshift-ci bot commented Feb 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adriengentil

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 26, 2025
@adriengentil
Copy link
Contributor Author

/test ?

Copy link

openshift-ci bot commented Feb 26, 2025

@adriengentil: The following commands are available to trigger required jobs:

/test e2e-agent-compact-ipv4
/test edge-assisted-operator-catalog-publish-verify
/test edge-ci-index
/test edge-e2e-ai-operator-disconnected-capi
/test edge-e2e-ai-operator-ztp
/test edge-e2e-ai-operator-ztp-3masters
/test edge-e2e-ai-operator-ztp-capi
/test edge-e2e-ai-operator-ztp-disconnected
/test edge-e2e-metal-assisted-4-14
/test edge-e2e-metal-assisted-4-15
/test edge-e2e-metal-assisted-4-16
/test edge-e2e-metal-assisted-4-17
/test edge-e2e-metal-assisted-4-18
/test edge-e2e-metal-assisted-5-control-planes-4-18
/test edge-e2e-metal-assisted-cnv-4-17
/test edge-e2e-metal-assisted-external-4-18
/test edge-e2e-metal-assisted-lvm-4-18
/test edge-e2e-metal-assisted-mtv-4-17
/test edge-e2e-metal-assisted-none-4-18
/test edge-e2e-metal-assisted-odf-4-17
/test edge-e2e-metal-assisted-osc-4-18
/test edge-e2e-nutanix-assisted-2workers-4-18
/test edge-e2e-nutanix-assisted-4-18
/test edge-e2e-vsphere-assisted-4-18
/test edge-images
/test edge-lint
/test edge-operator-publish-verify
/test edge-subsystem-aws
/test edge-subsystem-kubeapi-aws
/test edge-unit-test
/test edge-verify-generated-code
/test images
/test mce-images

The following commands are available to trigger optional jobs:

/test e2e-agent-4control-ipv4
/test e2e-agent-5control-ipv4
/test e2e-agent-ha-dualstack
/test e2e-agent-sno-ipv6
/test edge-e2e-ai-operator-ztp-4masters
/test edge-e2e-ai-operator-ztp-5masters
/test edge-e2e-ai-operator-ztp-compact-day2-masters
/test edge-e2e-ai-operator-ztp-compact-day2-workers
/test edge-e2e-ai-operator-ztp-hypershift-zero-nodes
/test edge-e2e-ai-operator-ztp-multiarch-3masters-ocp
/test edge-e2e-ai-operator-ztp-multiarch-sno-ocp
/test edge-e2e-ai-operator-ztp-node-labels
/test edge-e2e-ai-operator-ztp-remove-node
/test edge-e2e-ai-operator-ztp-sno-day2-masters
/test edge-e2e-ai-operator-ztp-sno-day2-workers
/test edge-e2e-ai-operator-ztp-sno-day2-workers-ignitionoverride
/test edge-e2e-ai-operator-ztp-sno-day2-workers-late-binding
/test edge-e2e-metal-assisted-4-control-planes-4-18
/test edge-e2e-metal-assisted-4-masters-none-4-18
/test edge-e2e-metal-assisted-bond-4-14
/test edge-e2e-metal-assisted-bond-4-18
/test edge-e2e-metal-assisted-day2-4-18
/test edge-e2e-metal-assisted-day2-arm-workers-4-18
/test edge-e2e-metal-assisted-day2-sno-4-18
/test edge-e2e-metal-assisted-ipv4v6-4-18
/test edge-e2e-metal-assisted-ipv6-4-18
/test edge-e2e-metal-assisted-k8s-nmstate-4-17
/test edge-e2e-metal-assisted-kube-api-late-binding-sno-4-18
/test edge-e2e-metal-assisted-kube-api-late-unbinding-sno-4-18
/test edge-e2e-metal-assisted-kube-api-net-suite-4-18
/test edge-e2e-metal-assisted-kube-api-umlb-4-18
/test edge-e2e-metal-assisted-onprem-4-18
/test edge-e2e-metal-assisted-osc-sno-4-18
/test edge-e2e-metal-assisted-sno-4-18
/test edge-e2e-metal-assisted-static-ip-suite-4-14
/test edge-e2e-metal-assisted-static-ip-suite-4-18
/test edge-e2e-metal-assisted-tang-4-18
/test edge-e2e-metal-assisted-tpmv2-4-18
/test edge-e2e-metal-assisted-umlb-4-18
/test edge-e2e-metal-assisted-upgrade-agent-4-18
/test edge-e2e-oci-assisted-4-18
/test edge-e2e-oci-assisted-bm-iscsi-4-18
/test edge-e2e-vsphere-assisted-umlb-4-18
/test edge-e2e-vsphere-assisted-umn-4-18
/test okd-scos-e2e-aws-ovn
/test okd-scos-images
/test push-pr-image

Use /test all to run the following jobs that were automatically triggered:

pull-ci-openshift-assisted-service-master-e2e-agent-compact-ipv4
pull-ci-openshift-assisted-service-master-edge-ci-index
pull-ci-openshift-assisted-service-master-edge-e2e-ai-operator-disconnected-capi
pull-ci-openshift-assisted-service-master-edge-e2e-ai-operator-ztp
pull-ci-openshift-assisted-service-master-edge-e2e-ai-operator-ztp-capi
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-4-18
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-cnv-4-17
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-external-4-18
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-lvm-4-18
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-mtv-4-17
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-none-4-18
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-odf-4-17
pull-ci-openshift-assisted-service-master-edge-e2e-metal-assisted-osc-4-18
pull-ci-openshift-assisted-service-master-edge-e2e-nutanix-assisted-4-18
pull-ci-openshift-assisted-service-master-edge-e2e-vsphere-assisted-4-18
pull-ci-openshift-assisted-service-master-edge-images
pull-ci-openshift-assisted-service-master-edge-lint
pull-ci-openshift-assisted-service-master-edge-subsystem-aws
pull-ci-openshift-assisted-service-master-edge-subsystem-kubeapi-aws
pull-ci-openshift-assisted-service-master-edge-unit-test
pull-ci-openshift-assisted-service-master-edge-verify-generated-code
pull-ci-openshift-assisted-service-master-images
pull-ci-openshift-assisted-service-master-mce-images
pull-ci-openshift-assisted-service-master-okd-scos-e2e-aws-ovn

In response to this:

/test ?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@adriengentil
Copy link
Contributor Author

/test edge-subsystem-kubeapi-aws edge-subsystem-aws edge-unit-test edge-e2e-metal-assisted-4-18

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 74.28571% with 27 lines in your changes missing coverage. Please review.

Project coverage is 67.79%. Comparing base (a165f97) to head (d8b73d7).
Report is 30 commits behind head on master.

Files with missing lines Patch % Lines
internal/host/hostutil/test_utils.go 18.18% 9 Missing ⚠️
internal/common/test_configuration.go 0.00% 7 Missing ⚠️
internal/common/inventory.go 0.00% 2 Missing ⚠️
internal/bminventory/inventory.go 87.50% 1 Missing ⚠️
internal/common/db.go 0.00% 1 Missing ⚠️
internal/common/disks_info.go 0.00% 1 Missing ⚠️
internal/common/image_status.go 0.00% 1 Missing ⚠️
internal/common/node_labels.go 0.00% 1 Missing ⚠️
...l/host/hostcommands/tang_connectivity_check_cmd.go 66.66% 0 Missing and 1 partial ⚠️
internal/host/hostutil/host_utils.go 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7352      +/-   ##
==========================================
+ Coverage   67.78%   67.79%   +0.01%     
==========================================
  Files         309      309              
  Lines       41696    41694       -2     
==========================================
+ Hits        28264    28267       +3     
+ Misses      10883    10880       -3     
+ Partials     2549     2547       -2     
Files with missing lines Coverage Δ
internal/bminventory/inventory_v2_handlers.go 56.95% <100.00%> (ø)
internal/cluster/capabilities.go 0.00% <ø> (ø)
internal/cluster/cluster.go 65.91% <100.00%> (ø)
...rnal/cluster/validations/pull_secret_validation.go 80.15% <100.00%> (+1.58%) ⬆️
internal/cluster/validator.go 94.91% <100.00%> (ø)
internal/common/common.go 28.57% <ø> (ø)
internal/connectivity/validator.go 57.14% <ø> (ø)
...nternal/controller/controllers/agent_controller.go 76.45% <100.00%> (ø)
...al/controller/controllers/agentlabel_controller.go 57.14% <100.00%> (ø)
...oller/controllers/agentserviceconfig_controller.go 84.11% <100.00%> (ø)
... and 62 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adriengentil
Copy link
Contributor Author

/cc @rccrdpccl
let me know if you have suggestions! I would like to try on integration first.

@openshift-ci openshift-ci bot requested a review from rccrdpccl February 26, 2025 17:04
@adriengentil adriengentil changed the title use sonic json Use sonic instead of standard json library Feb 26, 2025
@adriengentil
Copy link
Contributor Author

/test edge-subsystem-kubeapi-aws edge-subsystem-aws

@rccrdpccl
Copy link
Contributor

let me know if you have suggestions! I would like to try on integration first.

it looks great! let's see how it performs in integration but LGTM

@adriengentil adriengentil changed the title Use sonic instead of standard json library MGMT-19929: Use sonic instead of standard json library Mar 4, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 4, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 4, 2025

@adriengentil: This pull request references MGMT-19929 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.19.0" version, but no target version was set.

In response to this:

Last investigations have shown that assisted spend a lot of time de-serializing json, and it can struggle at processing large inventories.

sonic is a performant json library that can help the assisted at coping with these scalability issues. The advantage of this library is that is it an almost drop-in library for the standard json library: to keep the maximum compatibility, I ensured that we used ConfigStd on marshaling operations because it makes the json strings comparable (keys will be sorted).

I did not update the pkg/ folder to avoid public users of our library to be forced to use this library.

Memory is slightly higher (3 hosts with 3MB inventory):
image

CPU usage is divided by 2 (3 hosts with 3MB inventory):
image

p90 time to monitor a host is divided by 5 (3 hosts with 3MB inventory):
image

average time to monitor a host is divided by 3.5 (3 hosts with 3MB inventory):
image

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@adriengentil
Copy link
Contributor Author

/test edge-subsystem-kubeapi-aws edge-subsystem-aws edge-unit-test edge-lint

@openshift-merge-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 23, 2025
Copy link

openshift-ci bot commented Mar 27, 2025

@adriengentil: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/edge-e2e-metal-assisted-nho-snr-far-4-18 d8b73d7 link true /test edge-e2e-metal-assisted-nho-snr-far-4-18
ci/prow/edge-e2e-metal-assisted-nmo-4-18 d8b73d7 link true /test edge-e2e-metal-assisted-nmo-4-18
ci/prow/edge-e2e-metal-assisted-kdo-4-18 d8b73d7 link true /test edge-e2e-metal-assisted-kdo-4-18

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants