Skip to content

Qute Template Rendering with Streaming to Avoid Huge Heap-Memory Consumption in case of Large HTML #41566

Answered by mkouba
funkrusher asked this question in Q&A
Discussion options

You must be logged in to vote

It seems to me that Qute will render the Template as "String" and i assume that it will load this String completely into Memory during Rendering, which will be a Main-Consumer of Heap-Memory of the Server, and will possibly causing problems with Peaks during Rendering.

As you already found out there are several ways how to trigger rendering and consume the rendered result. For your use case, the TemplateInstance#consume(Consumer<String>) method looks like a good match. The consumer is invoked whenever a chunk is available and the returned completion stage that is completed once the rendering finished.

However, keep in mind that in Qute the result tree is always built during rendering. S…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by funkrusher
Comment options

You must be logged in to vote
2 replies
@mkouba
Comment options

@funkrusher
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area/qute The template engine
2 participants