Metrics optimization


I’ve a type hierarchy Organization -> Facilty -> Device. And one Organization instance (id=‘Global_Org’) that is the root of all other Organization instances.
I’ve a couple of metrics (compound and simple) that run at Organization level. When any of these metrics is run against id ‘Global_Org’, it just never returns (way too slow)!

Q: Are there any recommendations for optimizing very slow Metrics? (other than caching, e.g. rewriting expressions in a certain way)



@bachr - The metric times will be a function of the amount of data you are trying to retrieve. There is no secret sauce to it. It would be hard to just say that write your expression in one way or the other if you are basically getting the data for the entire organization list.

What you could do is write a map reduce job to read data for individual orgs and then reduce them to a global org

1 Like


Thanks @rohit.sureka the map-reduce job seems a viable option. I will have two Map-Reduce jobs:

  1. at Facility level that only has a map() function
  2. at Organization level, with map() and reduce() functions, to aggregate result from facilities