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

hugo serve uses 3 GB when serving archive #22

Closed
mpsijm opened this issue Sep 2, 2022 · 4 comments · Fixed by #23
Closed

hugo serve uses 3 GB when serving archive #22

mpsijm opened this issue Sep 2, 2022 · 4 comments · Fixed by #23

Comments

@mpsijm
Copy link
Contributor

mpsijm commented Sep 2, 2022

hugo serve uses 3 GB since we added the archive (#15), which I think is somewhat undesirable 😛 It also takes a bit longer to start.
We should figure out if there is a way for hugo to serve static files without having it keep them in memory all the time.

There is the --renderStaticToDisk flag (see options), which copies the entire /static folder (including the archive) to /public before serving. Still somewhat undesirable, but already better than keeping everything in memory, I guess?

Apparently, someone had the same question in 2019, but they never got an answer.

@mpsijm
Copy link
Contributor Author

mpsijm commented Sep 2, 2022

Possibly, a symlink from /static to /public could work, in combination with the --renderStaticToDisk flag: gohugoio/hugo#7591 (comment)

@mpsijm
Copy link
Contributor Author

mpsijm commented Sep 2, 2022

A similar Q&A got as answer "yeah, just don't serve them from Hugo, but store them externally". So, one other solution could be to not serve the archive via Hugo, but have a python3 -m http.server (or something similar) for the /archive subroutes (or possibly even for all static files). @verwoerd @robertdijk what do you think of that idea?

@robertdijk
Copy link
Member

Hugo serve is only used locally when working on the site, but when we deploy it, we will just just Hugo to build it, and use nginx to serve it. So it’s not really a problem outside of the development.

@mpsijm
Copy link
Contributor Author

mpsijm commented Sep 2, 2022

Cool, good to know! Then running hugo serve --renderStaticToDisk in combination with symlinking /static to /public will work for me. I'll add it to the README 🙂

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

Successfully merging a pull request may close this issue.

2 participants