question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I run my stateless flask apps with mod_wsgi/apache using daemon mode like:

WSGIDaemonProcess foo-services python-home=/opt/my_org/foo-services/_env processes=8 threads=48 maximum-requests=10000 display-name=%{GROUP}
WSGIApplicationGroup %{GLOBAL}
WSGISocketPrefix /var/run/wsgi


Alias /image-services "/opt/my_org/foo-services/wsgi.py"
<Location "/for-services">
SetHandler wsgi-script
Options +ExecCGI
FileETag None
ExpiresActive On
ExpiresDefault "access plus 1 year"
WSGIProcessGroup image-services
</Location>

Which means when a request gets to the service it could be hitting 1 of 8 daemon processes each of which have their own memory in isolation of the others. Does the metrics endpoint store the prometheus data in a way that is shared across these daemons?

I can create some tests to verify if thats the case or not, just curious if the answer is already known.

Thanks, Thatcher

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:30 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
rycus86commented, Sep 12, 2019

Oh, so sorry I forgot to mention that! 😕 Yes, you do need that, maybe I should make that fail more aggressively, currently it’s only checked in a few places, and obviously your code path didn’t run into it. https://github.com/rycus86/prometheus_flask_exporter/blob/master/prometheus_flask_exporter/multiprocess.py#L12

Glad you managed to work it out! 👍

1reaction
torquerrrcommented, Sep 11, 2019

@rycus86 Thank you for your help, I will try this approach and return with results 😃 Yes, I will try to prepare such example. I want to reproduce that locally because I see this issue on Kubernetes pod only (

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quick Configuration Guide — mod_wsgi 4.9.4 documentation
In daemon mode a set of processes is created for hosting a WSGI application, with any requests for that WSGI application automatically being...
Read more >
mod_wsgi daemon mode - WSGIDaemonProcess per virtual ...
When mod_wsgi is run in Daemon mode, and you enable the WSGIDaemonProcess and WSGIProcessGroup directives on a per virtual host basis, ...
Read more >
Mod wsgi notes - Helpful
Daemon mode means mod_wsgi starts up and manages separate processes. creates a set of daemon processes (mount is configurable) which ...
Read more >
How to use Django with Apache and mod_wsgi
“Daemon mode” is the recommended mode for running mod_wsgi (on non-Windows platforms). To create the required daemon process group and delegate the Django ......
Read more >
mod_wsgi Configuration Directives - Google Code
Options ExecCGI SetHandler wsgi-script WSGIApplicationGroup %{ENV:APPLICATION_GROUP} ```. Note that in embedded mode or a multi process daemon process group ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found