ilovetolearn
ilovetolearn

Reputation: 2060

Thread contention on java.io.PrintStream

I am using Java Mission Control to profile my application for performance issues. JMC has highlighted java.io.PrintStream under Thread Contention and Lock Instances sections.

Why am I facing thread contention issues for JDK package?

enter image description here enter image description here

Upvotes: 6

Views: 364

Answers (1)

Andrew Lygin
Andrew Lygin

Reputation: 6197

It looks like your application is producing a lot of output to stdout or stderr from several threads concurrently (System.out and System.err are PrintStreams). Writes and flushes on a PrintStream cannot be processed in parallel, they are all synchronized, so you're facing contention.

Upvotes: 7

Related Questions