Comments (8)
The section "Repro #2: Create excessive TIME_WAIT connections by exceeding connection pool" at http://tleyden.github.io/blog/2016/11/21/tuning-the-go-http-client-library-for-load-testing/ has a nice description of what's happening here as well. And, it hints that we may need to allow tuning both MaxIdleConns
and MaxIdleConnsPerHost
. Or, if the Knative use-case of sending lots of CloudEvents to a single host is too specific, we can tune it there instead of here. It just requires some internal knowledge of how cloudevents sdk-go works to tune that in Knative.
from sdk-go.
I think the use-case of knative is good, it's still generic enough, and useful for a general "from x to cloudEvent" bridge. that may invoke (public) cloud services, distributing CEs, from internal events (wrapped in CEs)
from sdk-go.
The solution for this would be to set these settings on the http client in the cloudevents http transport object, like:
t, err := cloudevents.NewHTTPTransport(
cloudevents.WithTarget(env.Target),
cloudevents.WithEncoding(encoding),
)
t.Client = myHttpClient
from sdk-go.
Thanks - I'll give that a try and close this issue if that works as expected.
from sdk-go.
So, with release 0.4.0 I was able to get acceptable throughput here by tuning the DefaultTransport to raise MaxIdleConnsPerHost. The ability to set a Client (and have that Client actually used for requests) appears to have landed around 0.4.2. However, upgrading to that or newer, I can never get acceptable throughput here.
The issue is
Explicitly telling the client request to close like that means the client is forced to constantly tear down and create new connections, thus leading to resource exhaustion under even moderate load when sending all CloudEvents to a single host. From the net/http docs:
// Close indicates whether to close the connection after
// replying to this request (for servers) or after sending this
// request and reading its response (for clients).
//
// For server requests, the HTTP server handles this automatically
// and this field is not needed by Handlers.
//
// For client requests, setting this field prevents re-use of
// TCP connections between requests to the same hosts, as if
// Transport.DisableKeepAlives were set.
So, we'll need to track down why we started explicitly asking client requests to close. I'm working on an automated test for this in Knative, but it's more of an integration test since it needs to spin up a webserver and run a sustained throughput against it for at least 30 seconds or more.
from sdk-go.
from sdk-go.
Perhaps the issue is on host vs multi-host targets? you want to close for multi, and leave open for a single target?
from sdk-go.
Fixed via #110
from sdk-go.
Related Issues (20)
- Errors from event handler are swallowed and never logged
- Infinite loop on AMQP disconnect HOT 3
- `protocol.go.swp` file for http protocol? HOT 4
- Feature: Expose pubsub PublishSettings along with ReceiveSettings
- Panic on Kafka IP change HOT 7
- NATS Jetstream optimistic concurrency headers HOT 2
- Memory leak in the confluent kafka producer
- Race condition in func WithCustomAttributes(ctx context.Context, attrs map[string]string)
- Support new JetStream API
- Create CODE OWNERS file for reviewers
- Support https://github.com/Azure/go-amqp stable version HOT 3
- Cloud Events HTTP Client Read/Write Timeout is Not Configurable
- Add sql HasPrefix and HasSuffix string functions HOT 11
- Expose AddFunction API for CESQL Parser HOT 5
- Improve CESQL LIKE expression implementation HOT 1
- Propose adding receiver transformer for message queue protocols
- Adding a sample command for mqtt samples
- BUG: invalid CE prefix in Confluent Kafka binding implementation
- Context issue when using protocol's incoming channel with gin framework
- The `content-type` for the MQTT protocol might have been set multiple times
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk-go.