2

I have a script which uploads a lot of POST data using jQuery, but this interferes with all other requests as the outgoing data swamps any other requests the browser (and other things, like ssh clients) might make.

is it possible (unlikely, yes) to tell the connection to slow down a bit as it's not a priority, and let other connections through?

jQuery is tagged, because that's the major library I'm using, but I can work on a lower level if the answer needs it.

Kae Verens
  • 4,076
  • 3
  • 21
  • 41
  • Split the data into multiple pieces. In the server side, you can handle the scalability of the data. jQuery will not assist you with scalable managements. – Ohgodwhy Jul 08 '12 at 22:08
  • that's an interesting solution! if there is no other more appropriate one, I will go with that. Luckily the data being uploaded is purely text, so I can do that easily enough. – Kae Verens Jul 08 '12 at 22:13
  • If you are uploading so much text as to overwhelm a broadband connection, consider compressing it before transmission. http://stackoverflow.com/questions/4856717/javascript-equivalent-of-pythons-zip-function – Eric J. Jul 08 '12 at 22:18
  • If you have stream-like control over the backend side of this, you can simply regularly defer reading from the incoming filestream and let TCP congestion control kick in. – Daniel Baulig Jul 08 '12 at 22:22
  • Daniel, probably a bit too much work to do in that one (it's a standard LAMP stack on a shared server). Eric, good idea, I'm looking into client-side compression algorithms now. combined with Ohgodwhy's idea, this might do it – Kae Verens Jul 08 '12 at 22:29
  • With free text then I wouldn't hold out much hope of significant algorithmic compression, however if the data comprises repeated chunks of text then it could be codified for transmission and re-expanded server-side. – Beetroot-Beetroot Jul 09 '12 at 01:17
  • Hi.Did you ever found a workarround for your problem?I am in the same spot:-( I am trying to upload many files but that gets in the way when i try to load other content inside my web app. – Sotiris Zegiannis Feb 08 '16 at 13:55

1 Answers1

0

There was no definite answer to this question, but the ideas presented by commenters have worked over time.

When I need to upload a lot of similar data these days, I write a function which handles the actual upload. It gathers data and "pauses" for a few ms to see if there will be further upload requests. when sufficient time has passed with no upload requests (or th queue is a certain length or size), the function then aggregates all upload data into a single upload to a server-side function designed to split those apart, handle them, and return the various results to the function which then andles callbacks if there are any.

the above may sound complex, but it has made a huge difference in reducing network swamping.

Kae Verens
  • 4,076
  • 3
  • 21
  • 41