java - How to cause server to serve slower download to client ( like all this direct download sites ) -


I am using Java tomcat as backend and apache, for stable files between static users, and faster The option will speed up the normal download speed, but if I can make the files stored on the same server slow to download?

If you are using some Java method to distribute the file, then you wait a few There are individual blocks, where you are copying the file input stream into the server output stream. (Do not wait after each byte, because it adds an overhead on your server.)

But make sure that the result is not in multiple threads running on your server (even if they all Only waiting for the most

If you are using Apache httpd directly to distribute this file, then you have to use some Apache config (such as the proposed time) And must switch to servlet or deliver it.

Comments