Skip to content

DM-10370: Optimize server memory usage for fits images #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 4, 2017

Conversation

robyww
Copy link
Contributor

@robyww robyww commented May 3, 2017

DM-10370: Optimize server memory usage for fits images

  • Server memory size cut in half
  • Optimized drawing so that user sees working message
  • Optimized scrolling so the it does not block when loading images
  • beta value (used for asinh strech) now only computed when required
  • added a getBetaValue service call
  • Uploading fits files now show masking while uploading
  • removed addColorBand call from server (not used)
  • Added way to push out memory in cache before large data is read in
  • Fixed bug in computing in CsysConvert.pointInPlot with rectangular images

This is a very difficult test it requires jconsole to monitor the memory with large fits images. It could take awhile just to get set up. Mostly the review should just look over the code.

Target code to look at:

  • FitsCacher.java - @lznakano this is the key file to check closely
  • VisServerOps.java
  • FitsRead.java
  • ImageDataGroup.java

@loitly would you look at:

  • EhcacheProvider.java
  • ObjectSizeEngineWrapper.java

 - Server memory size cut in half
 - Optimized drawing so that user sees working message
 - Optimized scrolling so the it does not block when loading images
 - beta value (used for asinh strech) now only computed when required
 - added a getBetaValue service call
 - Uploading fits files now show masking while uploading
 - removed addColorBand call from server (not used)
 - Added way to push out memory in cache before large data is read in
 - Fixed bug in computing in CsysConvert.pointInPlot with rectangular images
@robyww robyww force-pushed the dm-10370-mem-half branch from 23cfd6e to c31e780 Compare May 3, 2017 17:30
@robyww robyww requested review from loitly, lznakano and cwang2016 May 3, 2017 17:31
@robyww robyww self-assigned this May 3, 2017
@robyww robyww removed the request for review from cwang2016 May 3, 2017 17:37
@@ -59,9 +64,13 @@
else {
Fits fits= null;
try {
if (memCache != null) {
memCache.put(key, new ObjectSizeEngineWrapper.BluffSize(fitsFile.length()));
memCache.put(key, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite understand what it is doing here? Why the same key was put twice with different value?

Copy link
Contributor Author

@robyww robyww May 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how I am clear space in the cache before I actually read the file. If there is a 5G file in the cache by doing this I can potentially push out the 5G from the cache before the 5G file is read. Since the act of reading would takes 10G we would go as high as 15G. With this change it will only go as high as 10G the down to 5G.

To summarize- replace a 5G file in cache:
before:
5G => 15G => 5G
after
5G => 10G => 5G

The ObjectSizeEngineWrapper.BluffSize object appears to the cache to be big but it is not.

Copy link
Contributor

@loitly loitly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files I looked at looks fine. A very clean and transparent solution.

sharedManager = CacheManager.create(sharedConfig.getAbsolutePath());
try {
System.setProperty("net.sf.ehcache.sizeofengine.shared.VIS_SHARED_MEM",
"edu.caltech.ipac.firefly.server.cache.ObjectSizeEngineWrapper");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using ObjectSizeEngineWrapper.class.getName() here would be even cleaner. It will fail on setProperty so clearing it is not necessary. It'll also help find/refactor class when needed.

Copy link
Contributor

@lznakano lznakano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look very good to me.

@robyww robyww merged commit 3f1de4a into dev May 4, 2017
@robyww robyww deleted the dm-10370-mem-half branch May 4, 2017 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants