-
Notifications
You must be signed in to change notification settings - Fork 764
Fix slowness for all of resolvment #708
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
Fix slowness for all of resolvment #708
Conversation
this.resolveAllOf has been called recursively twice which really caused the callstack to explode, from 6,000 to > 100,000,000
Speeds up parsing significantly
|
Free load testing! Seems like your server did well with the 100m calls. Indeed the |
|
The proposed solution would not change behavior unless it is explicitly disabled by setting A number of APIs I worked on didn't really require the use of I understand, if this does not fit your project policy, but also believe, that this is a short termed pragmatic solution without disadvantages that solves a problem which affects a number of users until a better and cleaner solution is found and implemented by someone with a deeper understanding of your codebase |
|
Thanks--I get it. Let me see if I can fix it properly first. The |
|
Reference #708 |
|
Will do, but probably not before tomorrow |
|
@markusz any chance to try this out? It should solve your issue. |
|
Not yet, but will try it out asap |
|
+1 |
|
@andi-itagent can you please try out #709 and report back if it addresses slowness that you may be seeing? |
|
Hey @fehguy, sorry for the delay. I finally managed to test #709 against my issue, but unfortunatelly it did not resolve the problem (see screenshot). The problem keeps existing, since your change does not address the root of the performance issues (unnecessary recursive calls) in #708 but a different potential problem. It seems that my proposed fixed does solve these problems according to andi-itagent |
|
OK thanks. Can you share your definition so I can use that to test & verify things? |
|
I will have to anonymize some stuff since it is an internal API for a customer, but I'll see to it as soon as I find time |
|
Thank you, you can also send it via email and I will test it privately. |
|
@fehguy sent you the docs file via email |
|
this was fixed in 57b1563 |

Plenty of people are experiencing slowness when using SwaggerUI with complex nested specs here.
I had the same problem for a project and tracked the issue down to a specific call of
swagger-js:resolveAllOf. This call has several problems:allOftagsThe following screenshots outline the severity of the problem
Status Quo
For my (rather simple) api-docs.json,
resolveAllOfis called 104,000,000 times, resulting in a render time of 4 minutes and a CPU consumption of 90 %.Deduplication and disableAllOfResolve = false
The screenshot below shows the behavior after only removing the duplicated recursion in
resolveAllOfin be29806resolveAllOfis now called "only" 6584 times, which is still too often, but does not cause problems like hanging of the whole browser. Load time is okayish with 3 secondsThis is the proposed / implemented default behavior since it does not affect functionality in any way.
Deduplication and disableAllOfResolve = true
resolveAllOfis now not called at all. This is the best approach ifallOfis not used in the swagger docs. Reduces load time to < 1s