4

I have a Django app, and an Ajax response ( to a POST ) that contains 2.8MB of JSON The JSON is valid when it leaves the server, but when the browser gets it ( jQuery 1.9 ), it has been truncated to approximately 2.1MB (and fails to parse). The exact size varies -- see the numbers below.

SENT:
2806260

RECIEVED:
2157907
2133383
2149795
2138351
2135271
2137015
2134291

Smaller responses work perfectly fine -- it's just this big one that gets cut-off.

The recieved size always seems to be an odd number, and maybe I am going crazy here, but they all seem to be either prime numbers or multiples of large prime numbers. Is this really true? Is it a coincidence? What is truncating my JSON?

( RHEL6.5 64bit, python2.6, django1.6, jquery1.9 )

Nick Perkins
  • 8,034
  • 7
  • 40
  • 40
  • 5
    A [few](http://stackoverflow.com/questions/4494001/how-to-increase-2mb-limit-on-ajax-json-response-w-asp-net-mvc) different [platforms](https://drupal.org/node/97193) have upload limits around ~2MB. Can you say more about your server stack? (You don't say what web server you are using.) – Two-Bit Alchemist Mar 21 '14 at 20:59
  • I agree with Two-Bit, some platforms have at ~2MB limit. But are you sure that is really your applications problem? Maybe you sould consider smaller request, to give the user some better "right away" responses. I would expect that you are dumping alot of data to the client that would newer be used, which would be waste of the user time to wait for. – Ricki Runge Mar 22 '14 at 10:04
  • I was using the Django development server at the time. I agree, the "2MB" number seems common, but if it was a "limit" at some point in the stack, why would the number of bytes recieved vary by a few thousand like it does? – Nick Perkins Mar 25 '14 at 15:47
  • Yes, sending 2MB is quite a lot, but this is an in-house app, not a public website. I do a fancy filter-as-you-type on the data in the browser. If this was a public website I would not do it like this. – Nick Perkins Mar 25 '14 at 15:51

1 Answers1

0

There is no timing data, but it looks like this might be timeout related. Check how long it takes until you get the truncated response, and look for similar timeout on the server side.

ndenev
  • 1
  • 1