How can we limit the upload speed?

4 posts, 1 answers
  1. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 10 Jun 2009 Link to this post

    Hi all,

    I'm working on a new upload control, inspired on RadUpload, just because I'm not able to limit the upload speed. Consider, for instance, a website where the users have several membership levels, where the highest provides more speed, and the lowest conserve server resources and bandwidth.

    If was possible to change the chunk packet size (before *and* during the upload) I could use that feature throught RadUpload. I'd already implement that in another silverlight control, but could be a useful (and rare) feature.

    Thanks in advance,

    --Rubens
  2. Answer
    Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 11 Jun 2009 Link to this post

    Hi Rubens,

    Thank you for the interest in our RadUpload control.

    Even the speed-limit feature is not available just out of the box we have advise you to preview the How to limit the upload speed article. Any valuable feedback will be highly appreciated.

    For your convenience we have attached the example to this thread too.

    Sincerely yours,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 11 Jun 2009 Link to this post

    Hi Ivan,

    Thanks for your time; I ran your code and saw it does basically that I need, but there are a few more points.

    In my control, I send a first 1k size packet to server, where I detect it's a first request and increment a "concurrent users" counter. Those users will share the bandwidth available. If it's just one user and the bandwidth is 100kb/s, my web handler returns 102400 as next packet size, so, at upload control again, I wait for remaining time to complete one second and send the next, 100k size, packet.

    Meanwhile, if another user starts to upload, I increment that counter again and compute the next packet size, for both users, must be no greater than 50k. The main point is: I can change the buffer size dynamically.

    I'm not sure if was a UI glitch, but in your sample the upload control is recreated every time I change the maximum upload speed.

    It's possible to change your .BufferSize property after the upload started?

    Another question: how can I detect upload cancelation? The user can politely click a cancel button, or close the browser window, but I need to know in both cases, to free the space used so far and to decrement that concurrent users counter.

    /hug,

    Rubens
  5. Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 12 Jun 2009 Link to this post

    Hello Rubens,

    Thank you for sharing your vision about the behavior of the upload control. We would like to make some notes about the provided information:
    • Probably you already found how to return the information about the permitted limit from the upload handler, if not you can find more about this technique in the Returning custom data from the handler article. Unfortunately the BufferSize can not be changed dynamically.
    • Cancelation (via pressing the Cancel button or by calling the CancelUpload method) of the upload process does not break the example - we have already handling the UploadCanceled event (with the same handler we have using for the UploadFinished event).
    • About the control recreation after changing the upload speed - actually there is only a cleaning of the upload list because all of its items are referencing the old buffer size (yes we changed the buffer size to respect the upload speed) and we can not change it.
    • About the uploader's BufferSize - as we already mentioned till now there is no way to change it dynamically.
    • About the notification on closing the browser's window - I am not sure will you succeed to notify the server in all cases.

    Depend on all this information I tend to suggest that you can try to accomplish your task via modifying the upload handler (server side).

    Greetings, 

    Ivan

    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top