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

Update code to improve connection handling and support for protobuf as content type #13

Closed
wants to merge 3 commits into from

Conversation

PugDeveloper
Copy link

Add code to facilitate:

  • when client num is > conns num, reuse existing connection
  • accept protobuf as content type

cli := cli
for i := 0; i < clientNum; i++ {
//reuse connection if client > conns
cli := restCli[i%len(restCli)]
Copy link
Author

@PugDeveloper PugDeveloper Jan 2, 2024

Choose a reason for hiding this comment

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

Is this how you want to reuse the client? Or did you want a more specific way to reuse certain connections?

if restCfg.UserAgent == "" {
restCfg.UserAgent = rest.DefaultKubernetesUserAgent()
}

restClients := make([]rest.Interface, 0, num)
for i := 0; i < num; i++ {
// Set the content type
Copy link
Author

Choose a reason for hiding this comment

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

Currently, created a flag so we can specify the content type and have this switch case.

  • Wanted to make it more dynamic but wasn't sure if there is a more dynamic way without always reading the data to check the content first.
  • I used the GODEBUG to double check to see if it accepts protobuf and it seems to work when I change the flag

@PugDeveloper PugDeveloper deleted the swei/kperfv1 branch January 3, 2024 02:35
@PugDeveloper PugDeveloper restored the swei/kperfv1 branch January 3, 2024 03:28
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.

1 participant