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

[Documentation] Serve Metadata as static content with NGINX #172

Closed
peppelinux opened this issue Jul 8, 2019 · 2 comments
Closed

[Documentation] Serve Metadata as static content with NGINX #172

peppelinux opened this issue Jul 8, 2019 · 2 comments

Comments

@peppelinux
Copy link
Member

peppelinux commented Jul 8, 2019

I'm using NginX to serve metadata on MDQ queryes like:

# get all the entitities in a single aggregated metadata
/entities

# get a single metadata, related to the hashed entityID in the request URL
# the encoded value is a hashed entity_id
/entities/{sha1}baf9ddc66fa9d6a6077e72cd04e0e292ccbc7676

The rules are the following

   location ~ /entities/\{sha1\}(.*) {
      default_type "application/xml; charset=utf-8";
      alias /opt/pyff/md/$1.xml;
   }


    location ~ /entities$ {
       default_type "application/xml; charset=utf-8";
       alias /opt/pyff/md/md-loaded.xml;
    }

This experience is related to #171

pyff without a CACHE will take roughly 3 or 4 seconds to get back the result, NginX instead will take 36ms. In addition to this if nginx is unable to find the requested sha1 metadata it will return 404, instead of error 500 as pyff does.

Please share your ideas

@leifj
Copy link
Contributor

leifj commented Jul 10, 2019

look at scripts/mirror-mdq.sh and also test the new api backend. With the redis backend and config.cache_size turned up to a bit more than your expected volume of entities you should get much better performance.

@leifj leifj closed this as completed Jul 10, 2019
@peppelinux
Copy link
Member Author

At the moment I'll be in production with nginx static serve, when I'll have more time I'll try to read the code and understand your suggestions, otherwise I'll wait more time to get for official documentation on these tasks. thank you @leifj

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