* CodeGeek!~codegeek@about/java/CodeGeek changed the topic to: Welcome! || Read Channel Rules at https://javachannel.org/ before participating. || Paste limit is two lines; ~pastebin lists options. || No applets, please. || Minecraft, Android, and Javascript all have their own channel. || You are being logged.
* Fiji_ joined #java
* mixfix41 joined #java
* MikeBux joined #java
* Tyaku joined #java
TyakuHello, I come here to talk about an issue, that maybe only experts from this kind of channels can help. ChatGPT/Google is not helping. We have some performance issues, when we call Singleton classes for the first time it can take a long time on some platforms. For example: `SSLContext.getInstance(TLSv1.2)` takes: 1.3s on my ARM 64 Bits Yocto board, 2.2s on a RPI 2B (ARM 32bits) with most recent raspberry pi
TyakuOS, 20ms on a ARCH64 computer. We don't arrive to identify the cause of this delay. Hotspot/Jit is enabled, if I start with -Xint, it reduce a little (like -300ms) but not really significative.
TyakuThis is really impacting because when we connect to the websocket server, it takes 500ms on a computer to establish the connection (from DNS discovery to the end of TLS handshake) and 7-8 seconds on Yocto board, due to many singleton classes that are involved in the process (SSLContext, etc).
dreamrealTyaku: to some degree CPU speed is a limiting factor
ParaLow entropy systems need to generate enough entropy for secure instantiation for crypto stuff.
ParaRPi is afaik one of those, so it'll take a bit.
* jamezp joined #java
nimajeclasses get load on first use (you wouldn't want to load all classes on the classpath to then only use five), so if the class has heavy initialisation, then you will see that then
TyakuTrustManagerFactory.getInstance("X509"): 307ms, defaultTmf.init(null): 2092ms, SSLContext.getInstance("TLSv1.2"): 968ms (in this sequence it takes less, because probably it use singleton classes that are already instanciated by something previously called).
dreamrealTyaku: yes, this is a problem. Long-running processes are your solution, to aggregate that cost out.
Tyakuis the source code available somewhere just to see what it does internally ? In our Yocto plateform we use openjdk 8 https://hg.openjdk.org/aarch64-port/jdk8u is one of SRC_URI, but doesn't seems to be the java code .
dreamrealaaaagh
dreamrealwhy java 8
dreamrealwhich pi are you deploying to
TyakuThis is what is available in meta-java scarthgap Yocto. On a custom board, the PI was just for testing performance, but on the PI I used JRE 25
TyakuOn the Yocto board RZG2UL custom board, we use meta-java (scarthgap branch), which use openjdk 8. In RPI 2B (because I had only this in my hands) I used openjdk-jre-25 because 8 was not available. But on RPI 2B this it ARM32 and not 64bits, And takes 2.2s instead of 1.3s on the Yocto board and 20ms on ubuntu computer.
dreamrealyeah, raspi2 is a POS :(
dreamrealsorry, you might be stuck
dreamrealbroadcom chips on the raspi2 are... not great
TyakuThe RPI is not used to run my program, I used it just for performances tests, Here you can see the softwares that I used to do my performances tests : https://pastebin.com/ggty7xBf and some example of results
TyakuFirst call - Yocto Board:
TyakuWebSocketManagerImpl : Stage 'webSocket = new WebSocketClientImpl(uri)' : +342 ms
TyakuWebSocketManagerImpl : Stage 'webSocket.setSocketFactory(getSslSocketFactory(config))' : +3412 ms (SSLContext.getInstance(), defaultTmf.init() ..)
TyakuWebSocketManagerImpl : Stage 'onConnected()' : +3592 ms
TyakuFirst call - PC Ubuntu:
TyakuWebSocketManagerImpl : Stage 'webSocket = new WebSocketClientImpl(uri)' : +9 ms
TyakuWebSocketManagerImpl : Stage 'webSocket.setSocketFactory(getSslSocketFactory(config))' : +75 ms
TyakuWebSocketManagerImpl : Stage 'onConnected()' : +271 ms
dreamrealplease don't paste a lot into #java
dreamrealand yes, we're saying this is pretty normal