Skip to content

Conversation

@jortel
Copy link
Contributor

@jortel jortel commented May 26, 2025

Moves SAX-like encoders to from analysis.go to context.go for more general usage.
Using these encoders instead of standard json|yaml encoders for large arrays GREATLY reduce memory footprint.
Add (cursor) Iterator to better support queries using joins instead of pre-loading. The iterator groups rows (by ID) into batches. Joins return a flattened object graph. Each batch is passed to the supplied Builder function to construct the resource.

Note:
In Java, SAX stands for Simple API for XML.
It is a stream-based, event-driven API used for parsing XML documents. Unlike DOM parsers, which load the entire XML document into memory as a tree, SAX parsers read the XML document sequentially and trigger events as elements are encountered, making them faster and more memory-efficient, especially for large XML files.

jortel added 2 commits May 26, 2025 08:36
Signed-off-by: Jeff Ortel <[email protected]>
Signed-off-by: Jeff Ortel <[email protected]>
@jortel jortel changed the title 👻 add iterator and slice rendering. ✨ Support API rendering of large collections with MUCH less memory. May 27, 2025
@jortel jortel marked this pull request as ready for review May 27, 2025 13:07
Copy link
Member

@aufi aufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jortel jortel merged commit f68f4ae into konveyor:main May 27, 2025
24 of 25 checks passed
jortel added a commit that referenced this pull request May 27, 2025
Query the application using joins instead of preload() and the response
streamed back with in-line encoding.
Much faster. Reduces query of 5k applications from 10-14 seconds to 3-4
seconds. Also keeps RSS (memory) to around 100-130 MB instead of
ballooning to 6-7GB and staying there. Tested on minikube with SSD
storage.

The assessment package need to be changed so that the resolvers ALL
could be built upfront to ensure no other SQL statements were executed
while iterating the cursor (which holds the db lock).

Overlaps with #822:
- api/context.go
- api/analysis.go

After #822 is merged, these files will need to be unstaged and the PR
rebased.

Signed-off-by: Jeff Ortel <[email protected]>
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 this pull request may close these issues.

2 participants