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

/api/v1/results much slower than the other API endpoints in browsable API interfaces #323

Closed
hille721 opened this issue Aug 6, 2021 · 3 comments

Comments

@hille721
Copy link
Contributor

hille721 commented Aug 6, 2021

What is the issue ?

The /api/v1/results endpoint is much slower than the other ones. In a browser I'm running again and again in 502 - Bad Gateway Errors.

Here a comparison with Google networkanalysis:
/api/v1/tasks (total ~400,000 tasks): ~1s
/api/v1/results (total ~2,000,000 results): ~8s (and around every second time a gateway error)

By using curl, there is not really a significant difference, thus just a GUI problem.

I'm using ara in container behind a nginx proxy in Openshift. I already created my own image with container optimized gunicorn settings (see #322), which solved the problem a bit. But not totally.

What should be happening ?

Loading /api/v1/results should not take that long.

@hille721
Copy link
Contributor Author

hille721 commented Aug 6, 2021

I already found out, that the performance issue is not because of the request itself, it is really just the rendering. And here also not the rendering of the get result, but the rendering of the POST and PUT forms.

Thus with setting WRITE_LOGIN_REQUIRED: true you do not have the problem, but you can't do that by running with a proxy.

hille721 added a commit to hille721/ara that referenced this issue Aug 6, 2021
hille721 added a commit to hille721/ara that referenced this issue Aug 6, 2021
@hille721
Copy link
Contributor Author

hille721 commented Aug 6, 2021

Cool, I have already found a fix for this issue, in which just the html form in the POST/PUT section is disabled, but you can still post data in raw format via the browseable API: https://stackoverflow.com/questions/18587726/django-rest-framework-slow-browsable-ui-because-of-large-related-table

Following has to be done: hille721@2318605

Then the form will look like this:
image
So no html form anymore.

This fix reduces the loading time in my Dev instace from 18.5 s to 3.5 s!

Will submit a PR

dmsimard pushed a commit that referenced this issue Aug 7, 2021
* disable html forms in browsable api (#323)
@dmsimard
Copy link
Contributor

dmsimard commented Aug 7, 2021

PR is merged, thanks !

@dmsimard dmsimard closed this as completed Aug 7, 2021
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