-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Possible memory leak? #35
Comments
I believe you need to invoke |
i thought about that but it doesn't seem closeable. faraday should close the adapter automatically after every request afaik.
|
ah i'm looking at the wrong source. let me try with faraday 1.x. |
would it make sense to restrict task = Async do
response = conn.get("/index")
ensure
conn.close
end |
I recommend trying the
model to start with (as it seems you are). However, you won't get persistent connections this way. So, after you tried that, use the
Using the persistent connection will improve throughput and latency. |
getting a different issue now |
despite the new issue, memory usage is stable, so closing the connection seems to have been the ticket 🥳 |
Faraday's myriad instantiation-time configurations and state makes sharing a connection difficult. what if different requests from the same thread need different middleware? i guess i could create a separate thread-local class for each configuration, or a single thread-local with a hash of different options => different faraday connections... |
Yeah, I understand your issue. For the sake of persistent connections, maybe we want a shared internal pool of HTTP connections. Most of the request/response processing won't actually impact the underlying connection pool... |
yeah that sounds about right. i may take a look. |
you can close this issue 🙂 |
@ioquatix do you think using a process-wide connection pool instead of a thread-local one, via https://github.com/mperham/connection_pool (or https://github.com/socketry/async-pool which i think does the same thing?), might be more efficient in some ways? i noticed |
No, you should avoid doing additional connection pooling. The reason is, there are life-cycle issues at play. Using |
thought you might like to know: with |
@jakeonfire is it okay to use your testimonial on my website? |
@ioquatix sure! |
Imagine a vanilla rails app, where controller actions might look like:
and
RequestHandler
something like:the app is using
falcon host
orfalcon virtual
with therack
configuration, a preload of the rails environment, andendpoint Async::HTTP::Endpoint.parse("http://0.0.0.0:3000")
. pretty simple.Originally posted by @jakeonfire in #32 (comment)
The text was updated successfully, but these errors were encountered: