-
Type:
Suggestion
-
Resolution: Fixed
-
Component/s: None
ConfluenceCachingBandanaPersister retrieves entire contexts when asked for a single record.
When Confluence retrieves configuration or plugin information from Bandana, one of the many levels of BandanaPersister is uses is the ConfluenceCachingBandanaPersister.
When the ConfluenceCachingBandnana's retrieve(context, key) method is called it first calls retrieve(context).
That call can look up the entire bandana context from the database.
On C.A.C, the global context includes various records about plugin usage statistics. These can be 250k in size, and there are many of them.
Furthermore, this caching layer is not preventing multiple copies of the same record getting into memory. This is probably due to the special TransactionalCache that it uses, which isolates Cache updates between different threads. That requires that different Sessions have their own copies of the context whenever the context is updated. The context seems to be updated very frequently on confluence.atlassian.com, leading to many sessions in use containing about 20MB of data, most of which seems to be plugin data they shouldn't need to know.
Given that the ConfluenceBandanaRecord.hbm.xml file already specifies that the records should be cached, it seems possible that the ConfluenceCachingBandanaPersister and its cache could just be removed entirely.