WSGI servers - Amazon CodeGuru Profiler

WSGI servers

Start the profiler based on the configuration for your web server.


Configure CodeGuru Profiler in your file. Then, start your application by adding the --enable-threads and --lazy-apps parameters to your uWSGI startup configuration. These are required for CodeGuru Profiler to run in your uWSGI applications.

uwsgi --http :8000 --chdir . --wsgi-file --enable-threads --lazy-apps --workers=4


Configure CodeGuru Profiler in your post-fork method. Then start the application as usual.

def post_fork(server, worker):'Starting profiler for {} in {}'.format(os.getpid(), threading.get_ident())) worker.profiler = Profiler(profiling_group_name='MyProfilingGroup') worker.profiler.start()'Profiler started running for worker pid {}: master pid {}.'.format(os.getpid(), worker.ppid))


For Apache (httpd) with mod_wsgi module, use the same wsgi configuration. Make sure the file is configured to be visible in the httpd.conf file.

<Directory [to_be_replaced]> <Files> Require all granted </Files> </Directory>

Start your application with apachectl start.