esi
esi copied to clipboard
Slowing page down significantly
Trying to implement in a Sails.io project but it's taking pages over a minute to render. Any suggestions?
This could be HTTP request latency.
But the project could do with some benchmarks. So if you could include a problematic initial page and any external fragments it requires. Then we can add it to the testsuite to monitor performance.
The app won't hit a public facing domain for a few weeks due to security policies. I'll see if I can replicate in a fresh sails.io app.
The benchmark should not be constrained by network requests.
What i meant was to create a series of files in a spec/mocks
directory, i.e.
specs/mock/in.html
specs/mock/includewidget1.html
specs/mock/includewidget2.html
specs/mock/out.html
.... etc
The page "in.html" could be your page which includes ESI markup and is slow to process, the HTTP requests to includeWidget2.html could be stubbed.
This would let us monitor the performance impact of parsing a large page through the ESI module sandboxed from network requests.
I'm also facing page slow when using esi includes. My page includes are served from the same box, I see immediate request hits - but sometimes they stall either indefinitely or for long periods of time, before the route is actually hit back.
Page sizes are crazy small.
Actually this might be entirely unrelated, I may have jumped the gun. I'm still investigating the slowdowns on our side. Cheers.
A little late to this but I think the following may be contributing to the issue.
// Overwrite the write function
res.write = function( chunk, encoding ){
if( !chunk ){
// dont do anything
return;
}
https://github.com/MrSwitch/esi/blob/master/index.js#L103
Here res.write returns early if there is no chunk to be processed. However this should actually end the request, rather than doing nothing since this overrides the default res.write.
The following seems to address it.
if( !chunk ){ return original_end.call( res ); }
@MrSwitch thoughts?