Github user Yuanuo commented on the issue:

    https://github.com/apache/tomcat/pull/126
  
    Ok. It has been closed, but I still want to express my views here.
    
    I am very sorry about my English level. These texts are all done with 
Google Translate.
    
    1. In any actual environment, the resources and bandwidth of the server are 
limited, so the speed limit function is necessary.
    
    2, Nginx, Apache, Lighttpd Web servers have Sendfile module to achieve 
high-performance data transmission. I am using Nginx now, the other two have 
not been studied. Nginx's Sendfile mode also supports speed limit, which is 
implemented using the "X-Accel-Limit-Rate" header. And the implementation 
principle of the speed limit is basically the same, in short, it is guaranteed 
to transmit only the bytes of certain data within one second, so the 
process/thread sleep wait will be generated. But does this speed limit feature 
make Nginx a low-performance web server? The answer is no, this feature will 
only work when you use it, but it is turned off by default. But this also 
provides a possibility for people to use.
    
    3, we all know that Tomcat is not only used to transfer a few css or js, 
and according to the Tomcat implementation, to enable the Sendfile mode, the 
default sendfileSize is also 48KB, that is, only data larger than this amount 
will try to enable Sendfile transfer mode. In other applications, such as to do 
a file download server, you can't make any restrictions so that several 
download connections will run out of server bandwidth.
    
    4, in the modern Web environment, generally do not directly use Tomcat as a 
Web server, but use Nginx+Tomcat or other working modes. If you are dealing 
with static resources, css, js, jpg, png, etc., most of them can be handed over 
to Nginx for direct processing without going through Tomcat. In this case, 
Tomcat's Sendfile will never be used. What does this mean? That is to say, the 
Sendfile function that everyone has to maintain will not be used, even if a lot 
of code is written to implement APR, NIO, NIO2 and other modes.
    
    5, the code I submitted does not destroy the original working mode, which 
is what it is, these codes will not play any role by default. It will only be 
turned on after some parameters have been set. This gives people a possibility, 
but it is decided by people. On the contrary, even if there is a default 
high-performance NIO implementation of Sendfile, but people are worried that 
their server bandwidth is used up, and can not carry out any speed limit, then 
the default implementation of the Sendfile function will never be used, then 
everyone writes these What is the use of the code? Yes, you said that these 
requirements can be achieved by writing a Servlet or Filter yourself, yes, 
that's it. But everyone who uses Tomcat has to write a set of Servlets or 
Filters to implement this function. Who is the implementation of Tomcat's own 
implementation? I think this speed limit feature for Sendfile does not break 
any existing code and structure, but rather an enhancement to Tomcat.
    
    6. Yes, there is no example of how to use it here. However, in the 
submitted code, the DefaultServlet has only been modified a few lines, and 
these lines (lines 2068-2070) are examples of how to use them. So some people 
may not have viewed the submitted code at all, and directly rely on other 
people's opinions to negate my code submission, showing that this is 
unacceptable, and I also doubt this kind of work attitude. Sorry! Since this 
has been closed, I am not going to describe the usage here.
    
    
    Finally, no matter what, I decided to use Nginx's Sendfile to achieve my 
needs. This is how I use it in my current PHP code. This submission will be 
abandoned.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to