Alexey
Alexey

Reputation: 35

What can be reason for slow content downloading from webserver?

I'm trying to increase performance of webpage. I'm using ReactJS + webpack, which compiles my jsx files into one file - search.bundle.js. And server is returning this file for 2-3 seconds. File size is ~200KB. Is file size the only reason? On local server it works pretty well. But on remote webserver it is really slow.. There is Google Map and listing of items on page, which I get using ajax request. This is recursive request (while not get enough data, or timeout) which is called in componentDidMount, but as I understand it can't because it can start request items only after script is loaded on page.

So is there any way to achive more faster downloading this script? Or I should just try to reduce size of script?

This is examples of how it works now

And some data from headers tab:

on local:

local headers

on remote:

remote headers

Upvotes: 1

Views: 3122

Answers (1)

Simca
Simca

Reputation: 65

The answer to this question is that script has a source map available. With Chrome's Developer Tools panel open, it makes transparent requests to any available source map files (which it does not show you).

These files are often absolutely massive (mine are 3MB+) and take considerable time to pull on every refresh. Nginx specifically also handles them very poorly, at least in my setup. I think setting the max sendfile chunk size to be lower helps.

Upvotes: 1

Related Questions