ampache / ampache

A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.
http://ampache.org
GNU Affero General Public License v3.0
3.55k stars 591 forks source link

Ampache on Nginx freezes the whole web server while streaming. Any fix? #1417

Closed rkkoszewski closed 3 years ago

rkkoszewski commented 8 years ago

Environment

Settings

Default

Description

I have a Nginx Server running Ampache. It seems that the non-threaded nature of Nginx seems to not work too well with Ampache streaming feature. While the client is receiving the music data, no other page is able to be served until the music data is completely received. This is even more pronounced if the client has slow internet connection or the music file is big.

Is this a normal behaviour? Is there any way to keep streaming the music data while still be able to serve pages?

Any help is highly apretiated. Thanks.

Phyks commented 8 years ago

Could you try using the latest develop branch?

@Niols should have the exact same setup and its working very nice.

rkkoszewski commented 8 years ago

Hi,

I tried the same using the latest develop branch but have still the same issue.

I believe to know why this is happening but it seems like there will be no fix for this.

Nginx is a blocking server by design, which means that it queues all requests and processes each request one by one. In the latest version of Nginx, it supports to have a pool of paralel threads, which seems to be enabled by default if the kernel supports it. In my case the kernel doesn't supports it as it's laking some kernel extension to do that. Replacing my Nginx server with an Apache server fixed the issue. My server is now marginally slower but it supports paralel request without problems, and streaming while browsing is working without any problems now.

I guess this is a Nginx related issue then. Maybe a warning in Ampache would be interesting, so the user knows that Ampache is not a good solution for non-threaded servers. Should I close this topic?

Phyks commented 8 years ago

In this case, we think with @Niols that your limitation may come from FPM. If you set the number of FPM workers too low, streaming might hang a worker and if you do not have enough spare ones, it might freeze FPM totally. Increasing the number of FPM workers should fix it.

SNatis commented 7 years ago

Hi! Checks in the configuration file "nginx.conf" the number that is next to "worker_processes". This is the number of nginx processes that are started and can respond to queries.

mitchray commented 3 years ago

Closing due to time since last discussion