Jump to content

Emby creates many threads and running slow


angusleung
Go to solution Solved by pir8radio,

Recommended Posts

angusleung

I have been using emby with Cloudflare more than a year and everything running good until few weeks ago the server start running slow. It happen when I reload the webpage few time. The time took to reload the page is about 1 min to 2 min

 

I noticed that there are about hundred threads were created when I reload the page when I access it with my domain name.

And emby will start running slow when threads more than 200-300.

It won't happen when I access locally and the number of threads are around 30 to 40.

 

I have tried to disable all caching related features on Cloudflare (Paging rule, rocket loader, Auto Minify, etc.) to see if its help , but no luck.

 

I tried everything I could do this few weeks and finally I think I could look for help on the forum.

Does anyone faced similar situation and would give me some advice?

 

I have attached the server log and some screenshot.

 

I am running Version 3.2.25.0 on ubuntu 16.04

post-190336-0-68755100-1500310467_thumb.png

server.txt

post-190336-0-42954300-1500310494_thumb.png

Link to comment
Share on other sites

Hi there, to improve the performance of emby server, try removing all plugins.

 

To improve even more, try a fresh install only this time do not ever install any plugins. Thanks !

Link to comment
Share on other sites

What exactly is loading slow? I don't see anything too bad in this log. Thanks.

Link to comment
Share on other sites

mastrmind11

I have a similar htop.  When you search for a process it doesn't filter other threads.  My guess is that you have less than 100 threads for Emby.... you have to count them.  eg, my htop w/ emby filtered shows 1176 threads, 84 of which are Emby.  In other words, get better hardware and/or Emby is not the problem.

Link to comment
Share on other sites

angusleung

Thanks for the advice of Luke and mastermind11.

 

I would recently replace it with new hardware just wait and see if AMD Ryzen APU is a deal.

 

I do not see any abnormal from the log too....

 

I know it might not related with the performance of emby-server, because when I am out of home an access it via Android app and it has perfect speed and response time. The issue only exist when I access via webclient. So I think it should related with the misconfigure of Cloudflare setting.

 

 

I recently kill the emby when the thread more than 300 via the following script and start if the pid of emby is not exsit. I placed them in crontab @@reboot to standby

#!/bin/bash
while :;
do


tcount=0


tcount=$(ps -ef | grep -v awk | grep -v root | awk '/emby-server/{print $2 }' | while read line ; do ps -T -p $line | wc -l; done)


if [ $tcount -gt 300 ]; then


        #service emby-server stop >> /home/ubuntu/cron/log.txt
        ps -ef | grep -v awk | grep -v root | awk '/emby-server/{print $2 }' | while read line;do kill -9 $line; done
        echo $tcount >> /home/ubuntu/cron/log.txt
fi


sleep 10


done
#!/bin/bash
while :;
do
        if [ ! -f /var/run/emby-server.pid ]
        then
                sudo /etc/init.d/emby-server start >> log.txt
                echo `date` "EMBY STARTED" >> log.txt
        fi
        sleep 10
done

The hardware of my setting is as following.

i5 3570
16GB ram(non-ECC)
8X4TB 

120G SSD

ZFS Raid Z1 (8GB Zil + 100GB L2ARC)

Running on Proxmox 5.0 LXC (ubuntu 16.04 LTS)

 

Sorry for my English, as it is not my native language.

Edited by angusleung
Link to comment
Share on other sites

angusleung

Ok, turns out the speed issue is about the setting of Cloudflare.

I try to access my server via external IP and domain name, the speed is significantly difference.

I tried several difference setting, turn on minifiy and rocket. The speed seems slightly improved.

 

Once again, thanks for the support.

Link to comment
Share on other sites

  • Solution
pir8radio

Ok, turns out the speed issue is about the setting of Cloudflare.

I try to access my server via external IP and domain name, the speed is significantly difference.

I tried several difference setting, turn on minifiy and rocket. The speed seems slightly improved.

 

Once again, thanks for the support.

 

You will find some of cloudflares speed settings should not be enabled.  Rocketloader causes some issues, so does minifiing.

 

Make sure your cache level is set to STANDARD (important), and create this rule:

without this rule emby images don't get cached because they are .webp images with no extension.

5970a3296e6c4_Capture.png

 

 

 

Use chrome, right click the page go to inspect, select "NETWORK" tab, check the disable cache box.   Add a column/header "cf-cache-status"  this will show you what was actually cached on cloudflare..  see below image, the majority of your content should say "HIT" after you reload the page a few times...  

There on out HIT should be listed for most everything.   

5970a3c2a87e4_cache.png

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...