HTableDescriptor#addCoprocessor will set the coprocessor value as following format:
If the 'jarFilePath' is null, the 'value' will always has the format '|className|priority|' even if 'kvs' is null, which means no extra arguments for the coprocessor. Then, in the server side, RegionCoprocessorHost#getTableCoprocessorAttrsFromSchema will load the table coprocessors as:
The 'cfgSpec' will be '|' for the coprocessor formatted as '|className|priority|', so that always create a new Configuration.
In our production, there are a lot of tables having table-level coprocessors, so that the region server will create new Configurations for each region of the table, this will consume a certain number of memory when we have many such regions.
To fix the problem, we can make the HTableDescriptor not append the '|' if no extra arguments for the coprocessor, or check the 'cfgSpec' more strictly in server side which could avoid creating new Configurations for existed such regions after the regions reopened. Discussions and suggestions are welcomed.