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

Use sonic instead of standard json library #7352

Draft
wants to merge 2 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:
image

CPU usage is divided by 2:
image

p90 time to monitor a host is divided by 5:
image

average time to monitor a host is divided by 3.5:
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.75728% with 26 lines in your changes missing coverage. Please review.

Project coverage is 67.97%. Comparing base (444bfdf) to head (8343995).
Report is 1 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 1 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7352      +/-   ##
==========================================
- Coverage   67.97%   67.97%   -0.01%     
==========================================
  Files         300      300              
  Lines       41013    41013              
==========================================
- Hits        27879    27877       -2     
- Misses      10632    10633       +1     
- Partials     2502     2503       +1     
Files with missing lines Coverage Δ
cmd/agentbasedinstaller/import.go 68.51% <ø> (ø)
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 78.57% <100.00%> (-1.59%) ⬇️
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%> (ø)
... and 63 more

@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

Copy link

openshift-ci bot commented Feb 27, 2025

@adriengentil: all tests passed!

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. 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.

1 participant