Skip to content

Conversation

ngoduykhanh
Copy link
Contributor

@ngoduykhanh ngoduykhanh commented Jun 3, 2025

Eppo Internal:

🎟️ Fixes #74
πŸ“œ Design Doc: link if applicable

Motivation and Context

To allow tuning the HTTP client, such as TCP transportation config, to fix the issue reported in #74.

Description

With this change, when we initialize the Eppo client, we can pass in a custom HTTP client like this:

		var httpClientInstance *http.Client
		httpClientInstance = &http.Client{Timeout: 10 * time.Second}
		httpClientInstance.Transport = &http.Transport{
			Proxy: http.ProxyFromEnvironment,
			DialContext: (&net.Dialer{
				Timeout:   5 * time.Second,
				KeepAlive: 10 * time.Second,
			}).DialContext,
			MaxIdleConns:          100,
			IdleConnTimeout:       90 * time.Second,
			TLSHandshakeTimeout:   10 * time.Second,
			ExpectContinueTimeout: 1 * time.Second,
			ForceAttemptHTTP2:     true,
		}

		config := eppoclient.Config{
			SdkKey:            os.Getenv("EPPO_SDK_KEY"),
			PollerInterval:    5 * time.Second,
			ApplicationLogger: customLogger,
			HttpClient:        httpClientInstance,
		}

This parameter is optional, and if we don't specify it, the default behavior will be applied.

With the above config, the netstat output will look like this, where we have multiple TCP connection rotated.

/app $ netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:43202 151.101.65.91:https     ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:44978 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:58722 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:50592 151.101.193.91:https    ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:58724 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:34132 151.101.129.91:https    ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:38196 151.101.193.91:https    ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:32936 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:44244 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:39742 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:42666 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:55332 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:43618 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:42682 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:39740 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:55334 151.101.1.91:https      ESTABLISHED
tcp        0      0 test-eppo-698b9bdcfd-8bjhf:44228 151.101.1.91:https      ESTABLISHED

How has this been documented?

How has this been tested?

Copy link
Member

@leoromanovsky leoromanovsky left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Good luck with the tuning - if you find an improvement would you be able to share?

@ngoduykhanh
Copy link
Contributor Author

ngoduykhanh commented Jun 4, 2025

Hey @leoromanovsky, thanks for reviewing. Yes, I can give an update when we roll out the changes. Could you please have another release after merging this PR? It seems like I cannot merge the PR by myself.

@leoromanovsky leoromanovsky merged commit 593d731 into Eppo-exp:main Jun 5, 2025
3 checks passed
@leoromanovsky
Copy link
Member

Hey @leoromanovsky, thanks for reviewing. Yes, I can give an update when we roll out the changes. Could you please have another release after merging this PR? It seems like I cannot merge the PR by myself.

Published as https://github.com/Eppo-exp/golang-sdk/releases/tag/v6.2.0

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.

Connection reset by peer issue on Kubernetes environment

2 participants