[OT] Re: Effects of turning off sendFile in the NIO connector

2014-03-25 Thread Mark Thomas
On 23/03/2014 12:41, Martin Gainty wrote:
 
 Date: Sat, 22 Mar 2014 14:24:01 -0400
 Subject: Effects of turning off sendFile in the NIO connector
 From: tomcat.ran...@gmail.com
 To: users@tomcat.apache.org

 What effect would setting useSendfile=false have on a web application using
 the NIO connector? I'm asking because I may want to use gzip compression in
 the connector. The docs state:

 *There is a tradeoff between using compression (saving your bandwidth) and
 using the sendfile feature (saving your CPU cycles). If the connector
 supports the sendfile feature, e.g. the NIO connector, using sendfile will
 take precedence over compression. The symptoms will be that static files
 greater that 48 Kb will be sent uncompressed.*

 It's trivial that adding compression uses CPU cycles, but does that imply
 that turning sendFile off even without enabling compression would increase
 CPU cycles? It's worth mentioning that the site serves a large (8mg) SWF
 file. I believe that was one of the pluses of NIO/sendFile, that it was
 good with sending large files under heavy traffic?
 
 MGwhen you enable sendfile support with request attr  
 org.apache.tomcat.sendfile.support = true
 MGYou will need to set these 3 header attributes
 
 org.apache.tomcat.sendfile.filename: Canonical filename of the file which 
 will be sent as a String 
 org.apache.tomcat.sendfile.start: Start offset as a Long 
 org.apache.tomcat.sendfile.end: End offset as a Long

While this is relevant to how sendfile works under the covers and would
be relevant if the OP was trying to use sendfile from their own servlet
(rather than just using the sendfile support Tomcat provides for static
content via the default servlet), is is not at all relevant to the
question the OP asked.


 MGhtitps://tomcat.apache.org/tomcat-6.0-doc/aio.html 

The OP stated they are using Tomcat 7, not Tomcat 6.

You failed to copy and paste that URL correctly.


 MGCompression:
 MGset compression=on @ Connector
 MGhttps://tomcat.apache.org/tomcat-7.0-doc/config/http.html
 
 MGI did not read that TC cannot use sendfile with any compressed Stream?
 MGcan you show us the URL?

Clearly you did not bother to read the description for the compression
attribute on the URL you just quoted. It clearly states that sendfile
and compression may not be used together.



Martin,

Replies from you that miss the point of the original question are a
regular occurrence. I'll go further and state that it is very unusual
for a reply of yours to be relevant and useful to the person asking for
help.

Not only is it rare for a reply of yours to be helpful, in many cases
your replies mislead the person seeking help and cause them to waste
considerable time. Such responses are detrimental to the health of this
community.

Therefore, with the health of this community and mind and wearing my
list owner's hat, I am asking you to take more care when you reply. If
the current pattern continues then you will be unsubscribed from this
mailing list and prevented from resubscribing.

Mark


P.S. For folks thinking that this is rather a harsh message to post on a
public mailing list, a number of mailing list regulars have tried to
steer Martin in the right direction off-list only to be consistently
meet with a refusal by Martin to accept that there is anything wrong
with any of his posts.


 We also only really need compression on XML data, the site has minimal
 HTML, SWF's don't really benefit from gzip and some binary data we send
 back and forth is already compressed. I could manually implement
 compression on XML at the application level and within the SWF, if turning
 off sendFile will have negative consequences.

 Tomcat 7.0.42
 RHEL6
 ~4T outbound traffic/day

 Best,
 John
 
 


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



RE: Effects of turning off sendFile in the NIO connector

2014-03-23 Thread Martin Gainty


  


 Date: Sat, 22 Mar 2014 14:24:01 -0400
 Subject: Effects of turning off sendFile in the NIO connector
 From: tomcat.ran...@gmail.com
 To: users@tomcat.apache.org
 
 What effect would setting useSendfile=false have on a web application using
 the NIO connector? I'm asking because I may want to use gzip compression in
 the connector. The docs state:
 
 *There is a tradeoff between using compression (saving your bandwidth) and
 using the sendfile feature (saving your CPU cycles). If the connector
 supports the sendfile feature, e.g. the NIO connector, using sendfile will
 take precedence over compression. The symptoms will be that static files
 greater that 48 Kb will be sent uncompressed.*
 
 It's trivial that adding compression uses CPU cycles, but does that imply
 that turning sendFile off even without enabling compression would increase
 CPU cycles? It's worth mentioning that the site serves a large (8mg) SWF
 file. I believe that was one of the pluses of NIO/sendFile, that it was
 good with sending large files under heavy traffic?

