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

[Slow performance] - two seconds for each call #76

Open
marcofucito opened this issue Oct 14, 2021 · 7 comments
Open

[Slow performance] - two seconds for each call #76

marcofucito opened this issue Oct 14, 2021 · 7 comments

Comments

@marcofucito
Copy link

Hi,
In my tests, each wcapi call takes about 2 seconds, regardless of the content of the call.
If I do a get of a single product or a get of 100 products, it always takes about 2 seconds.

Two seconds for an operation on 100 products can be an acceptable time, however it is far too long for an operation on only one product.

The fact that the long execution time does not depend on the type of call, makes me rule out a problem on my server, and makes me think that most of the time is used to "establish the connection" and not to "execute the query".

Can i do something to speed up the process?

Thanks

@ahmedselim2017
Copy link

I am too having the same problem. Have anyone found a solution to this?

@chichi13
Copy link

Same problem here :

[2022-04-11 18:07:06,549] - [DEBUG] - Starting new HTTPS connection (1): blabla.co:443
[2022-04-11 18:07:08,123] - [DEBUG] - https://blabla.co:443 "GET /wp-json/wc/v3/products?&page=2&per_page=100 HTTP/1.1" 200 None
[2022-04-11 18:07:08,232] - [DEBUG] - Starting new HTTPS connection (1): blabla.co:443
[2022-04-11 18:07:09,743] - [DEBUG] - https://blabla.co:443 "GET /wp-json/wc/v3/products?&page=3&per_page=100 HTTP/1.1" 200 None

It's because of the handshake at each request. I don't know if there is a solution for this.

For the requests package there is a session() parameter, so the handshake is done once. I don't find the same thing for wc-api.

@chichi13
Copy link

I hope @claudiosanches will check this to add requests.session() in api.py for faster performance

@javix64
Copy link

javix64 commented Jul 27, 2022

some news regarding this feature?
related to woocommerce/woocommerce#26029 (comment) ??? probably

@chichi13
Copy link

some news regarding this feature? related to woocommerce/woocommerce#26029 (comment) ??? probably

I don't think the related issue is the same problem as this issue. This issue seems to be a session issue in the wc-api-python code. The handshake is made for each request and not only once.
The related issue seems to be related to woocommerce API directly and not to the python package.

But I would love to hear from the developer on this issue.

@chichi13
Copy link

If you are still looking for a solution, since the repo is not maintained, I have forked the project to add the Session + Retry here : https://github.com/chichi13/wc-api-python-unofficial

@rooprob
Copy link

rooprob commented Sep 18, 2022

If you are still looking for a solution, since the repo is not maintained, I have forked the project to add the Session + Retry here : https://github.com/chichi13/wc-api-python-unofficial

LOL. Timing.
I just raised a trivial PR for this. Your branch adds retry, and updates deps and more, so enhances this library even further. Thanks.

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

No branches or pull requests

5 participants