xmlhttprequest - With http2, does number of XHRs have any effect on performance if overall data size is the same? -
as far know, http/2 no longer uses separate tcp connections every request, main performance-booster of protocol.
does mean doesn't matter whether use 10 xhrs 10kb of content each or 1 xhr 100kb , split parts client-side?
a precise answer require benchmark specific case.
in more general terms, client point of view, if can make 10 xhr @ same time (for example, in tight loop), happens 10 requests leave client more or less @ same time, incur in latency between client , server, processed on server (more or less in parallel depending on server architecture), result similar of single xhr - although expect single request more efficient.
from server point of view, however, things may different. if multiply 10 have been done single request, server sees 10x increase in request rate. reading network, request parsing , request dispatching activities heavily optimized in servers, have cost, , 10x increase in cost may noticeable.
and 10x increase in request rate server may impact database well, filesystem, etc. there may ripple effects can noticed performing benchmark.
other things have weigh amount of work need in server aggregate things, , split them on client; along other less measurable things code clarity , maintainability, , forth.
i common pragmatic judgement applies here: if can make same work 1 request, why making 10 requests ? have more specific example ?
if in doubt, measure.
Comments
Post a Comment