Reading cn=monitor can be slow at times, especially if individual monitor entries are experiencing problems (see OpenDJ-96). The problems occur regardless of the search performed.
The reason is that search operation processing on cn=monitor is extremely dumb: regardless of the search performed, all monitor entries are computed. We should only calculate monitors on demand. In addition, it would be nice if monitor providers could provide additional hints in order to help filtering while processing searches. For example, as well as returning the monitor instance name, we could have a method(s) which return:
a) the set of object classes contained in the entry (helps objectClass=xxxx) filtering
b) a list of attribute types contained in the entry (note that this would not be needed if (a) was implemented and monitors adhered to a schema).
It would be really nice to clean up the cn=monitor DIT structure as well while we're at it, but this is probably best left to 2.5 and handled in a separate issue (TBD).