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

Pool easy handles? #13

Open
armanbilge opened this issue Aug 25, 2022 · 2 comments
Open

Pool easy handles? #13

armanbilge opened this issue Aug 25, 2022 · 2 comments
Labels
question Further information is requested

Comments

@armanbilge
Copy link
Member

https://github.com/typelevel/keypool

Easy handles are meant and designed to be reused. When you have done a single transfer with the easy handle, you can immediately use it again for your next transfer.

https://everything.curl.dev/libcurl/easyhandle#reuse

After the transfer has been made, you can set new options and make another transfer, or if you are done, cleanup the session by calling curl_easy_cleanup. If you want persistent connections, you do not cleanup immediately, but instead run ahead and perform other transfers using the same easy handle.

https://curl.se/libcurl/c/libcurl-easy.html

Sounds like a mistake that we're not reusing these 😅

@armanbilge armanbilge added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Aug 25, 2022
@armanbilge
Copy link
Member Author

Keypool is not published for Native yet, but I can bootleg it real quick if someone wants to work on this. Just ping me :)

@armanbilge
Copy link
Member Author

Actually I don't think this is so necessary after all, since we are using the multi API. The multi-handle will maintain the connection pool

When you are using the multi API, the connection pool is instead kept associated with the multi handle. This allows you to cleanup and re-create easy handles freely without risking losing the connection pool, and it allows the connection used by one easy handle to get reused by a separate one in a later transfer. Just reuse the multi handle!

https://everything.curl.dev/libcurl/connectionreuse

Using a pool to reuse easy-handles may still be useful from a memory allocation perspective? But a pool adds overhead too.

@armanbilge armanbilge changed the title Use keypool for caching easy handles Pool easy handles? Aug 30, 2022
@armanbilge armanbilge added question Further information is requested and removed enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant