Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

High CPU usage while uploading file to GCS with Java API

Could anyone suggest what could be the reason that com.sun.crypto.provider.GHASH#update(byte[], int, int) takes lots of CPU while uploading a file to GCS in Java?

Here is the code.

Looks like some internal SSL operation, however, SSL should not incur some much CPU burn.

Complete stacktrace with timings

Env specs:

java version "1.8.0_45"

Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Ubuntu precise (12.04.3 LTS)

Tried google api versions:

com.google.apis:google-api-services-storage:v1-rev26-1.19.1

com.google.apis:google-api-services-storage:v1-rev33-1.20.0

like image 687
Ivan Balashov Avatar asked Feb 15 '26 18:02

Ivan Balashov


1 Answers

Indeed, switching to Java 1.7.0_80-b15 has solved the issue. Even though sun's crypto methods, such as

com.sun.crypto.provider.ARCFOURCipher.engineUpdate(byte[], int, int, byte[], int) ARCFOURCipher.java 12104 12104

are still at the top of CPU consumers, they are much more moderate with this version.

Link to related bug in JDK

like image 84
Ivan Balashov Avatar answered Feb 17 '26 07:02

Ivan Balashov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!