--with-debug compile option
ru at nginx.com
Wed Jun 27 07:44:05 UTC 2012
On Wed, Jun 27, 2012 at 02:20:15PM +0800, agentzh wrote:
> On Wed, Jun 27, 2012 at 10:24 AM, paphillon <nginx-forum at nginx.us> 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.
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
> 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
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.)
> 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.
More information about the nginx