Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-109

Feature Request: Expose some general/resource stats from Realm core.

      What:

      Expose global Resource usage summary from the realm core (which is currently a black box) at the point of the call. For example:

      1) How many files/fds are currently opened/held by realm core.
      2) How many active mmap() are there and the size of each call.
      2) How many realms are currently open. For each realm, how many different versions are currently open but not closed due to each thread/transaction holding on a different version?
      3) How many realm queries are active (not released)
      4) Any other stats info that may be relevant to the dev to understand resource usage of the non-java portion of the library.

      The above are some things just came to to the top of my head. It may or may not be possible but any info would be great. Think of this as a overview resource usage point-in-time for Realm core.

      Why:

      A) General stats. regardless how minimal, can really reveal an implementation bug by the end user. Realms not closing correctly, queries held and not released, too many different threads are opening realms.

      B) This would also help developer create better android tests when we know at a specific point, barring GC and finalizer lag, that there should be X realms open, X for other stats. It help devs create better tests for code using realm library by comparing current values to expected internal states.

      C) It is sometimes extremely difficult to debug bugs caused by resource usage caused by a .so library: too much ram used, too many fds, etc, if the library does not expose some stats info. Android and especially version <= 4.X can behave wildly under extremely resource exhaustion and crash at points that has no relevancy due to the core cause. If we can log the crashes with the the realm core internal stats, it would help give devs get a closer version of the 100% view of the issue at hand and not just where it crashed, which sometimes is really useless.

      Some the above is possible by extending Realm or wrapping realm opens/closes transaction/open/close/do our own ref/stat counting but that's a lot of abstraction when the core has already all the info plus other info we can't possibly get currently.

      Sorry for the verbosity but hopefully the above gives a general idea of what I propose and reasoning behind it.

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: