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

cpu, Memory usage spike when endpoints returns a large json file #26

Open
zhiyanshao opened this issue May 15, 2017 · 1 comment
Open

Comments

@zhiyanshao
Copy link

We got cpu, memory and file descriptors spikes when the endpoint returns a large json object. pprof shows most of them are spent on yaag/yaag.GenerateHtml and yaag/yaag.Init. Down the tree it, it calls encoding/json.Mashal (47%) and html/template.htmlReplacer(34%) which calls runtime.slicebytetostring(16%) and bytes.(*Buffer).WriteString.

The memory doesn't get GC-ed quickly.

@aniketawati
Copy link
Member

This is a design issue. With current design, it can't handle large data properly.
For such use cases, yaag would need to support streaming writes to data object file. For that, it would most probably need to shift from json to protobuf. This can be picked up as a feature, so will mark it as such.

But for the current state, make sure that you don't run yaag in production. This is only designed to generate api docs with tests or manual api calls. Running this on production is not advisable at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants