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

Replace httpx with request for sync version #543

Open
sacOO7 opened this issue Oct 25, 2023 · 11 comments · May be fixed by #544
Open

Replace httpx with request for sync version #543

sacOO7 opened this issue Oct 25, 2023 · 11 comments · May be fixed by #544
Assignees

Comments

@sacOO7
Copy link
Collaborator

sacOO7 commented Oct 25, 2023

┆Issue is synchronized with this Jira Task by Unito

@sync-by-unito
Copy link

sync-by-unito bot commented Oct 25, 2023

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3914

@sacOO7 sacOO7 self-assigned this Oct 25, 2023
@sacOO7 sacOO7 linked a pull request Oct 25, 2023 that will close this issue
@sacOO7
Copy link
Collaborator Author

sacOO7 commented Nov 23, 2023

TODO

  • 1. Reproduce the issue using load testing on a dedicated server.
  • 2. If reproduced, then make a change to switch to a different library.

@owenpearson has an idea about how to reproduce the issue and do the load testing.

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Dec 10, 2023

Some more findings ->

  • Current SDK uses httpx version as 0.24.1 which has dependency on httpcore uses -> 0.17.3
  • Latest version of httpx is 0.25.2, it uses httpcore -> 1.0.2
  • Some critical bugfixes has been addressed in latest version of httpx.
  • While running tests make sure we run it on both older and newer versions of httpx.

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Dec 10, 2023

One of the related fix seems to be -> encode/httpcore#823

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Dec 10, 2023

The current SDK only supports httpx to be used in http2 mode ->

self.__client = httpx.AsyncClient(http2=True)
.
There is still an active issue for http2 -> encode/httpcore#775 that talks about gracefully closing the connection. Fix is already done for http1.1.

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Dec 10, 2023

NEW TODO

  • 1. Reproduce the issue using load testing on a dedicated server.
    - [ ] httpx -> 0.24.1 and http2 ( use current SDK as is ! )
    - [ ] httpx -> 0.24.1 and http1.1
    - [ ] httpx -> 0.25.2 and http2
    - [ ] httpx -> 0.25.2 and http1.1
  • 2. If still facing the issue, then make a change to requests library that uses http 1.1 rather than http2 😒

@Ousret
Copy link

Ousret commented Jan 21, 2024

I don't know whether it could help your case, but you may consider taking a look at Niquests instead of downgrading to requests. Your feedback would be interesting. Would be happy to get this project where you aim to reach.

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Jan 22, 2024

@Ousret Thanks for the suggestion !

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Feb 4, 2024

Seems we can use https://locust.io/ as a tool for load testing.

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Feb 4, 2024

https://medium.com/@yusufenes3494/how-to-build-your-own-load-test-a-step-by-step-guide-1a8367f7f6a2

Seems locusts by default uses python-requests for executing test against given server
https://docs.locust.io/en/stable/increase-performance.html. No wonder, python-requests is stable and doesn't cause issue on high throughput.

Need to check if we can configure other client like httpx instead of default python-requests

@sacOO7
Copy link
Collaborator Author

sacOO7 commented Feb 4, 2024

One of the way is to clone python-locust project and modify https://github.com/locustio/locust/blob/master/locust/clients.py file to use httpx client instead of python-requests.
This will help us to use all features of locust client like result tracking, without writing explicit code for the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants