Chat Logs

  1. hassoon'morning
  2. 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
  3. 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.
  4. 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).
  5. dreamrealTyaku: to some degree CPU speed is a limiting factor
  6. ParaLow entropy systems need to generate enough entropy for secure instantiation for crypto stuff.
  7. ParaRPi is afaik one of those, so it'll take a bit.
  8. 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
  9. 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).
  10. dreamrealTyaku: yes, this is a problem. Long-running processes are your solution, to aggregate that cost out.
  11. 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 .
  12. dreamrealaaaagh
  13. dreamrealwhy java 8
  14. dreamrealwhich pi are you deploying to
  15. 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
  16. 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.
  17. dreamrealyeah, raspi2 is a POS :(
  18. dreamrealsorry, you might be stuck
  19. dreamrealbroadcom chips on the raspi2 are... not great
  20. 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
  21. TyakuFirst call - Yocto Board:
  22. TyakuWebSocketManagerImpl : Stage 'webSocket = new WebSocketClientImpl(uri)' : +342 ms
  23. TyakuWebSocketManagerImpl : Stage 'webSocket.setSocketFactory(getSslSocketFactory(config))' : +3412 ms (SSLContext.getInstance(), defaultTmf.init() ..)
  24. TyakuWebSocketManagerImpl : Stage 'onConnected()' : +3592 ms
  25. TyakuFirst call - PC Ubuntu:
  26. TyakuWebSocketManagerImpl : Stage 'webSocket = new WebSocketClientImpl(uri)' : +9 ms
  27. TyakuWebSocketManagerImpl : Stage 'webSocket.setSocketFactory(getSslSocketFactory(config))' : +75 ms
  28. TyakuWebSocketManagerImpl : Stage 'onConnected()' : +271 ms
  29. dreamrealplease don't paste a lot into #java
  30. dreamrealand yes, we're saying this is pretty normal
  31. TyakuCan we expect to increase these performances somehow ? Is it just, an issue with "entropy initialisation" ? Maybe it's not as simple as this. Here there is a discussion where they say that java does not use "HW acceleration" is that true ? https://stackoverflow.com/questions/42417183/100times-performance-slowdown-when-using-javax-net-ssl-sslsocket
  32. dreamrealTyaku: from 9 years ago, eh
  33. dreamrealI mean, you ARE using java 8...
  34. dreamrealas far as "does it use..." it depends quite heavily on specifics