0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-12-24 22:32:43 -05:00

admin: document SLOW_QUERY_TRESHOLD option

- This is a Forgejo-specific option and the associated pull request is
- https://codeberg.org/forgejo/forgejo/pulls/1284.
- Adding a recommendation to set it to a lower value if an administrator
is investigating poor database performance with Forgejo.
This commit is contained in:
Gusted 2023-08-21 21:22:39 +02:00 committed by Earl Warren
parent 21517723f4
commit 2b3136b775
2 changed files with 5 additions and 0 deletions

View file

@ -441,6 +441,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `MAX_IDLE_CONNS` **2**: Max idle database connections on connection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`.
- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL/MariaDB where it is 3s - see #6804 & #7071).
- `AUTO_MIGRATION` **true**: Whether execute database models migrations automatically.
- `SLOW_QUERY_TRESHOLD`: **5s**: Sets the threshold for SQL queries before they are logged as slow queries in the log.
Please see #8540 & #8273 for further discussion of the appropriate values for `MAX_OPEN_CONNS`, `MAX_IDLE_CONNS` & `CONN_MAX_LIFETIME` and their
relation to port exhaustion.

View file

@ -75,3 +75,7 @@ If you have configured to allow Git over SSH (enabled by default), and decided n
```
AcceptEnv GIT_PROTOCOL
```
### Database performance
When trying to undertand poor database performance in conjunction with Forgejo, it is useful to set `[database].SLOW_QUERY_TRESHOLD` to a value lower than the default (5 seconds). This ensures that SQL queries that are slow, but not too slow to meet the default value, are logged and can provide insight into what kind of SQL queries are slow, moreover, this is useful information for Forgejo contributors to find the code where this SQL query is executed and understand the context.