docs/admin/monitoring: add instructions to setup outlier statistics
This commit is contained in:
parent
6ed678dfa6
commit
4912e1782d
1 changed files with 38 additions and 0 deletions
|
|
@ -256,6 +256,44 @@ as well as database diagnostics.
|
|||
BEAM VM stats include detailed memory consumption breakdowns
|
||||
and a full list of running processes for example.
|
||||
|
||||
## Postgres Statements Statistics
|
||||
|
||||
The built-in dashboard can list the queries your instances spends the
|
||||
most accumulative time on giving insight into potential bottlenecks
|
||||
and what might be worth optimising.
|
||||
This is the “Outliers” tab in “Ecto Stats”.
|
||||
However for this to work you first need to enable a PostgreSQL extension
|
||||
as follows:
|
||||
|
||||
Add the following two lines two your `postgresql.conf` (typically placed in your data dir):
|
||||
|
||||
```
|
||||
shared_preload_libraries = 'pg_stat_statements'
|
||||
pg_stat_statements.track = all
|
||||
```
|
||||
|
||||
Now restart PostgreSQL. Then connect to your akkoma database using `psql` and run:
|
||||
|
||||
```sql
|
||||
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
|
||||
```
|
||||
|
||||
Execution time statistics will now start to be gathered.
|
||||
To get a representative sample of your instances workload you should wait a week or at least a day.
|
||||
|
||||
These statistics are never reset automatically, but with new Akkoma releases and
|
||||
changes in the servers your instance federates with the workload will evolve.
|
||||
Thus it’s a good idea to reset this occasionally using:
|
||||
|
||||
```sql
|
||||
-- get user oid: SELECT oid FROM pg_roles WHERE rolname = 'akkoma';
|
||||
-- get db oid: SELECT oid FROM pg_database WHERE datname = 'akkoma';
|
||||
SELECT pg_stat_statements_reset('<akkoma user oid>'::regclass::oid, '<akkoma database oid>'::regclass::oid);
|
||||
|
||||
-- or alternatively, to just reset stats for all users and databases:
|
||||
-- SELECT pg_stat_statements_reset();
|
||||
```
|
||||
|
||||
## Oban Web
|
||||
|
||||
This too requires administrator rights to access and can be found under `/akkoma/oban` if enabled.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue