How to cause server to serve slower download to client ( like all this direct download sites )
I'm using java tomcat as backend end apache from end for static files with mod_js in between I like to give the users slow and fast options , fast will be the ordinary download speed , but how can I cause the files to download slower if they s开发者_JAVA百科tored in the same server ?
If you are using some Java method to deliver the file, then you have to do some waiting between the individual blocks, where you are copying the file input stream to the server output stream. (Do not wait after each byte, as this adds overhead on your server.)
But make sure this does not result in too many threads running concurrently on your server (even if they all are doing only waiting most of the time).
If you are using directly Apache httpd to deliver this file, you either have to use some Apache config (like tim proposed) or disable this and switch to a servlet or similar to deliver it.
Could you use something like mod_cband with your Apache install?
精彩评论