0

I'm trying to optimize a news portal website and a huge number of about 800-1000 requests per page for our CMS by moving from HTTP11 to HTTP2. I expected that HTTP2 will make my requests parallel (like here linked), but my requests still seem to be pretty much sequential (picture attached). picture of my problem - unlike here, where we can see perfectly parallel requests: question with an example of good http2 performance

Server is Caddy, but since the same is with node http2 static server, don't think it would be better with any other.

  • 1
    I suspect you're solving the wrong problem. 1000 requests per page is ridiculous and needs to be fixed. You should also consider using a CDN. – Tim Sep 20 '17 at 21:20
  • I agree with Tim, you need to fix the application so that it doesn't make so many requests per page. With that number of requests, it is not really possible to get any good response times, even with HTTP/2. – Tero Kilkanen Sep 20 '17 at 22:21

2 Answers2

0

The initiator is most of the times require.js so it could be that it is require.js that performs requests in sequence, rather than in parallel.

This would be the case, for example, of module resolution: require.js needs moduleA, so makes the request for it; when moduleA arrives to the browser and it's parsed, it needs moduleB, so require.js makes the request for moduleB; and so on.

sbordet
  • 201
  • 1
  • 3
  • Since I can't edit that part of the app and use r.js optimizer, I think I'm left with forcing local browser js file caching (which for some reason is not happening now - only several files are retrieved "from memory cache"). How can I achieve that server-side? – Fabijan Letekovic Sep 20 '17 at 13:42
  • You should tell the server to add the proper caching headers in the HTTP responses corresponding to those HTTP request for those scripts. How to do that depends on the server and/or proxy you're using - I'm not particularly knowledgeable on Caddy. – sbordet Sep 20 '17 at 17:20
  • The CMS is a web app, a SPA and we can actually cache all but the API calls. Caddy is only a fast solution, but I can accept anything. NGINX as probably the best solution? Please advise with anything. – Fabijan Letekovic Sep 20 '17 at 19:11
0

Try it with Firefox as it could be due to this bug in Chrome: https://stackoverflow.com/questions/45384243/google-chrome-does-not-do-multiplexing-with-http2/45775288#45775288

Also you should note that many implementations limit the maximum number of streams (e.g. Apache limits to 100 streams at a time) so even if you solve your issue you may not see all 800-1000 requests happening at once (but should be a lot better than you see at the moment).

Barry Pollard
  • 4,591
  • 15
  • 26