Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic uWSGI Configuration Optimization Based on System Resources #2156

Closed
wants to merge 5 commits into from

Conversation

Lordkaly
Copy link

###Overview
This pull request enhances the uWSGI configuration generated by tacticalrmm/management/commands/create_uwsgi_conf.py by dynamically adjusting key parameters (workers, threads, cheaper, socket-timeout, and harakiri) based on the system's CPU count and available RAM. The changes improve scalability and performance, particularly under high agent loads, while maintaining compatibility with smaller systems.

###Motivation
In a production environment with 10 CPUs and 16 GB of RAM, running Tactical RMM with many active agents (like 2.000), I encountered frequent connect() failed (11: Resource temporarily unavailable) errors from NGINX due to uWSGI socket saturation. The original static configuration struggled to handle the load, leading to dropped connections and degraded performance. Through extensive testing, I identified optimized settings that resolved these issues.

###Overview
This pull request enhances the uWSGI configuration generated by tacticalrmm/management/commands/create_uwsgi_conf.py by dynamically adjusting key parameters (workers, threads, cheaper, socket-timeout, and harakiri) based on the system's CPU count and available RAM. The changes improve scalability and performance, particularly under high agent loads, while maintaining compatibility with smaller systems.

###Motivation
In a production environment with 10 CPUs and 16 GB of RAM, running Tactical RMM with many active agents (like 2.000), I encountered frequent connect() failed (11: Resource temporarily unavailable) errors from NGINX due to uWSGI socket saturation. The original static configuration struggled to handle the load, leading to dropped connections and degraded performance. Through extensive testing, I identified optimized settings that resolved these issues.
Dynamic uWSGI Configuration Optimization Based on System Resources
@wh1te909
Copy link
Member

please remove the ChatGPT generated garbage code (which breaks existing functionality, i'm not even sure how you claimed to get this to work) and only focus on adjusting settings related to uwsgi workers, and then I might take a look at it.

This commit enhances the install.sh script by integrating Redis cache settings into the initial creation of local_settings.py. The cache configuration is added with django-redis, setting a default TTL of 300 seconds to improve performance for API responses and frontend loading. The change replaces the previous localvars block with a more comprehensive setup, ensuring cache is enabled out-of-the-box while preserving existing settings like CORS and database credentials.
Add Redis cache configuration to local_settings.py in install.sh
@Lordkaly Lordkaly closed this Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants