Jump to content

Question about image serving


Recommended Posts

horstepipe
Posted

hey @@pir8radio,

may I dig in here again?

I setup cloudflare some weeks ago, paid for the pro plan and was playing around with its settings.

I only use Emby for Kodi as clients.

Now I'm wondering why almost nothing is being cached here. I hoped that all the fanarts were being cached by cf, reducing my server load when a Kodi client syncs. But this doesn't seem to happen. Cf dashboard shows me 25 cached and 20000 uncached requests. As I'm absolutely new to CDNs maybe you or somebody else could clarify if this is expected behavior or if I have to do some additional setup.

I'm also concerned about your mention that caching can be a security risk as the admin session can be captured. So if you have time, I'd be thankful about some more words about it :-)

 

Best regards

pir8radio
Posted (edited)

hey @@pir8radio,

may I dig in here again?

I setup cloudflare some weeks ago, paid for the pro plan and was playing around with its settings.

I only use Emby for Kodi as clients.

Now I'm wondering why almost nothing is being cached here. I hoped that all the fanarts were being cached by cf, reducing my server load when a Kodi client syncs. But this doesn't seem to happen. Cf dashboard shows me 25 cached and 20000 uncached requests. As I'm absolutely new to CDNs maybe you or somebody else could clarify if this is expected behavior or if I have to do some additional setup.

I'm also concerned about your mention that caching can be a security risk as the admin session can be captured. So if you have time, I'd be thankful about some more words about it :-)

 

Best regards

 

 

Your video stream wont cache, it will be the majority of requests...      See this post: https://emby.media/community/index.php?/topic/45740-can-somebody-educate-me-on-reverse-proxies/?p=430055   it explains how to use chrome to see what is actually cached...  That post also tells how to cache the majority of emby images that cloudflare wont normally cache. Like your fanart.  You don't want to set cloudflare to "cache everything" you will have issues...  But you need a rule that caches all emby images.  That is the only place you should use cache everything..   Again check out the above post.  Let me know if you need a hand. 

Edited by pir8radio
horstepipe
Posted

Your video stream wont cache, it will be the majority of requests...      See this post: https://emby.media/community/index.php?/topic/45740-can-somebody-educate-me-on-reverse-proxies/?p=430055   it explains how to use chrome to see what is actually cached...  That post also tells how to cache the majority of emby images that cloudflare wont normally cache. Like your fanart.  You don't want to set cloudflare to "cache everything" you will have issues...  But you need a rule that caches all emby images.  That is the only place you should use cache everything..   Again check out the above post.  Let me know if you need a hand.

 

Thank you, I‘ll look into it later today. As I‘m only using strm files pointing to an external source, I didn’t expect my video stream to be cached.

pir8radio
Posted

Thank you, I‘ll look into it later today. As I‘m only using strm files pointing to an external source, I didn’t expect my video stream to be cached.

 

Ok you can add a rule to force cache all .strm files as well, and should cover about 90% or so of your requests.

  • Like 1
horstepipe
Posted

Ok you can add a rule to force cache all .strm files as well, and should cover about 90% or so of your requests.

Thanks

I‘m sill wondering how caching exactly works. As my server doesn’t know that cf is in front of it, how does cf manage when an image/strm changes (when the file name stays the same), so how/when is that info being updated?

 

Of my understanding, one user has to request an image first which is being delivered uncached, then Cloudflare caches the image for all users requesting the image next. Is that correct?

pir8radio
Posted

Thanks

I‘m sill wondering how caching exactly works. As my server doesn’t know that cf is in front of it, how does cf manage when an image/strm changes (when the file name stays the same), so how/when is that info being updated?

 

Of my understanding, one user has to request an image first which is being delivered uncached, then Cloudflare caches the image for all users requesting the image next. Is that correct?

 

It doesnt get updated. If something is cached on CF and you update an image, you have to purge the cached image from CF or it will keep serving that image.    

You can set how long the cached stuff stay in the edge servers, using the same rules...

 

Well...  Yes its supposed to cache after the first hit, but I found that CF only caches after like 3 hits in a row (with caching disabled on the local browser).  

So, CF caches things, so does your browser...  Not sure if kodi and other apps cache images locally...   

  • Like 1
horstepipe
Posted

Ok you can add a rule to force cache all .strm files as well, and should cover about 90% or so of your requests.

