Maximum json size for response to the browser
Asked Answered
T

4

46

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.

Tympanites answered 20/1, 2012 at 6:21 Comment(8)
There is no size limit, I have dealt with Ajax requests which took 5 seconds to complete.Linguistician
@Linguistician And so have I, and there was also only 500 bytes worth of data... what's the size limit got to do with your temporal quantification?Tigges
I always thought there were limits... so I ran a very simple Ajax loop where I would send a PHP/Apache script a URL request (it sent it right back), incrementing the 'data payload' by one character on each loop. When my data size reached '8097 bytes', I received a: "414 (Request-URI Too Large)" message from the server. You can view more details of the 414 error all over if you Google it... this is the Wiki page: en.wikipedia.org/wiki/List_of_HTTP_status_codesTigges
Note that my comment above is for GET requests... only realized now that the question is specific to a response to the browser.Tigges
This blog post How Big is TOO BIG for JSON may be relevant. It shows test results for loading JSON in various browsers.Katmandu
@Jeach, off topic comment, but in such methods it is good too make it faster to find by increasing number greatly (for example double it), and if limit found - narrow the searchPneumatophore
#51687962Spellbind
devtools in firefox has a size limit. at 10k i think. You can increase it but it seems to not make any difference: about:config -> devtools.netmonitor.responseBodyLimitPenney
I
18

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.

Imp answered 20/1, 2012 at 6:32 Comment(5)
Ther are max sizes in some browser, which depends on how the Json will be evaluated. The mobile safari will not eval() a json, if it is larger than 10 MBMuezzin
Also probably worth noting that servers can have max sizes as well.Seaweed
@ChristianKuetbach do you know of a reference for that 10 MB limitation? I think I am running up against it. Thanks!Diplomatic
I need to use complete json data in calculation so can't use ajax for load partial data and loading all data together crashing browser, Can anyone help?Skeie
I'm getting something very odd with a 22MB response that works in (Chromium) Edge but just errors out every time in Chrome when I try to get the JSON data. If I then if I activate 'Replay XHR' on the network panel it loads just fine every time (but only in the network panel). In other words my server is 100% not crashing but Chrome gives no useful error at all and the response is only a couple hundred bytes. It's very odd.Extrauterine
D
13

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.

Diandre answered 20/1, 2012 at 6:51 Comment(0)
C
4

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.

Colonnade answered 29/4, 2014 at 6:51 Comment(0)
C
0

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.

Caboodle answered 15/3, 2021 at 9:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.