From 492fc5c42aaedbedd7f3523c6f0a35e2847142a4 Mon Sep 17 00:00:00 2001 From: H-Shay Date: Thu, 2 Dec 2021 17:46:48 +0000 Subject: deploy: 49e1356ee3d5d72929c91f778b3a231726c1413c --- develop/usage/administration/admin_faq.html | 14 ++++++++------ .../administration/database_maintenance_tools.html | 20 ++++---------------- ...understanding_synapse_through_grafana_graphs.html | 19 +++++++++++++++---- 3 files changed, 27 insertions(+), 26 deletions(-) (limited to 'develop/usage/administration') diff --git a/develop/usage/administration/admin_faq.html b/develop/usage/administration/admin_faq.html index e59e41277f..a77ef2db76 100644 --- a/develop/usage/administration/admin_faq.html +++ b/develop/usage/administration/admin_faq.html @@ -186,21 +186,21 @@

How do I become a server admin?

If your server already has an admin account you should use the user admin API to promote other accounts to become admins. See User Admin API

If you don't have any admin accounts yet you won't be able to use the admin API so you'll have to edit the database manually. Manually editing the database is generally not recommended so once you have an admin account, use the admin APIs to make further changes.

-
UPDATE users SET admin = 1 WHERE name = '@foo:bar.com';
+
UPDATE users SET admin = 1 WHERE name = '@foo:bar.com';
 

What servers are my server talking to?

Run this sql query on your db:

-
SELECT * FROM destinations;
+
SELECT * FROM destinations;
 

What servers are currently participating in this room?

Run this sql query on your db:

-
SELECT DISTINCT split_part(state_key, ':', 2)
+
SELECT DISTINCT split_part(state_key, ':', 2)
     FROM current_state_events AS c
     INNER JOIN room_memberships AS m USING (room_id, event_id)
     WHERE room_id = '!cURbafjkfsMDVwdRDQ:matrix.org' AND membership = 'join';
 

What users are registered on my server?

-
SELECT NAME from users;
+
SELECT NAME from users;
 

Manually resetting passwords:

See https://github.com/matrix-org/synapse/blob/master/README.rst#password-reset

@@ -219,9 +219,9 @@

Using the following curl command:

curl -H 'Authorization: Bearer <access-token>' -X DELETE https://matrix.org/_matrix/client/r0/directory/room/<room-alias>
 
-

<access-token> - can be obtained in riot by looking in the riot settings, down the bottom is: +

<access-token> - can be obtained in riot by looking in the riot settings, down the bottom is: Access Token:<click to reveal>

-

<room-alias> - the room alias, eg. #my_room:matrix.org this possibly needs to be URL encoded also, for example %23my_room%3Amatrix.org

+

<room-alias> - the room alias, eg. #my_room:matrix.org this possibly needs to be URL encoded also, for example %23my_room%3Amatrix.org

How can I find the lines corresponding to a given HTTP request in my homeserver log?

Synapse tags each log line according to the HTTP request it is processing. When it finishes processing each request, it logs a line containing the words Processed request: . For example:

2019-02-14 22:35:08,196 - synapse.access.http.8008 - 302 - INFO - GET-37 - ::1 - 8008 - {@richvdh:localhost} Processed request: 0.173sec/0.001sec (0.002sec, 0.000sec) (0.027sec/0.026sec/2) 687B 200 "GET /_matrix/client/r0/sync HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" [0 dbevts]"
@@ -242,6 +242,8 @@ GROUP BY s.canonical_alias, g.room_id
 ORDER BY num_rows desc 
 LIMIT 10;
 
+

You can also use the List Room API +and order_by state_events.

diff --git a/develop/usage/administration/database_maintenance_tools.html b/develop/usage/administration/database_maintenance_tools.html index f9e86c1bc6..807ce194bf 100644 --- a/develop/usage/administration/database_maintenance_tools.html +++ b/develop/usage/administration/database_maintenance_tools.html @@ -186,26 +186,14 @@

List of useful tools and scripts for maintenance Synapse database:

Purge Remote Media API

The purge remote media API allows server admins to purge old cached remote media.

-

Purge local media

-

There is no purge API for local media because you may be the only one with a copy. If you are sure you want to delete local media you could use something like the following to delete media that hasn't been accessed in a while.

-
find /path/to/synapse/media_store/local_content -atime +365 -delete
-find /path/to/synapse/media_store/local_thumbnails -atime +365 -delete
-
-

This will delete media that hasn't been accessed in 365 days.

-

Warning, check noatime flag: You also have to double-check that the filesystem where synapse's media store don't have noatime flag. Check it with mount, noatime is something that is usually enabled by default to reduce read-write operations in the filesystem for a feature is not so demanded.

+

Purge Local Media API

+

This API deletes the local media from the disk of your own server.

Purge History API

The purge history API allows server admins to purge historic events from their database, reclaiming disk space.

-

synapse_janitor.sql

- -

Cleans a synapse Postgres database of deleted messages and abandoned rooms.

synapse-compress-state

Tool for compressing (deduplicating) state_groups_state table.

-

SQL for analyzing Synapse PostgreSQL database stats

-

Some easy SQL that reports useful stat about Matrix Synapse database.

+

SQL for analyzing Synapse PostgreSQL database stats

+

Some easy SQL that reports useful stats about your Synapse database.

diff --git a/develop/usage/administration/understanding_synapse_through_grafana_graphs.html b/develop/usage/administration/understanding_synapse_through_grafana_graphs.html index 05c49a29a3..01dc735176 100644 --- a/develop/usage/administration/understanding_synapse_through_grafana_graphs.html +++ b/develop/usage/administration/understanding_synapse_through_grafana_graphs.html @@ -183,7 +183,13 @@

Understanding Synapse through Grafana graphs

-

It is possible monitor much of the internal state of Synapse using Prometheus metrics and Grafana. A guide for configuring Synapse to provide metrics is available here and information on setting up Grafana is here. In this setup, Prometheus will periodically scrape the information Synapse provides and store a record of it over time. Grafana is then used as an interface to query and present this information through a series of pretty graphs.

+

It is possible to monitor much of the internal state of Synapse using Prometheus +metrics and Grafana. +A guide for configuring Synapse to provide metrics is available here +and information on setting up Grafana is here. +In this setup, Prometheus will periodically scrape the information Synapse provides and +store a record of it over time. Grafana is then used as an interface to query and +present this information through a series of pretty graphs.

Once you have grafana set up, and assuming you're using our grafana dashboard template, look for the following graphs when debugging a slow/overloaded Synapse:

Message Event Send Time

image

@@ -214,13 +220,18 @@

we should probably consider raising the size of that cache by raising its cache factor (a multiplier value for the size of an individual cache). Information on doing so is available here (note that the configuration of individual cache factors through the configuration file is available in Synapse v1.14.0+, whereas doing so through environment variables has been supported for a very long time). Note that this will increase Synapse's overall memory usage.

Forward Extremities

image

-

Forward extremities are the leaf events at the end of a DAG in a room, aka events that have no children. The more exist in a room, the more state resolution that Synapse needs to perform (hint: it's an expensive operation). While Synapse has code to prevent too many of these existing at one time in a room, bugs can sometimes make them crop up again.

+

Forward extremities are the leaf events at the end of a DAG in a room, aka events that have no children. The more that exist in a room, the more state resolution that Synapse needs to perform (hint: it's an expensive operation). While Synapse has code to prevent too many of these existing at one time in a room, bugs can sometimes make them crop up again.

If a room has >10 forward extremities, it's worth checking which room is the culprit and potentially removing them using the SQL queries mentioned in #1760.

Garbage Collection

image

-

Large spikes in garbage collection times (bigger than shown here, I'm talking in the multiple seconds range), can cause lots of problems in Synapse performance. It's more an indicator of problems, and a symptom of other problems though, so check other graphs for what might be causing it.

+

Large spikes in garbage collection times (bigger than shown here, I'm talking in the +multiple seconds range), can cause lots of problems in Synapse performance. It's more an +indicator of problems, and a symptom of other problems though, so check other graphs for what might be causing it.

Final Thoughts

-

If you're still having performance problems with your Synapse instance and you've tried everything you can, it may just be a lack of system resources. Consider adding more CPU and RAM, and make use of worker mode to make use of multiple CPU cores / multiple machines for your homeserver.

+

If you're still having performance problems with your Synapse instance and you've +tried everything you can, it may just be a lack of system resources. Consider adding +more CPU and RAM, and make use of worker mode +to make use of multiple CPU cores / multiple machines for your homeserver.

-- cgit 1.5.1