As I don't want to mess something up, could you please tell me the address for the strm-files I need to enter at the page rules section?

Thank you very much for your help

horstepipe
Posted
Well...  Yes its supposed to cache after the first hit, but I found that CF only caches after like 3 hits in a row (with caching disabled on the local browser).  

So, CF caches things, so does your browser...  Not sure if kodi and other apps cache images locally...   

There's an option in Emby for Kodi to save all artwork locally from Emby server. Do you think I can force creating a complete image cache by doing this three times in a row?

pir8radio
Posted

There's an option in Emby for Kodi to save all artwork locally from Emby server. Do you think I can force creating a complete image cache by doing this three times in a row?

I'm not sure if it will or not... I have not tried this.

 

As I don't want to mess something up, could you please tell me the address for the strm-files I need to enter at the page rules section?

Thank you very much for your help

I don't use strm files,  you should be able to browse your emby site with chrome and hit F12 then the network tab and then click a strm file to see its path, see if other strm files have the same or similar path then build a rule in CF.

  • Like 1
horstepipe
Posted

I'm not sure if it will or not... I have not tried this.

 

 

I don't use strm files,  you should be able to browse your emby site with chrome and hit F12 then the network tab and then click a strm file to see its path, see if other strm files have the same or similar path then build a rule in CF.

 

Thanks,

Will I need to look for the strm file itself or for the database entry (which is named of various numbers and letters)?

pir8radio
Posted (edited)

Thanks,

Will I need to look for the strm file itself or for the database entry (which is named of various numbers and letters)?

 

It will probably be random (hashed) for example here is an mp3 on my system:  notice this is an mp3 yet there is no .mp3 in sight.   But if I did a rule to cache all of my audio files i would probably do it for  https://emby.domain.net/emby/Audio/*

https://emby.domain.net/emby/Audio/0d7629f8f49be4d4f2de79f545452d85/universal?UserId=1dexxxxxxxxxxxxxxxxx4f50d545e0&DeviceId=09dd60fc886xxxxxxxxxxxxxxx81b539&MaxStreamingBitrate=125490196&Container=opus%2Cmp3%7Cmp3%2Caac%2Cm4a%7Caac%2Cflac%2Cwebma%2Cwebm%2Cwav&TranscodingContainer=ts&TranscodingProtocol=hls&AudioCodec=aac&api_key=35xxxxxxxxxxxxxxxxec&PlaySessionId=15107xxxxxxx90&StartTimeTicks=0&EnableRedirection=true&EnableRemoteMedia=false
Edited by pir8radio
horstepipe
Posted

It will probably be random (hashed) for example here is an mp3 on my system:  notice this is an mp3 yet there is no .mp3 in sight.   But if I did a rule to cache all of my audio files i would probably do it for  https://emby.domain.net/emby/Audio/*

 

https://emby.domain.net/emby/Audio/0d7629f8f49be4d4f2de79f545452d85/universal?UserId=1dexxxxxxxxxxxxxxxxx4f50d545e0&DeviceId=09dd60fc886xxxxxxxxxxxxxxx81b539&MaxStreamingBitrate=125490196&Container=opus%2Cmp3%7Cmp3%2Caac%2Cm4a%7Caac%2Cflac%2Cwebma%2Cwebm%2Cwav&TranscodingContainer=ts&TranscodingProtocol=hls&AudioCodec=aac&api_key=35xxxxxxxxxxxxxxxxec&PlaySessionId=15107xxxxxxx90&StartTimeTicks=0&EnableRedirection=true&EnableRemoteMedia=false
 

Okay so shouldn’t

https://emby.domain.net/emby/Video/*

simply do it then?

horstepipe
Posted (edited)

Btw:

As I‘m not using port 443, I hope I did it right to setup my page rules like this?

 

*emby.domain:8443/emby/Items/*/Images/

 

This url (including the rules you provided in the linked thread) should be first priority, right?

Edited by horstepipe
horstepipe
Posted

There's an option in Emby for Kodi to save all artwork locally from Emby server. Do you think I can force creating a complete image cache by doing this three times in a row?

mhh ok I did it 4 times now, unfortunately it doesn't seem to work. 60 cached requests, 13k uncached...

pir8radio
Posted

mhh ok I did it 4 times now, unfortunately it doesn't seem to work. 60 cached requests, 13k uncached...

 

are you using chrome and the CF header to view what is not being cached?  image wise. 

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...