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

Make the server flag --renderToDisk into --renderToMemory #11987

Closed
Tracked by #11455
bep opened this issue Feb 4, 2024 · 6 comments · Fixed by #11992
Closed
Tracked by #11455

Make the server flag --renderToDisk into --renderToMemory #11987

bep opened this issue Feb 4, 2024 · 6 comments · Fixed by #11992
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Feb 4, 2024

I'm doing some testing on some beefy (big) sites with the new Hugo code (one of the new features is better memory management), and I have come to the conclusion that it's stupid to have the server render to memory as a default.

  • It only makes sense on small setups.
  • And even then, with fast modern disks and fast render mode, the savings is very small.
  • There's also some known issues with PostCSS etc. that doesn't work well with things in memory.

I think the timing for doing this is also good, so If I don't see many convincing protests about this, I'm doing it.

/cc @jmooring

@bep bep added the Proposal label Feb 4, 2024
@bep bep added this to the v0.123.0 milestone Feb 4, 2024
@bep bep self-assigned this Feb 4, 2024
@jmooring
Copy link
Member

jmooring commented Feb 4, 2024

This sounds like a good idea. A few thoughts/questions...

  1. What if someone has configured their publishDir or --destination flag to something slow (e.g., network location)? If that happens, will they still be able to use the --renderToMemory flag? It seems like we would want to keep both of the --renderToSomething flags, but change the default behavior.

  2. We do not clear the publishDir when building with either hugo or hugo server. So previously published content that has since been deleted will still exist in the publishDir. I wouldn't think that would be a problem, but it is conceptually different from rendering to memory.

@bep
Copy link
Member Author

bep commented Feb 4, 2024

  1. I'm not sure I understand. For the server we have (ok, this isn't entirely true) only one flag in this area: --renderToDisk. We could make --renderToDisk=true the new default, but making it --renderToMemory will make it behave exactly like the regular hugo command. Not sure what having both --renderToMemory and --renderToDisk would give, other than confusion.
  2. Yea, that's true, but one could argue that this will create less surprises, making the server build closer to the production build.

@jmooring
Copy link
Member

jmooring commented Feb 4, 2024

For some reason I thought we already had two flags, so disregard that bit. As long as someone can run:

hugo server --renderToDisk=false

@bep
Copy link
Member Author

bep commented Feb 4, 2024

hugo server --renderToDisk=false

Just to be clear, for the server command, we:

  • Remove the --renderToDisk flag
  • Add the --renderToMemory flag (a flag we already have on the hugo command)
  • The default behaviour is to always render to disk (both for the server and regular builds).

@jmooring
Copy link
Member

jmooring commented Feb 4, 2024

LGTM.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants