kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
				
				
				
			Added documentation page on how to reduce memory usage.
							rodzic
							
								
									770f9fbda4
								
							
						
					
					
						commit
						29645aab1d
					
				| 
						 | 
					@ -1,3 +1,3 @@
 | 
				
			||||||
#!/bin/bash -eux
 | 
					#!/bin/bash -eux
 | 
				
			||||||
python /app/manage.py collectstatic --noinput
 | 
					python /app/manage.py collectstatic --noinput
 | 
				
			||||||
/usr/local/bin/daphne -b 0.0.0.0 -p 5000 config.asgi:application
 | 
					/usr/local/bin/daphne -b 0.0.0.0 -p 5000 config.asgi:application --proxy-headers
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					Added documentation for optimizing Funkwhale and reduce its memory
 | 
				
			||||||
 | 
					footprint.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Changelog
 | 
				
			||||||
 | 
					^^^^^^^^^
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For non-docker deployments, add ``--proxy-headers`` at the end of the ``daphne``
 | 
				
			||||||
 | 
					command in :file:`/etc/systemd/system/funkwhale-server.service`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This will ensure the application receive the correct IP address from the client
 | 
				
			||||||
 | 
					and not the proxy's one.
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ User=funkwhale
 | 
				
			||||||
# adapt this depending on the path of your funkwhale installation
 | 
					# adapt this depending on the path of your funkwhale installation
 | 
				
			||||||
WorkingDirectory=/srv/funkwhale/api
 | 
					WorkingDirectory=/srv/funkwhale/api
 | 
				
			||||||
EnvironmentFile=/srv/funkwhale/config/.env
 | 
					EnvironmentFile=/srv/funkwhale/config/.env
 | 
				
			||||||
ExecStart=/srv/funkwhale/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application
 | 
					ExecStart=/srv/funkwhale/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Install]
 | 
					[Install]
 | 
				
			||||||
WantedBy=multi-user.target
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,10 +28,16 @@ On a dockerized instance with 2 CPUs and a few active users, the memory footprin
 | 
				
			||||||
   funkwhale_postgres_1        22.73 MiB
 | 
					   funkwhale_postgres_1        22.73 MiB
 | 
				
			||||||
   funkwhale_redis_1           1.496 MiB
 | 
					   funkwhale_redis_1           1.496 MiB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Some users have reported running Funkwhale on Raspberry Pis with a memory
 | 
				
			||||||
 | 
					consuption of less than 200MiB.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Thus, Funkwhale should run fine on commodity hardware, small hosting boxes and
 | 
					Thus, Funkwhale should run fine on commodity hardware, small hosting boxes and
 | 
				
			||||||
Raspberry Pi. We lack real-world exemples of such deployments, so don't hesitate
 | 
					Raspberry Pi. We lack real-world exemples of such deployments, so don't hesitate
 | 
				
			||||||
do give us your feedback (either positive or negative).
 | 
					do give us your feedback (either positive or negative).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Check out :doc:`optimization` for advices on how to tune your instance on small
 | 
				
			||||||
 | 
					configurations.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Software requirements
 | 
					Software requirements
 | 
				
			||||||
---------------------
 | 
					---------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,37 @@
 | 
				
			||||||
 | 
					Optimizing your Funkwhale instance
 | 
				
			||||||
 | 
					==================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Depending on your requirements, you may want to reduce as much as possible
 | 
				
			||||||
 | 
					Funkwhale's footprint.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Reduce workers concurrency
 | 
				
			||||||
 | 
					--------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Asynchronous tasks are handled by a celery worker, which will by default
 | 
				
			||||||
 | 
					spawn a worker process per CPU available. This can lead to a higher
 | 
				
			||||||
 | 
					memory usage.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can control this behaviour using the ``--concurrency`` flag.
 | 
				
			||||||
 | 
					For instance, setting ``--concurrency=1`` will spawn only one worker.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This flag should be appended after the ``celery -A funkwhale_api.taskapp worker``
 | 
				
			||||||
 | 
					command in your :file:`docker-compose.yml` file if your using Docker, or in your
 | 
				
			||||||
 | 
					:file:`/etc/systemd/system/funkwhale-worker.service` otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. note::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Reducing concurrency comes at a cost: asynchronous tasks will be processed
 | 
				
			||||||
 | 
					    more slowly. However, on small instances, this should not be an issue.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Switch from prefork to solo pool
 | 
				
			||||||
 | 
					--------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Using a different pool implementation for Celery tasks may also help.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Using the ``solo`` pool type should reduce your memory consumption.
 | 
				
			||||||
 | 
					You can control this behaviour using the ``--pool=solo`` flag.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This flag should be appended after the ``celery -A funkwhale_api.taskapp worker``
 | 
				
			||||||
 | 
					command in your :file:`docker-compose.yml` file if your using Docker, or in your
 | 
				
			||||||
 | 
					:file:`/etc/systemd/system/funkwhale-worker.service` otherwise.
 | 
				
			||||||
		Ładowanie…
	
		Reference in New Issue