diff --git a/.env.dev b/.env.dev
index 40774610bb72e98787d8ee831551c4a64148fda6..75ae332dcddf21b066ad48e321d35129813cef72 100644
--- a/.env.dev
+++ b/.env.dev
@@ -13,6 +13,7 @@ BROWSABLE_API_ENABLED=True
 FORWARDED_PROTO=http
 LDAP_ENABLED=False
 FUNKWHALE_SPA_HTML_ROOT=http://nginx/front/
+PYTHONTRACEMALLOC=1
 
 # Uncomment this if you're using traefik/https
 # FORCE_HTTPS_URLS=True
diff --git a/api/config/settings/local.py b/api/config/settings/local.py
index b51ec273edac11ab8c1d63285016251de44429f2..2fc121612d47dd5a4da1abd747c65f0f8c175a8f 100644
--- a/api/config/settings/local.py
+++ b/api/config/settings/local.py
@@ -104,4 +104,5 @@ if env.bool("WEAK_PASSWORDS", default=False):
 MIDDLEWARE = (
     "funkwhale_api.common.middleware.DevHttpsMiddleware",
     "funkwhale_api.common.middleware.ProfilerMiddleware",
+    "funkwhale_api.common.middleware.PymallocMiddleware",
 ) + MIDDLEWARE
diff --git a/api/funkwhale_api/common/middleware.py b/api/funkwhale_api/common/middleware.py
index 4752159106ca2de510f4c8b1ba0fcae32615a4ff..f7d2acda4ca95cfd601da81df17a66d592cf60dd 100644
--- a/api/funkwhale_api/common/middleware.py
+++ b/api/funkwhale_api/common/middleware.py
@@ -14,6 +14,7 @@ from django.middleware import csrf
 from django.contrib import auth
 from django import urls
 from rest_framework import views
+import tracemalloc
 
 from funkwhale_api.federation import utils as federation_utils
 
@@ -405,3 +406,20 @@ class ProfilerMiddleware:
         response = http.HttpResponse("<pre>%s</pre>" % stream.getvalue())
 
         return response
+
+
+class PymallocMiddleware:
+    def __init__(self, get_response):
+        self.get_response = get_response
+
+    def __call__(self, request):
+
+        if tracemalloc.is_tracing():
+            snapshot = tracemalloc.take_snapshot()
+            stats = snapshot.statistics("lineno")
+
+            print("Memory trace")
+            for stat in stats[:25]:
+                print(stat)
+
+        return self.get_response(request)
diff --git a/docs/developers/debugging.rst b/docs/developers/debugging.rst
new file mode 100644
index 0000000000000000000000000000000000000000..d2f0147a8b40321abfefd4c459f25d634264ecc6
--- /dev/null
+++ b/docs/developers/debugging.rst
@@ -0,0 +1,50 @@
+Debugging Funkwhale
+===================
+
+In order to track down errors its useful to provide as many information as possible. Usually pasting
+the logs should be sufficient, but there are some tools for some deeper debugging.
+
+Frontend Logs
+-------------
+
+Logs and errors written by the Frontend can be accessed with Firefox. When opening the website of
+your Funkwhale instance, simply hit ``Ctlr + Shift + J``. Alternatively open the Firefox Menu and open
+the Browser Console in the developers menu.
+
+In the opening window you can see all the output. You can copy what you want to share or repeat the
+failing operation to see what error occurs.
+
+Backend Logs
+------------
+
+Depending on your setup you can see the logs from our API server in different ways.
+
+Docker
+^^^^^^
+
+Simply run ``docker-compose logs --tail=100 api`` If you want continuous logs, add the ``f`` flag.
+
+Quick install
+^^^^^^^^^^^^^
+
+To get the logs, run ``journalctl -xn -u funkwhale-server``
+
+Profiling
+---------
+
+In order to find performance issues, its possible to run API requests with activated profiling. In
+order to do this,  add ``funkwhale_api.common.middleware.ProfilerMiddleware`` to the environment
+variable ``ADDITIONAL_MIDDLEWARES_BEFORE``
+
+If enabled, simply add ``?prof`` to the request URL you want to profile. You should get an HTML-Report
+of the running request.
+
+Memory Tracing
+--------------
+
+Its possible to print memory traces for each API request to the API logs. In order to do this, add
+``funkwhale_api.common.middleware.PymallocMiddleware`` to the environment variable
+``ADDITIONAL_MODDLEWARES_BEFORE`` This adds a middleware which should not do anything by default.
+Tracing can be activated by setting ``PYTHONTRACEMALLOC=1`` This might has some inpact on the
+performance, please report how it goes. The Middleware now prints the top 25 memory allocations to
+the API logs.