Hello Redoc Community,
Our yaml file with code samples is about 2.2 MB and is slow to load. We are looking for alternative approaches that would allow us to remove most of this download/process time to improve the user experience. Does anyone have some advice for optimizing the load time?
www.zuora.com/developer (select API Reference)
Hello @TracyZuora.
First of all. I love how you styled ReDoc 鉂わ笍
I recommend you updating to the latest version of ReDoc to have this issue resolved: https://github.com/Rebilly/ReDoc/issues/130
Unfortunately I have made some changes in css in the latest version so probably you will have to do some minor extra work after update.
Now regarding slow load time:
we have experiencing the same issue (on RebillyAPI) and it is the next step on our roadmap.
In general: the main part of so slow loading is not caused by your spec file size but by amount of endpoints and methods you have - this is ReDoc performance issue.
Your swagger file loads in 4 seconds (you can shrink this time twice I believe by enable gzip on your server)
In your case the impact is so huge because of using a lot of code samples.
There is relative issue already opened so you can track this: https://github.com/Rebilly/ReDoc/issues/62
Also I won't close this issue to track your case.
Roman,
Do you think if we have multiple files instead of one file that the performance would be better? I will try this tonight. We are having the API Reference failing on load most of the time :-(
If you do separate the files would they have to load on multiple pages? Sort of a pagination if you will?
Roman, We love ReDoc but the performance issues are causing us to rethink the ReDoc approach. I want to stick with ReDoc but we are already looking to change. Is there anything that we could help with in diagnosing/fixing this issue?
I understand your issue as we are also suffering from this 馃槩
As as workaround you can try to split your spec into smaller separate peaces (as a separate OpenAPI specs) and host a few ReDoc instances for each (if you need help with hosting multiple ReDoc instances, let me know)
We are working on resolving this issue, but it is quite complicated. I plan to fix this issue during next 2-3 weeks but I can't promise as I just have ideas in mind not the concrete solution. The basic idea is to move the main bottlenecks to the build step (check #62)
Is there anything that we could help with in diagnosing/fixing this issue
actually I have your spec for tests so don't need anything else at the moment, I will reach you if I need something
@TracyZuora I have released to CDN beta version of ReDoc with performance optimisations
Could you test it and provide your feedback?
Use the following link for referencing redoc.min.js: http://rebilly.github.io/ReDoc/releases/v1.6.0-beta.perf/redoc.min.js
This version is only on CDN, it is not available via npm
Thank you so much for expediting this fix. We will be testing the CDN fix this weekend and will post results. The Zuora Beijing team will jump on the testing first and I will follow suit in the US.
We love ReDoc!
Thank you @RomanGotsiy!
From Beijing side, we updated the local redoc.min.js with the fix. The average loading time of our yaml file with code samples in a totally new incognito Chrome browser is about 13 seconds without lazy rendering, and 8 seconds with lazy rendering. After cached, the loading time is really fast around 2-3 seconds to load. Overall it is much faster than before.
@TracyZuora @jenniferwang2000
Just released a new version v1.6.0. It has lazy rendering feature.
To enable it use lazy-rendering ReDoc option:
<redoc spec-url="..." lazy-rendering></redoc>
Can I close this issue now?
Thank you Roman - please close the lazy rendering is working great! We will be uploading to our production environment this week.