Habeeb556 commented on issue #30172:
URL: https://github.com/apache/superset/issues/30172#issuecomment-2332799882

   > To prevent Superset's Gunicorn from consuming all the server memory and 
causing it to crash, you can configure Gunicorn with specific settings to 
manage memory usage more effectively. Here is an example configuration that you 
can use, based on the `docker/run-server.sh` script from the Superset 
repository:
   > 
   > ```shell
   > gunicorn \
   >     --bind "${SUPERSET_BIND_ADDRESS:-0.0.0.0}:${SUPERSET_PORT:-8088}" \
   >     --access-logfile "${ACCESS_LOG_FILE:-"-"}" \
   >     --error-logfile "${ERROR_LOG_FILE:-"-"}" \
   >     --workers ${SERVER_WORKER_AMOUNT:-10} \
   >     --worker-class ${SERVER_WORKER_CLASS:-gevent} \
   >     --worker-connections ${WORKER_CONNECTIONS:-1000} \
   >     --threads ${SERVER_THREADS_AMOUNT:-20} \
   >     --log-level "${GUNICORN_LOGLEVEL:-info}" \
   >     --timeout ${GUNICORN_TIMEOUT:-120} \
   >     --keep-alive ${GUNICORN_KEEPALIVE:-2} \
   >     --max-requests ${WORKER_MAX_REQUESTS:-1000} \
   >     --max-requests-jitter ${WORKER_MAX_REQUESTS_JITTER:-50} \
   >     --limit-request-line ${SERVER_LIMIT_REQUEST_LINE:-0} \
   >     --limit-request-field_size ${SERVER_LIMIT_REQUEST_FIELD_SIZE:-0} \
   >     "${FLASK_APP}"
   > ```
   > 
   > In this configuration:
   > 
   > * `--workers 10` sets the number of worker processes.
   > * `--worker-class gevent` uses the gevent worker class for asynchronous 
workers.
   > * `--worker-connections 1000` sets the maximum number of simultaneous 
clients.
   > * `--max-requests 1000` ensures that each worker will be restarted after 
handling 1000 requests, which helps in freeing up memory.
   > * `--max-requests-jitter 50` adds a random jitter to the max requests 
setting to prevent all workers from restarting at the same time.
   > 
   > Additionally, you can configure the `SUPERSET_WEBSERVER_TIMEOUT` setting 
in the `superset/config.py` file to ensure that the web server timeout is 
properly managed. This setting should be lower than your load balancer or proxy 
timeout settings:
   > 
   > ```python
   > SUPERSET_WEBSERVER_TIMEOUT = int(timedelta(minutes=1).total_seconds())
   > ```
   > 
   > These settings can help in managing memory usage and preventing crashes 
due to memory exhaustion 
[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/configuring-superset.mdx)[[2]](https://github.com/apache/superset/blob/master/docker/run-server.sh)[[3]](https://github.com/apache/superset/blob/master/superset/config.py).
   > 
   > _To continue talking to [Dosu](https://dosu.dev), mention @dosu._
   
   @dosu can I assigned specific memory overall cannot exceeded with no limits 
for workers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to