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

REST api timing out when publish takes longer than 1 min #1204

Open
AlexReimann opened this issue Jul 26, 2023 · 5 comments
Open

REST api timing out when publish takes longer than 1 min #1204

AlexReimann opened this issue Jul 26, 2023 · 5 comments

Comments

@AlexReimann
Copy link

We are running aptly with a local repository and are using the REST api to trigger publishing.
We are currently doing a stress test of our setup and the publishing time increases with the number of packages.
Once the publishing time increases to > 1min, the REST call fails with curl: (22) The requested URL returned error: 504

Detailed Description

Our test repo has around 23K packages, so the publishing takes quite a while.
We already turned of content publishing of the packages (see #421), which moved the critical number of packages before we get a 504 from the http server from 15k to 23k.

Using the command line the publishing still works fine at that point.

Is there a way to set the timeout for the REST api server?

Context

We could do some workaround, e. g. calling the command line via ssh instead, but I think in general it makes sense that the REST api also works with large number of packages.

Possible Implementation

Expose the (timeout) settings for the api http server.

@reglim
Copy link
Contributor

reglim commented Aug 16, 2023

Thank you for submitting this issue.
I tried, but I couldn't reproduce this locally. I set up a snapshot with several gigabytes of data and I didn't get a timeout locally through curl with the following command:

$ time curl -X POST http://localhost:8080/api/publish    -H 'Content-Type: application/json' -d '{
"SourceKind": "snapshot",
"Sources": [
{
"Name": "bullseye-snap"
}
],
"Signing": {
"Skip": true
}
}'
^C

real	2m23.659s
user	0m0.010s
sys	0m0.000s

Could you add some detail as to whether you're using some kind of nginx proxy or anything in that direction?

@AlexReimann
Copy link
Author

We have a traefik reverse proxy in between, but even using the command line the publishing in this case takes > 1min, so I think it is independent from the network setup.

It might be just that the disk we are using is slower (network drive), so it takes longer. Or the publishing time is more related to the number of packages (as stated above 15k+ packages), than the size. The size in our case was actually "rather small" (< 15 GB).

Our workaround so far is to have the publishing done with ?_async=true (taken from here #1125), but with this we don't get error codes back when the publishing goes wrong.

@reglim
Copy link
Contributor

reglim commented Aug 16, 2023

What I thought could be the issue, is that the connection is being timed out by your proxy and not the API.
Is is possible to check by connecting via ssh (or just connect without the proxy) and curl-ing from there?

@AlexReimann
Copy link
Author

Yeah, just tried it locally without anything in between. Currently takes around 30 secs as we recently wiped the repo, so it is not timing out yet.

I can do a test setup with more packages to see if it then times out eventually, though maybe I'll just wait a week or two till we reached the amount of packages again 😅

@reglim
Copy link
Contributor

reglim commented Aug 17, 2023

Ok, perfect. I'll be interested to hear if it worked.

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

2 participants