-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch version: 6.3.2
Plugins installed: []
JVM version: 1.8.144
OS version: Linux 3.13.0-88-generic #135-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
When migrating from the transport client to the high level rest client, we saw our cluster throughput decrease by ~15%.
Profiling with JVisualVM, we determined the culprit to be calls to String.intern from Jackson InternCache:

These calls come from ScriptScoreFunctionBuilder::parse, as we have a fairly large parameter section (a few hundred parameters) in our custom scripts.
When using -XX:PrintStringTableStatistics to determine the average bucket size of the string table, we found it to be 4 with ~240K distinct strings. 4 strings on average is quite high, but I would not expect it to cause such a serious performance impact. It's just that interning is a bad idea.
Interning in Jackson was discussed here with benchmarks showing that disabling interning using JsonFactory.Feature.INTERN_FIELD_NAMES helps performance. Following that observation, in Jackson 3 interning is disabled by default.
I suggest disabling field name interning in JsonXContent's jsonFactory.
Steps to reproduce:
Provide logs (if relevant):