Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum json size for response to the browser

I am creating tree with some custom control prepared with JavaScript/jquery.

For creating the tree we are supplying json object as the input to java-script to iterate through and create the tree.

Since the volume of data may go up-to 25K nodes. during a basic load test we identified that the browser will be crashed for such volume.

The alternate solution is just load first level of the nodes and rest load on demand via AJAX request. the volume of first level can vary up-to 500 - 1K nodes.

What is the max size a json should have as a response from the server. What could be the best approach to process such volume of data on browser.

like image 226
ankur Avatar asked Jan 20 '12 06:01

ankur


People also ask

How much JSON can a browser handle?

The short answer is that the maximum size is 1GB.

How big can a HTTP response be?

The response limit is 9,223,372,036,854,775,807 bytes (2 ** 64).

Is JSON good for large data sets?

Developers prefer JSON because of its ease of readability, which makes it easy to weave into apps. Business analytics applications benefit from other formats and approaches for structuring the data inside these file formats that are smaller and faster.


2 Answers

There is no max size limit of the http response (or the max size of Int or the limit of browser or the limit of server have been configured).

The best approach is use AJAX to load part of data while it need to be shown.

like image 84
xdazz Avatar answered Sep 20 '22 15:09

xdazz


An HTTP response has no size limit. JSON is coming as an HTTP response. So it has no size limit either.

There might be problem if the object parsed from JSON response consumes too much memory. It'll crash the browser. So it's better you test with different data sizes and check whether your app works correctly.

I think lazy-loading is the best approach for such large amounts of data. Especially when dealing with object literals.

See High Performance Ajax Application presentation from Yahoo.

like image 41
Shiplu Mokaddim Avatar answered Sep 18 '22 15:09

Shiplu Mokaddim