1

I have purchased cloud server at digitalocean.com with 2GB RAM and DUAL CORE Processor. I want to set-up video proxy service i.e. to proxy youtube videos.

I have installed NGINX + PHP-FPM server and UFW firewall. But when more than 10 to 20 users stream, site slows down or becomes entirely unreachable.

Following are the configurations:

(NGINX CONFIGURATION)

user www-data;
worker_processes 2;
pid /var/run/nginx.pid;

events {
    worker_connections 19000;
    multi_accept on;
}

worker_rlimit_nofile 20000;
http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log off;
    error_log /var/log/nginx/error.log crit;

    ##
    # Gzip Settings
    gzip on;
    gzip_disable "msie6";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

( PHP-FPM CONFIGURATION )

pm = static
pmm.max_children=1000
pm.process_idle_timeout = 10s

I also tried dynamic and ondemand configurations but no improvement.

pm = dynamic
pm.max_children = 1000
pm.start_servers=2
pm.min_spare_servers = 2
pm.max_spare_servers = 6

Please help in configuring this server.

Sohaib Shaheen
  • 111
  • 1
  • 3
  • Are you sure it's not a bandwidth problem? Sounds like it... – Chris S Nov 22 '13 at 15:44
  • 2
    " I want to set-up video proxy service i.e. to proxy youtube videos." -- why would you pay to host something that already exists for free? – TheCleaner Nov 22 '13 at 15:44
  • Its not bandwidth issue. The CPU usage peaks and then servers slows down @ChrisS – Sohaib Shaheen Nov 22 '13 at 16:06
  • @TheCleaner Its different, in my country youtube is blocked, we have created a site where we only proxy youtube videos not site and add the rest of our own elements i.e. our own search and everything else. – Sohaib Shaheen Nov 22 '13 at 16:07

2 Answers2

0

Good news: The problem is not about server ram/cpu etc.

Bad news: Your NGINX server configuration is not setup for video streaming.

There is no trace of RTMP Video On Demand related lines in the config file. Basically you use NGINX as non streaming server this is why it looks like slow. Other wise it is super fast because it is kind of serving without VOD functionality.

Trevor
  • 101
0

How do you do the actual proxying?

The details you have provided don't appear sufficient to determine what the bottleneck is. You have not provided anything in regards to what, how and who does the proxying, which is what the root issue resolves around.

My hypothesis is that your proxying app saves the videos to disc, and you might as well be exhausting all of your disc IO allocation. The whole server being unresponsive is a good sign of disc IO exhaustion.

Although nginx is a great tool that I highly recommend, for your specific use-case, you might be better served by varnish. I'd suggest to write the whole proxying logic in varnish; varnish cache will make the most effective use of your 2GB of RAM.

cnst
  • 13,848
  • 9
  • 54
  • 76