RE: How to measue performance? Log4j on/off.
Howdy, I would use JMeter first, if you're just looking for performance numbers, i.e. time to serve that page. JMeter is ideally suited for that. JProbe and OptimizeIt are great, but they do more than you need in this case and they WILL skew performance significantly. As an aside, make sure you have all log4j Logger#debug statements enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an order of magnitude or so runtime performance improvement. Yoav Shapira Millennium ChemInformatics -Original Message- From: Justin Brister [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 8:44 AM To: 'Tomcat Users List' Subject: RE: How to measue performance? Log4j on/off. Jim, if you have any money to spend, it would be worth running a code profiler such as JProbe over the code. If you don't have access to such a tool / money, then you could try running JMeter to benchmark the site. J -Original Message- From: Jim Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 1:40 PM To: Tomcat Users List Subject: How to measue performance? Log4j on/off. We have a performance issue with a web page being served via Tomcat/Apache. I don't think it has anything to do with Tomcat, but I am being asked to turn debug logging off to help improve it. I'm resisting because the output has been extremely valuable in solving problems that still crop up and to find out what the users are really doing as opposed to what they said they did. That said, is there a definitive way I can compare the performance of the site before and after turning the logging off? Other than a stopwatch? Thanks, Jim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to measue performance? Log4j on/off.
As an aside, make sure you have all log4j Logger#debug statements enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an order of magnitude or so runtime performance improvement. Showing my C heritage here, but can't you do something like Log(an error has occurred); And in Log have a directive like class Logger() { void Log(string msg) { #ifdef DEBUG ... log message .. #endif }; And so you can compile a version with debug or no debug. Those if() statements are still going to take time to process, even if there is no logging going on. G. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to measue performance? Log4j on/off.
Jim, if you have any money to spend, it would be worth running a code profiler such as JProbe over the code. If you don't have access to such a tool / money, then you could try running JMeter to benchmark the site. J -Original Message- From: Jim Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 1:40 PM To: Tomcat Users List Subject: How to measue performance? Log4j on/off. We have a performance issue with a web page being served via Tomcat/Apache. I don't think it has anything to do with Tomcat, but I am being asked to turn debug logging off to help improve it. I'm resisting because the output has been extremely valuable in solving problems that still crop up and to find out what the users are really doing as opposed to what they said they did. That said, is there a definitive way I can compare the performance of the site before and after turning the logging off? Other than a stopwatch? Thanks, Jim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to measue performance? Log4j on/off.
Graham, unfortunately, Java does not have a precompiler (although I think there are some third party pre-processors about). J -Original Message- From: Graham Reeds [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 2:05 PM To: Tomcat Users List Subject: Re: How to measue performance? Log4j on/off. As an aside, make sure you have all log4j Logger#debug statements enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an order of magnitude or so runtime performance improvement. Showing my C heritage here, but can't you do something like Log(an error has occurred); And in Log have a directive like class Logger() { void Log(string msg) { #ifdef DEBUG ... log message .. #endif }; And so you can compile a version with debug or no debug. Those if() statements are still going to take time to process, even if there is no logging going on. G. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to measue performance? Log4j on/off.
If it were my boss wanting to do the measurement, I'd have money, but I'm trying to keep him off my back, hence no cash. Thanks, Jim. Justin Brister wrote: Jim, if you have any money to spend, it would be worth running a code profiler such as JProbe over the code. If you don't have access to such a tool / money, then you could try running JMeter to benchmark the site. J - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to measue performance? Log4j on/off.
There is a hack to accomplish similar results. If you declare a constant boolean variable as false and use it in your branch statement the compiler will exclude the entire statement. static final boolean DEBUG = false; if(DEBUG){ //conditional code goes here } On Thursday 04 December 2003 09:05 am, Graham Reeds wrote: As an aside, make sure you have all log4j Logger#debug statements enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an order of magnitude or so runtime performance improvement. Showing my C heritage here, but can't you do something like Log(an error has occurred); And in Log have a directive like class Logger() { void Log(string msg) { #ifdef DEBUG ... log message .. #endif }; And so you can compile a version with debug or no debug. Those if() statements are still going to take time to process, even if there is no logging going on. G. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ben Souther F.W. Davison Company, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to measue performance? Log4j on/off.
Hi, Yoav, I'll take a look at thos products. I wasn't aware of your other suggestion. I assume you mean it will improve the performance when debugging is turned off thus preventing the debug statement from being called at all. Is this because there is a lot of overhead with debug(...) calls even with debugging off? This will be fun, I've got a LOT of debug calls to change. 8( Thanks, Jim. Shapira, Yoav wrote: Howdy, I would use JMeter first, if you're just looking for performance numbers, i.e. time to serve that page. JMeter is ideally suited for that. JProbe and OptimizeIt are great, but they do more than you need in this case and they WILL skew performance significantly. As an aside, make sure you have all log4j Logger#debug statements enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an order of magnitude or so runtime performance improvement. Yoav Shapira Millennium ChemInformatics -Original Message- From: Justin Brister [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 8:44 AM To: 'Tomcat Users List' Subject: RE: How to measue performance? Log4j on/off. Jim, if you have any money to spend, it would be worth running a code profiler such as JProbe over the code. If you don't have access to such a tool / money, then you could try running JMeter to benchmark the site. J -Original Message- From: Jim Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 1:40 PM To: Tomcat Users List Subject: How to measue performance? Log4j on/off. We have a performance issue with a web page being served via Tomcat/Apache. I don't think it has anything to do with Tomcat, but I am being asked to turn debug logging off to help improve it. I'm resisting because the output has been extremely valuable in solving problems that still crop up and to find out what the users are really doing as opposed to what they said they did. That said, is there a definitive way I can compare the performance of the site before and after turning the logging off? Other than a stopwatch? Thanks, Jim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to measue performance? Log4j on/off.
Howdy, I would expect that the Appenders and Formatters only come into play if debug is enabled. Am I wrong ? You're right in principle, but the definition of debug is enabled is not always trivial: a class may have multiple loggers (and in log4j 1.3, multiple loggers in multiple logging domains) with different levels set up, so one may be debug-enabled while another isn't. There are also other more advanced log4j usage cases which increase the complexity of the debug call. But this is getting off-topic: the basic point was that the isDebugEnabled() check is a good practice, can only improve performance (at runtime, without changing code or using pre-processors), and can help the original poster. Yoav Shapira -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:34 PM To: Tomcat Users List Subject: RE: How to measue performance? Log4j on/off. Finally, even the example with debug(x) vs. debug(translate(x)) missed something -- the possibly complex configuration of log4j. If, for example, you have an appender such as JMS, Telnet, or SMTP (all come with log4j) configured to send out debug messages, every call to debug can be much much more expensive than simply writing a text string to a file. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to measue performance? Log4j on/off.
there are two things to consider: - the time that is spent in arguments of the call. - the time that is spent in the call If you have something like debug(abc) there is hardly any time spent constructing the argument. But if you have debug(abc + someNestedObject.toString()); or debug(translate(abc)); (or something like that) You pay the time spent in translate() and toString() even if debug is off. (They are evaluated before the method is called) Depending on the nature of the called methods that can be quite some time. In opposition to Mr. Shapira I wouldn't expect that log4 spends much time in the call to debug() as I would expect the 'if (logger.isDebugEnabled)' as first test inside of debug(). (But that's just an opinion, I have never tried it or looked at the source) -Original Message- From: Jim Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:08 PM To: Tomcat Users List Subject: Re: How to measue performance? Log4j on/off. Hi, Yoav, I'll take a look at thos products. I wasn't aware of your other suggestion. I assume you mean it will improve the performance when debugging is turned off thus preventing the debug statement from being called at all. Is this because there is a lot of overhead with debug(...) calls even with debugging off? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to measue performance? Log4j on/off.
Howdy, This is off-topic now, but the short answer is no. The longer answer is that java doesn't have such constructs at runtime, and we are talking about runtime not recompiling the code. The even longer answer has to do with log4j architecture and Logger#debug being a potentially very expensive call depending on its parameters and configured appenders, whereas isDebugEnabled is an optimize hash lookup. Yoav Shapira Millennium ChemInformatics -Original Message- From: Graham Reeds [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:05 AM To: Tomcat Users List Subject: Re: How to measue performance? Log4j on/off. As an aside, make sure you have all log4j Logger#debug statements enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an order of magnitude or so runtime performance improvement. Showing my C heritage here, but can't you do something like Log(an error has occurred); And in Log have a directive like class Logger() { void Log(string msg) { #ifdef DEBUG ... log message .. #endif }; And so you can compile a version with debug or no debug. Those if() statements are still going to take time to process, even if there is no logging going on. G. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to measue performance? Log4j on/off.
Howdy, The whole point was to change at runtime without recompiling. This is what lgo4j allows you to do. As to my order of magnitude improvement by using if(logger.isDebugEnabled()) -- it's well-proven and benchmarked in the log4j documentation, and the log4j kit comes with the benchmarks you can run yourself. Finally, even the example with debug(x) vs. debug(translate(x)) missed something -- the possibly complex configuration of log4j. If, for example, you have an appender such as JMS, Telnet, or SMTP (all come with log4j) configured to send out debug messages, every call to debug can be much much more expensive than simply writing a text string to a file. Yoav Shapira Millennium ChemInformatics -Original Message- From: Ben Souther [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:33 AM To: Tomcat Users List Subject: Re: How to measue performance? Log4j on/off. There is a hack to accomplish similar results. If you declare a constant boolean variable as false and use it in your branch statement the compiler will exclude the entire statement. static final boolean DEBUG = false; if(DEBUG){ //conditional code goes here } On Thursday 04 December 2003 09:05 am, Graham Reeds wrote: As an aside, make sure you have all log4j Logger#debug statements enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an order of magnitude or so runtime performance improvement. Showing my C heritage here, but can't you do something like Log(an error has occurred); And in Log have a directive like class Logger() { void Log(string msg) { #ifdef DEBUG ... log message .. #endif }; And so you can compile a version with debug or no debug. Those if() statements are still going to take time to process, even if there is no logging going on. G. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ben Souther F.W. Davison Company, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to measue performance? Log4j on/off.
I would expect that the Appenders and Formatters only come into play if debug is enabled. Am I wrong ? -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:34 PM To: Tomcat Users List Subject: RE: How to measue performance? Log4j on/off. Finally, even the example with debug(x) vs. debug(translate(x)) missed something -- the possibly complex configuration of log4j. If, for example, you have an appender such as JMS, Telnet, or SMTP (all come with log4j) configured to send out debug messages, every call to debug can be much much more expensive than simply writing a text string to a file. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]