SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v9 Customizations > Gemstone for v9
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

Gemstone for v9 This forum is for discussing the user-created Gemstone custom interface for SageTV.

Reply
 
Thread Tools Search this Thread Display Modes
  #21  
Old 01-17-2017, 03:25 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
I'm just thinking java heap space, especially in the world of 64-bit JVM's, is much more plentiful than the image cache on the miniclient.

That said, I did go through and set the percent scaling in gemstone to approximately close to the final render size (guessed based on Dual view for banners, and Cover view for posters) and precached the fanart, just to get an idea of the size we're dealing with, and my 719 items in the GemstoneImages cache folder is only 17.5MB. It is highly likely a JVM side cache of appropriately sized images (with sufficiently low jpeg quality) would not make a huge dent in the JVM.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #22  
Old 01-18-2017, 05:02 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fuzzy View Post
I'm just thinking java heap space, especially in the world of 64-bit JVM's, is much more plentiful than the image cache on the miniclient.

That said, I did go through and set the percent scaling in gemstone to approximately close to the final render size (guessed based on Dual view for banners, and Cover view for posters) and precached the fanart, just to get an idea of the size we're dealing with, and my 719 items in the GemstoneImages cache folder is only 17.5MB. It is highly likely a JVM side cache of appropriately sized images (with sufficiently low jpeg quality) would not make a huge dent in the JVM.
The file system cache is not a good representation of how much much memory is used. For example, a single 2000x3000 jpg might only be 200K in size... but 22mb of memory is required to cache it in memory. That same image, if scaled to be max height of 1080 (assuming 1920x1080 display) consumes 3mb memory. (this sizes of how much memory is requires is HxWx(4 bytes per pixel) )

The SageTV server, out of box, will hold ~32mb of image cache, The miniclient uses 64mb, but I have my client to set to use 192mb and server the same.

The sagetv server has a property, ui/system_memory_2dimage_cache_scale (defaults to 2), that sets the cache size as a multiple of ~16m.

We might not agree on the caching and sizing specifics, but hopefully, you can see how IF you get a couple 20mb images showing up, it can have a disastrous effect on the UI performance, because it will, in effect, just dump everything in the cache to make room for it, and in my testing this can sometimes takes 6-7 seconds, but even a 500ms pause when you navigating up down in a list, it can be pretty apparent.

These numbers mean nothing in a stock sagetv setup, because 32mb is far more than what sagetv needs. It really only has an effect when you are showing backgrounds, posters, etc, since these image files consume so much more memory.
Reply With Quote
  #23  
Old 01-18-2017, 07:13 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Didn't realize that sage stores image data in an uncompressed raster format in it's serer side image cache. So that means it is sending the data uncompressed over the miniclient connection to be rendered as well? that seems wrong to me, when I would be certain the miniclient would have the capability to render from compressed image data.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #24  
Old 01-18-2017, 08:09 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fuzzy View Post
Didn't realize that sage stores image data in an uncompressed raster format in it's serer side image cache. So that means it is sending the data uncompressed over the miniclient connection to be rendered as well? that seems wrong to me, when I would be certain the miniclient would have the capability to render from compressed image data.
Keep in mind it doesn't matter how the image is stored in memory... the cache uses the H*W*4 to calculate whether or not the image can be added to the cache. This may be different than the "real" amount of memory required, and likely you cannot tell what the "real" value is (because there may be some additional overhead, etc), so logically, it uses a conservative calculation.

For every image that is loaded, it will check the size, determine if it can be added to the cache. If not, it will remove a "stale" item from the change, and re-check... this process continues until the image can be added to the cache. Keep in mind, in sagetv, every pieice of text of an "image" as well. So, it starts unloading images, it likely could be unloading text, and then later when you need to re-render that text, it has to go and fetch all those images again.

Images are sent across the wire as "compressed" images, but, images have to be uncompressed in order to work with them. The compression format is really only valid for storing the image... once you start doing things like compositing images, etc, they need to uncompressed.
Reply With Quote
  #25  
Old 01-18-2017, 10:40 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Quote:
Originally Posted by stuckless View Post
Keep in mind it doesn't matter how the image is stored in memory... the cache uses the H*W*4 to calculate whether or not the image can be added to the cache. This may be different than the "real" amount of memory required, and likely you cannot tell what the "real" value is (because there may be some additional overhead, etc), so logically, it uses a conservative calculation.

For every image that is loaded, it will check the size, determine if it can be added to the cache. If not, it will remove a "stale" item from the change, and re-check... this process continues until the image can be added to the cache. Keep in mind, in sagetv, every pieice of text of an "image" as well. So, it starts unloading images, it likely could be unloading text, and then later when you need to re-render that text, it has to go and fetch all those images again.

Images are sent across the wire as "compressed" images, but, images have to be uncompressed in order to work with them. The compression format is really only valid for storing the image... once you start doing things like compositing images, etc, they need to uncompressed.
That's horrible. This isn't just being conservative but wholly inaccurate. It sounds like this piece of code could use some tweaking. It shouldn't be that difficult to get the actual size of the data rather than calculating the estimated raw size of an uncompressed image.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
  #26  
Old 01-18-2017, 11:42 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Taddeusz View Post
That's horrible. This isn't just being conservative but wholly inaccurate. It sounds like this piece of code could use some tweaking. It shouldn't be that difficult to get the actual size of the data rather than calculating the estimated raw size of an uncompressed image.
There might be some misinformation there... it's not inaccurate.. The H*W*4 is how many bytes it takes to uncompress the image (which it has to do)... What I'm saying is that the JVM implementation "may" do some other work so the real size (in memory) might be slightly smaller (or even slightly larger). I say it's "conservative" because not all images will have an alpha channel, and if not, then likely it could be *3 instead of *4, and as such the physical cache size might be smaller than the physical resident memory size... but that's not a bad thing.. it would be worse if cache size exceeded the physical memory size (since you'd get an OOM).

The purpose of the cache is really to set boundaries as to how many images are loaded. The H*W*4 is a very reasonable way to do this... since bigger images will take up more cache and smaller ones will take up less. Performance increases as you can keep more and more static images in memory. (which is why I increased my memory cache on the miniclient to 192mb)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to install Gemstone panteragstk Gemstone for v7 2 09-01-2016 04:32 PM
Gemstone install error CUTIGER91 Gemstone for v7 5 12-29-2015 09:44 AM
I just restored my sageTV install (Oct, 2011).. cleanest upgrade path to Gemstone? mkanet Gemstone for v7 2 09-28-2012 08:36 PM
Laggy Setup artyzipp SageTV Software 2 05-27-2009 07:44 PM
laggy UI since 5.04 upgrade davey_fl SageTV Software 1 08-31-2006 01:32 PM


All times are GMT -6. The time now is 01:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.