--with-debug compile option

Hi,

I need to compile Nginx with --with-debug option.

Will there be any performance implications if I have this flag set but
NOT set the error log to debug_* when I don’t want to debug or
troubleshoot any issue?

Posted at Nginx Forum:

On Tue, Jun 26, 2012 at 10:24:11PM -0400, paphillon wrote:

I need to compile Nginx with --with-debug option.

Will there be any performance implications if I have this flag set but
NOT set the error log to debug_* when I don’t want to debug or
troubleshoot any issue?

No. Using Core functionality is also worth
considering.

On Wed, Jun 27, 2012 at 02:20:15PM +0800, agentzh wrote:

Even though the current error log level is set higher than “debug”,
there will still be C function call overhead for all those
ngx_log_debugN calls.

These aren’t functions but are macros that first check if log_level is
set for debugging, and they don’t pessimize performance in any
measurable
way.

Also, both the nginx core and lots of 3rd-party modules have chunks of
debugging code protected by the “#if (NGX_DEBUG)” and “#endif” C
macros, which won’t get even compiled when --with-debug is not
specified.

The same holds true for ngx_log_debugN() macros.

Generally speaking, more code compiled (and run) means more
bugs. I can catch issues in the debugging code from time to time.

Most of these allocate some register/stack space, do some assignments,
and empty loop at worst. Some of these can be optimized by first
checking if log_level was set for debugging (like is done in
ngx_select_process_events(), for example). Still, think they don’t
pessimize performance measurable.

(There’s some debugging code in SSL that’s not conditional on the
log_level to be set for debugging.)

Hello!

On Wed, Jun 27, 2012 at 10:24 AM, paphillon [email protected]
wrote:

I need to compile Nginx with --with-debug option.

Will there be any performance implications if I have this flag set but
NOT set the error log to debug_* when I don’t want to debug or
troubleshoot any issue?

Even though the current error log level is set higher than “debug”,
there will still be C function call overhead for all those
ngx_log_debugN calls.

Also, both the nginx core and lots of 3rd-party modules have chunks of
debugging code protected by the “#if (NGX_DEBUG)” and “#endif” C
macros, which won’t get even compiled when --with-debug is not
specified. Generally speaking, more code compiled (and run) means more
bugs. I can catch issues in the debugging code from time to time.

We usually do not use nginx builds with --with-debug in production
environments but we also prepare a separate debugging build at the
same time.

Best regards,
-agentzh