Skip to main content

Fix CPU and RAM Overload in Xtream UI

Requirements:

Make sure pid_monitor is in crons.

  1. Clean up streams_sys using stream tools

  2. Optimize your server OS

    Set ulimit parameters on your ubuntu server. Check ulimit with this command:

    ulimit -u

    if it was 1024 then we need to increase it as follow

    nano /etc/security/limits.conf

    add the following lines to the end of your file:

    * hard nofile 500000
    * soft nofile 500000
    root hard nofile 500000
    root soft nofile 500000
    * soft nproc 500000
    * hard nproc 500000
    root soft nproc 500000
    root hard nproc 500000

    Then save and close the file.

  3. Restart Xtream UI.

    Fix Xtream UI Permissions
    sudo chown -R xtreamcodes:xtreamcodes "/home/xtreamcodes/iptv_xtream_codes/" ;
    sudo find "/home/xtreamcodes/iptv_xtream_codes/" -type d -print0 | xargs -0 chmod 755 ;
    sudo find "/home/xtreamcodes/iptv_xtream_codes/" -type f -print0 | xargs -0 chmod 740;
    sudo find "/home/xtreamcodes/iptv_xtream_codes/admin/" -type f -print0 | xargs -0 chmod 644;
    sudo find "/home/xtreamcodes/iptv_xtream_codes/wwwdir/" -type f -print0 | xargs -0 chmod 644;
    sudo chmod 700 "/home/xtreamcodes/iptv_xtream_codes/config";
  4. Optimize sysctl

    Edit sysctl.conf - sysctl preload/configuration file (these settings has been taken from an LB that had xtream-codes installed to it)

    nano /etc/sysctl.conf

    Add the following lines to the end of your file:

    net.core.somaxconn = 6815744
    net.ipv4.route.flush=1
    net.ipv4.tcp_no_metrics_save=1
    net.ipv4.tcp_moderate_rcvbuf = 1
    fs.file-max = 6815744
    fs.aio-max-nr = 6815744
    fs.nr_open = 6815744
    net.ipv4.ip_local_port_range = 1024 65000
    net.ipv4.tcp_sack = 1
    net.ipv4.tcp_timestamps = 0
    net.ipv4.tcp_rmem = 10000000 10000000 10000000
    net.ipv4.tcp_wmem = 10000000 10000000 10000000
    net.ipv4.tcp_mem = 10000000 10000000 10000000
    net.core.rmem_max = 524287
    net.core.wmem_max = 524287
    net.core.rmem_default = 524287
    net.core.wmem_default = 524287
    net.core.optmem_max = 524287
    net.core.netdev_max_backlog = 300000
    net.ipv4.tcp_max_syn_backlog = 300000
    net.netfilter.nf_conntrack_max=1215196608
    net.ipv4.tcp_window_scaling = 1
    vm.max_map_count = 655300
    net.ipv4.tcp_max_tw_buckets = 1440000

    Then save, close the file and run the following command:

    sudo sysctl -p
  5. Reboot your server and check

    after reboot, run these commands again to verify your changes:

    ulimit -u

    // should show 500000

    sudo sysctl -p

    // should show the above values