Resolving user macro takes configuration cache read lock/unlock. For some performance critical locations user macros are already resolved during configuration cache synchronization. However with secret user macros this introduces another problem - secret macros can't be used in such locations.
This could be improved by allowing processes to obtain immutable macro data which could be used to resolve user macros without locking. The processing would be like:
- obtain macro data (configuration cache write lock/unlock)
- resolve macros
- release macro data (configuration cache write lock/unlock - could be avoided if atomic counters are used).
This should reduce configuration cache locking during batch processing.
During configuration cache synchronization syncer would make a new macro data set if the old one is being used by some other processes. To reduce memory overhead and improve synchronization speed the macro data would contain references to the macro containers/macros, which would be copied only when changed.
The old data sets would be freed by configuration syncer (use reference counting for macro data sets and free sets with 0 references after configuration sync).