dosubot[bot] commented on issue #33218:
URL: https://github.com/apache/superset/issues/33218#issuecomment-2823061737

   <!-- Answer -->
   I found a similar unsolved discussion regarding timeout errors while 
creating dashboards in Superset 4.0.2, which might be relevant to your issue 
<sup>[[1]](https://github.com/apache/superset/discussions/31823)</sup>.
   
   To address the SQL query timeout issue and enable asynchronous replies to 
the client, you can configure Superset and Nginx as follows:
   
   1. **Configure Celery in Superset:**
      - Define a `CELERY_CONFIG` in your `superset_config.py` file to handle 
asynchronous query execution.
   
      ```python
      class CeleryConfig(object):
          broker_url = "redis://localhost:6379/0"
          imports = (
              "superset.sql_lab",
              "superset.tasks.scheduler",
          )
          result_backend = "redis://localhost:6379/0"
          worker_prefetch_multiplier = 10
          task_acks_late = True
          task_annotations = {
              "sql_lab.get_sql_results": {
                  "rate_limit": "100/s",
              },
          }
   
      CELERY_CONFIG = CeleryConfig
      ```
   
   2. **Start Celery Workers:**
      - Use the following command to start a Celery worker:
   
      ```bash
      celery --app=superset.tasks.celery_app:app worker --pool=prefork -O fair 
-c 4
      ```
   
   3. **Set Up a Result Backend:**
      - Configure a result backend in your `superset_config.py` to store query 
results.
   
      ```python
      from flask_caching.backends.rediscache import RedisCache
      RESULTS_BACKEND = RedisCache(
          host='localhost', port=6379, key_prefix='superset_results')
      ```
   
   4. **Enable Asynchronous Query Execution:**
      - Ensure that asynchronous query execution is enabled in your database 
settings within Superset.
   
   5. **Adjust Timeout Settings:**
      - Modify the `SUPERSET_WEBSERVER_TIMEOUT` setting in your 
`superset_config.py` file to a value that matches or exceeds your gateway's 
timeout limit.
   
      ```python
      SUPERSET_WEBSERVER_TIMEOUT = 1800  # Adjust this value as needed
      ```
   
   6. **Configure Nginx Timeout Settings:**
      - Extend the timeout settings in your Nginx configuration to accommodate 
long-running queries.
   
      ```yaml
      ingress:
        annotations:
          nginx.ingress.kubernetes.io/proxy-connect-timeout: "1800"
          nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
          nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
      ```
   
   7. **Consider Using Gunicorn for Better Concurrency:**
      - Use Gunicorn in async mode for running Superset.
   
      ```bash
      gunicorn -w 10 -k gevent --worker-connections 1000 --timeout 120 -b 
0.0.0.0:6666 --limit-request-line 0 --limit-request-field_size 0 
"superset.app:create_app()"
      ```
   
   These configurations should help prevent timeouts and enable asynchronous 
replies to the client 
<sup>[[2]](https://github.com/apache/superset/blob/master/docs/docs/configuration/async-queries-celery.mdx)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/docs/docs/faq.mdx)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/helm/superset/values.yaml)</sup><sup>[[5]](https://github.com/apache/superset/blob/master/docs/docs/configuration/configuring-superset.mdx)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/c6f1752a-79a0-42bd-ad90-b7d61e41f195?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/c6f1752a-79a0-42bd-ad90-b7d61e41f195?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/c6f1752a-79a0-42bd-ad90-b7d61e41f195?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/c6f1752a-79a0-42bd-ad90-b7d61e41f195?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/c6f1752a-79a0-42bd-ad90-b7d61e41f195?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/c6f1752a-79a0-42bd-ad90-b7d61e41f195?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/c6f1752a-79a0-42bd-ad90-b7d61e41f195?feedback_type=other)</sup>
   


-- 
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