-
Notifications
You must be signed in to change notification settings - Fork 34
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
Switch Async HTTP-client to httpx
(HTTP/2-support)
#770
Switch Async HTTP-client to httpx
(HTTP/2-support)
#770
Conversation
httpx
httpx
(HTTP/2-support)
Last time I tried httpx with http/2 I ran into issues with that it did not handle the case when the server would shutdown the connection (we do in Vespa cloud to disallow extremely long connections) |
That's very useful info. I will try to mock a test for that to check! |
Closing for now, as httpx did not improve feeding performance notably, even with HTTP/2. |
Adding these for context: Got a prototype working. Get |
Ok, think this should be good now!
Some things that were explored:
Should still be possible to get better performance by parallelizing, but leaving this for later. Tests
|
namespace="retryapplication", | ||
) | ||
|
||
def test_retries_async(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not obvious from code that it tests retires.
Is feeding 10 docs will trigger retries?
Maybe a brief comment explaining that uses special application that sleeps on indexing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I will add comments to make this more obvious.
@@ -582,6 +581,157 @@ def _handle_result_callback( | |||
queue.join() | |||
consumer_thread.join() | |||
|
|||
def feed_async_iterable( | |||
self, | |||
iter: Iterable[Dict], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better name for iter arg, e.g. documents or documents_iter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, iter
is a reserved keyword, and shadowing it isn`t ideal, but think it is more important to follow existing pattern rather than to introduce divergent naming.
Agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of reserved words, I think it is worth the change.
Confusing for devs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, since this is a public API, we would need to add deprecation-warning for a while first if we want to rename the keyword arg from feed_iterable
. That should nevertheless be a separate PR. So, then the question is if this new method should have both the renamed arg, but also iter
in the meanwhile, to avoid divergent naming.
Maybe @jobergum could enlighten us a little on best practice here? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, backwards compatibility for public APIs.
Separate PR makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a new method with a new signature we don't need to make the same mistake, it this works well, we can deprecate the sync version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comments.
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.
@staticmethod
-decorator ofcallback_docv1
(See comment on bug below)We should make unit tests for error handling. Maybe this is part of your fix?