we got a high load java application that works in cluster mode.
I need to add the ability to download and upload files for our clients. I am going to store the files in the userโs gridFs, but I'm not sure if this is the best choice, but mongo can be clustered, and mongo can replicate data between diff nodes. This is exactly what I need.
Different user groups should be limited by different bandwidth. Based on some business rules, I should limit the download speed for some users. I saw several solutions for this
Most of them work the same.
- Read a bunch of bytes
- Sleepy thread
- Repeat
Mongo just provided me with an InputStrem, and I can read from this stream and write to the servlet output stream. I am not sure if this is a valid approach. In addition, I am afraid that users may create many juicy threads at boot time, and this may hurt performance.
Could this be a problem for the servlet container?
If this can be a problem, how can it be avoided? perhaps using nio?
I prefer to use a purely java solution.
Any help would be greatly appreciated.
java servlets download
user12384512
source share