google_perftools_profiles

The `google_perftools_profiles` directive enables profiling with Google Performance Tools in NGINX.

Syntaxgoogle_perftools_profiles path;
Defaultnone
Contextmain
Arguments1

Description

The google_perftools_profiles directive is situated within the NGINX core configuration, and it is used to enable the collection of profiling information using Google Performance Tools (gperftools). This profiling is beneficial for monitoring and analyzing the performance of NGINX processes, allowing administrators to pinpoint performance bottlenecks and optimize their configurations accordingly. When this directive is enabled, NGINX will generate profiling information that can be analyzed with tools such as 'pprof'.

Specifically, the directive takes a single argument which is a path to the output file where profiling data should be stored. This information includes CPU usage, memory allocation statistics, and call graphs which provide insights into the functioning of the NGINX worker processes. By carefully examining the generated profiles, performance issues can be identified and addressed, leading to improved performance and resource utilization of the NGINX server.

The directive must be placed in the main context of the NGINX configuration and should be set with a valid path as its argument. If the specified path is not writable by the NGINX worker processes, the profiling will not be enabled, leading to potentially misleading conclusions about the performance. It is often used in conjunction with other performance directives to gain a comprehensive understanding of server health.

Config Example

google_perftools_profiles /var/log/nginx/perf_data;

Ensure the specified path has the correct permissions for the NGINX worker processes to write profiling data.

Do not enable profiling in a production environment if performance is critical, as it may add overhead.

Remember to disable or remove this directive in production after collecting the necessary profiling data.

← Back to all directives