I need a 2D array (as Json) to be sent from server to client. It would be around 400×400 in size with each entry around 4 characters of text. So that makes it around 640KB of data.
Which of the following extreme approaches is better ?
- I make a large HTTP request of all the data at one go.
- I make 400 requests – each asking for a single row (around 1.6 KB)
I believe optimal approach would be somewhere in middle. Could anyone give me an idea what might be the optimal single request size for this data?
Thanks.
Unless you are dealing with slow (very slow by today’s standards) connections and really need incremental updates, do it in one request.
That gives you better efficiency for compressing the response, and avoids the overhead of the extra HTTP requests and response headers.