We've encountered a problem with the generate_statistics configuration in production.
The ConcurrentStatisticsImpl uses a ConcurrentHashMap that saves the statistics for all the HQL queries that are executed. However from our application we generate a lot of unique query HQL queries because we use the JPA query builder, and something like this:
creates a new query string for each new input.
This is problematic because the map only grows, and after a couple of days our application consumes too much memory.
It seems possible to clear the stats periodically, however:
the default behavior 'leaks' memory
it's not documented
So perhaps it'd be better to have a default max_size option or something to limit the size of the queryStatistics.