Skip to content

Instantly share code, notes, and snippets.

View plokhotnyuk's full-sized avatar

Andriy Plokhotnyuk plokhotnyuk

View GitHub Profile

Scalability of JVM processes is limited by GC rate.

For contemporary CPUs and GCs that provide the best throughput the allocation limit is ~11Gb/sec.

After reaching the allocation limit the JVM process doesn't scale.

Having 7.5Gb/sec in 1 thread the limit will be reached at 2-4 threads and adding more threads only decrease the total troughput.

Steps to reproduce that by running JSON parsing benchmarks on your JDK:

  1. Install latest version of sbt and/or ensure that it already installed properly:
@plokhotnyuk
plokhotnyuk / hanging_in_io.circe.Printer.pretty.svg
Created September 10, 2019 17:27
Hanging in `io.circe.Printer.pretty` with 100% CPU usage
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
andriy@notebook:~$ /opt/scala-2.13.0-RC1/bin/scala
Welcome to Scala 2.13.0-RC1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_212).
Type in expressions for evaluation. Or try :help.
scala> def timed[A](f: => A): A = { val t = System.currentTimeMillis; val r = f; println(s"Elapsed time (ms): ${System.currentTimeMillis - t}"); r }
timed: [A](f: => A)A
scala> timed(BigDecimal("1e-1000000000") + 1)
Elapsed time (ms): 1
res0: scala.math.BigDecimal = 1.000000000000000000000000000000000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.