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

front end performance consideration for production #267

Open
aarongundel opened this issue Jan 18, 2022 · 8 comments
Open

front end performance consideration for production #267

aarongundel opened this issue Jan 18, 2022 · 8 comments

Comments

@aarongundel
Copy link
Contributor

describe the issue

We've been doing some testing on front end performance, and it appears that gzipping responses has an (relatively minor, but noteable) impact on response times. It is probably worth mentioning that in a production setting, performance may be improved by gzipping responses (cache policy will also factor, but I haven't tested that at this point). The method to do so varies by the server actually used. My own testing has involved nginx as a reverse proxy to arches.

please add links to existing docs or code (if relevant)

I am guessing this https://arches.readthedocs.io/en/stable/arches-in-production/ page would need to be modified and the page title changed to allow for other production considerations beside the debug variable. I am happy to make an effort here if desired.

which release does this issue concern?

all

@mradamcox
Copy link
Member

Seems like a good idea. Something like this? https://ubiq.co/tech-blog/enable-gzip-compression-apache/

It would be nice to add nginx configuration instructions as well. Are you using uwsgi or gunicorn?

@aarongundel
Copy link
Contributor Author

Hey Adam - yeah that's a great example for apache. For my own testing, I've just been fronting the dev server with nginx. I haven't attempted with wsgi or gunicorn, but that would be even better. The nginx docs have a section I used for configuration - https://docs.nginx.com/nginx/admin-guide/web-server/compression/ - it was pretty straightforward. I've been running the testing via two endpoints - one on the dev server side and the other on the nginx side which serve the same responses.

@mradamcox
Copy link
Member

Ok nice, I think for this ticket we should specifically target apache, because for nginx to be involved in a production env we would first need to add documentation about uwsgi or gunicorn and that effort would be worth a separate ticket. @aarongundel if you want to tackle a some testing with gzipping on apache that would be great, but I'll try to do it too at some point too. Seems like it would be pretty straight forward to do.

@aarongundel
Copy link
Contributor Author

Gotcha. That sounds good @mradamcox - I'm planning on doing some work with gunicorn/wsgi at some point anyway, so I will circle back on that later. As for apache, I'll try to find some time to test that out. I've been intending to set up a container to test Apache configuration out for a while so this is a good excuse. As part of this Apache testing it'll probably be worth it to test out cache-control policies as well, as those can also make a significant impact on load times.

@mradamcox
Copy link
Member

mradamcox commented Jul 28, 2022

Some testing on a staging server, but no luck. The map search page loads in ~16 seconds (dev tools reports 9.43mb / 4.87mb transferred), no matter what I tried. Just putting the following notes here for future reference:

[1] https://phoenixnap.com/kb/how-to-set-up-enable-htaccess-apache
[2] https://ubiq.co/tech-blog/enable-gzip-compression-apache/
[3] https://thegermancoder.com/2018/09/21/how-to-enable-compression-in-apache2/

In my site.conf I added

LoadModule deflate_module modules/mod_deflate.so (tried it both inside and outside of the VirtualHost)

As per [1], Added AllowOverride in the existing access directive for the static dir

    Alias /media/ /path/to/static/
    <Directory /path/to/static/>
       AllowOverride All
       Require all granted
    </Directory>

Created a .htaccess file inside of /path/to/static/.

For the content of this file, I tried the content in both [2] and [3], but no difference in the page load times/content.

@ekansa
Copy link
Collaborator

ekansa commented Apr 10, 2023

@aarongundel @mradamcox I added an example Nginx configuration that gzip compresses static assets for delivery to clients. It's now merged into the master branch. See it here: https://arches.readthedocs.io/en/latest/deployment/serving-arches-with-apache/#configure-nginx

Should we close out this ticket then?

@mradamcox
Copy link
Member

I'm not sure the original idea in this ticket is completely covered yet, but will leave that up to Aaron. The nginx configs look good, though the intro section seems a little fractured. Also, the file name dictates the url so it's a little incongruous to have serving-arches-with-apache/#configure-nginx (even though the header has been updated in the menu), so it might be good to make a little more comprehensive overhaul to work in nginx. Just some thoughts.

@ekansa
Copy link
Collaborator

ekansa commented Apr 12, 2023

@mradamcox Those are some excellent suggestions. I'll make some refinements shortly!

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

3 participants