MGwhen you enable sendfile support with request attr  
org.apache.tomcat.sendfile.support = true
MGYou will need to set these 3 header attributes

org.apache.tomcat.sendfile.filename: Canonical filename of the file which will 
be sent as a String 
org.apache.tomcat.sendfile.start: Start offset as a Long 
org.apache.tomcat.sendfile.end: End offset as a Long 
MGhtitps://tomcat.apache.org/tomcat-6.0-doc/aio.html 

MGCompression:
MGset compression=on @ Connector
MGhttps://tomcat.apache.org/tomcat-7.0-doc/config/http.html

MGI did not read that TC cannot use sendfile with any compressed Stream?
MGcan you show us the URL?
MGThanks

 We also only really need compression on XML data, the site has minimal
 HTML, SWF's don't really benefit from gzip and some binary data we send
 back and forth is already compressed. I could manually implement
 compression on XML at the application level and within the SWF, if turning
 off sendFile will have negative consequences.
 
 Tomcat 7.0.42
 RHEL6
 ~4T outbound traffic/day
 
 Best,
 John
  

Re: Effects of turning off sendFile in the NIO connector

2014-03-23 Thread John Smith


 MGwhen you enable sendfile support with request attr
  org.apache.tomcat.sendfile.support = true
 MGYou will need to set these 3 header attributes

 org.apache.tomcat.sendfile.filename: Canonical filename of the file which
 will be sent as a String
 org.apache.tomcat.sendfile.start: Start offset as a Long
 org.apache.tomcat.sendfile.end: End offset as a Long
 MGhtitps://tomcat.apache.org/tomcat-6.0-doc/aio.html

 MGCompression:
 MGset compression=on @ Connector
 MGhttps://tomcat.apache.org/tomcat-7.0-doc/config/http.html

 MGI did not read that TC cannot use sendfile with any compressed Stream?
 MGcan you show us the URL?
 MGThanks

  We also only really need compression on XML data, the site has minimal
  HTML, SWF's don't really benefit from gzip and some binary data we send
  back and forth is already compressed. I could manually implement
  compression on XML at the application level and within the SWF, if
 turning
  off sendFile will have negative consequences.
 
  Tomcat 7.0.42
  RHEL6
  ~4T outbound traffic/day
 
  Best,
  John



Your first link refers to using sendFile for asynchronous writes from a
servlet. Any servlet can instruct Tomcat to perform a sendfile call by
setting the appropriate request attributes. Your answer is not accurate. I
don't need to do anything explicitly with the headers. You should look at
the documentation regarding the HTTP NIO Connector - which you already have
as the second link in your reply. It discusses sendFile and compression,
and how you cannot use both the NIO connector and compression if sendFile
is on (on is the default).


Re: Effects of turning off sendFile in the NIO connector

2014-03-23 Thread Mark Thomas
On 23/03/2014 19:37, John Smith wrote:

 We also only really need compression on XML data, the site has minimal
 HTML, SWF's don't really benefit from gzip and some binary data we send
 back and forth is already compressed. I could manually implement
 compression on XML at the application level and within the SWF, if
 turning
 off sendFile will have negative consequences.

 Tomcat 7.0.42
 RHEL6
 ~4T outbound traffic/day

 Best,
 John

John

The consequences for disabling sendFile are extremely hard to quantify
as there are so many variables. I would normally expect there to be more
CPU load but how much more? No idea. It might be impossible to detect,
it might leaver your CPUs pegged at 100%.

The only way you will know for sure for your application is to test it
with your application.

Mark

P.S. As you've probably figured out having been Martined, the best
location for any response from Martin Gainty is /dev/null. I keep
debating dropping him from the list as he causes far more harm than
good. A topic for a separate thread I think.


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



Re: Effects of turning off sendFile in the NIO connector

2014-03-23 Thread John Smith

 John

 The consequences for disabling sendFile are extremely hard to quantify
 as there are so many variables. I would normally expect there to be more
 CPU load but how much more? No idea. It might be impossible to detect,
 it might leaver your CPUs pegged at 100%.

 The only way you will know for sure for your application is to test it
 with your application.

 Mark

 P.S. As you've probably figured out having been Martined, the best
 location for any response from Martin Gainty is /dev/null. I keep
 debating dropping him from the list as he causes far more harm than
 good. A topic for a separate thread I think.



Mark,

Thanks for the answer. As suggested, I'll test it and see what
happens...kind of figured I'd have to do that :)

Appreciate the heads-up on MG. I was wondering why the answer seemed
off.

Best,
Alec