How many rows in jvm string pool intern

I profile the application, and using intern to type strings really helps. What I want to find is a good number for the pool of objects, so I won’t have a performance penalty. How can I find out how many rows were inserted into the pool?

I am running some production tracing, I cannot count on input.

Does the JVM offer api for this?

+5
source share
1 answer

Starting with JDK7, you can use the -XX:+PrintStringTableStatistics JVM flag to print string table size information, such as the number of buckets and bucket size.

You can also use the jmap tool by calling the jmap -heap *process_id* command, which at the end will display the number of interned lines and the total size (also requires JDK7 +).

Check out this blog post for more details.

+6
source

Source: https://habr.com/ru/post/1210172/


All Articles