Tune up RAM for Xtream UI

If you install Xtream UI Panel from their site, they put 90% of RAM to be used for the streams folder. This will need to be tuned up. If you install Xtream UI from our site, the RAM is setup at 50%. You can also tune up this value too.

From SSH client Putty, type in:

nano /etc/fstab

You will see the line

tmpfs /home/xtreamcodes/iptv_xtream_codes/streams tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=90% 0 0

This means it will use 90% of your RAM for the streams folder. This is too big value because RAM is needed for mysql, nginx, php-fpm and OS to run also. We will need to adjust this number to a reasonable value.

Main Server

Main server has no stream. Sometimes we can test some streams so we will need the size of streams folder to be very small. Why do you need to allocate 90% of RAM to streams folder when you don’t even stream anything? You can put in maybe 2G if you want. with 2G you can test a few streams with no issue. So the code will be like this for main server.

 

tmpfs /home/xtreamcodes/iptv_xtream_codes/streams tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=2G 0 0

LB Servers

LB servers are mostly for streams so we will need lots of RAM for it. But how much RAM is needed. It is based on your ONLINE streams and its bitrate. This is not based on your total clients connected to that server

Here is the math.

Total RAM needed = (stream bitrate(kbps)/8)*10(seconds)*10chunks

So if your stream bitrate is 7000kbps, you have to convert it to KB/s which is 7000/8=875KB/s. Now times that number to 10 seconds which is the length of the chunk, you will get 8750KB, which is around 8.7MB/chunk. Plus it stores 10 chunks per stream so it will be 87MB of RAM per stream.

Now if you want to have 100 ONLINE streams at this 7000kbps bitrate, you will need 100x87MB = 8700MB of RAM only. This is 8.7G of RAM.

If you need 1000 ONLINE streams at 7000Kbps, you need 87GB of RAM.

My current server has 256GB of RAM and by default, it allocates 90% of that (230GB) to the streams folder. However in in real usage, I only streams 800 ONLINE streams, with mixed bitrates. When view the streams folder, It only uses 64 GB of RAM.  So now I just need to allocate around 80-100GB of RAM to this folder. The rest of RAM can be used by other programs.

tmpfs /home/xtreamcodes/iptv_xtream_codes/streams tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=100G 0 0

 

Why is this useful?
This is very useful when you want to run other programs on the same server. You can run other nginx instance, setup 24/7 with it or tune up NGINX and PHP-FPM to use the rest of RAM. This is why when you have peak traffic you usually see RAM is maxed out. This is because only 10% RAM is left for CPU, OS, PHP-FPM, FFMPEG, NGINX. That is a really bad setup. I do not know why he setup like that. Not many people can realize this issue including me, until now.

After you make the changes, you need to make it go into effect. Type in this 2 commands

umount /home/xtreamcodes/iptv_xtream_codes/streams

mount -a

To verify if it works, type in

df -h

It will show you the size of the /streams folder

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top