ankur
ankur

Reputation: 4733

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.

Upvotes: 47

Views: 130304

Answers (4)

krishna
krishna

Reputation: 115

There is no max size limit but the size depends the client system's (The system in which browser exists) RAM, CPU, Network bandwidth to parse the large json data. If the system is low end and with the large json data then the browser hangs.

Upvotes: 0

Bunti
Bunti

Reputation: 1760

Well I think I am too late to give my two cents. Complementing shiplu.mokadd.im's answer browser memory is a limitation and HTTP response can have any amount of data according to the TCP spec.

But I have an application that uses Google Chrome (version 29.0.xx) and Jetty server where response from the Jetty server has a payload amounting to 335MB. While the browser is receiving the response of that sheer size Chrome stops leaving the message "IPC message is too big". Though this is specific to Google Chrome(not sure about other browsers), there should be a threshold on the max size of response.

Upvotes: 4

Shiplu Mokaddim
Shiplu Mokaddim

Reputation: 57670

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.

Upvotes: 13

xdazz
xdazz

Reputation: 160883

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.

Upvotes: 20

Related Questions