ByteCode.News
Submit RSS Atom Sign in

Back to the channels

#java

  1. hassoon 'morning
  2. Tyaku Hello, 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. Tyaku OS, 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. Tyaku This 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. dreamreal Tyaku: to some degree CPU speed is a limiting factor
  6. Para Low entropy systems need to generate enough entropy for secure instantiation for crypto stuff.
  7. Para RPi is afaik one of those, so it'll take a bit.
  8. nimaje classes 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. Tyaku TrustManagerFactory.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. dreamreal Tyaku: yes, this is a problem. Long-running processes are your solution, to aggregate that cost out.
  11. Tyaku is 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. dreamreal aaaagh
  13. dreamreal why java 8
  14. dreamreal which pi are you deploying to
  15. Tyaku This 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. Tyaku On 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. dreamreal yeah, raspi2 is a POS :(
  18. dreamreal sorry, you might be stuck
  19. dreamreal broadcom chips on the raspi2 are... not great
  20. Tyaku The 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. Tyaku First call - Yocto Board:
  22. Tyaku WebSocketManagerImpl : Stage 'webSocket = new WebSocketClientImpl(uri)' : +342 ms
  23. Tyaku WebSocketManagerImpl : Stage 'webSocket.setSocketFactory(getSslSocketFactory(config))' : +3412 ms (SSLContext.getInstance(), defaultTmf.init() ..)
  24. Tyaku WebSocketManagerImpl : Stage 'onConnected()' : +3592 ms
  25. Tyaku First call - PC Ubuntu:
  26. Tyaku WebSocketManagerImpl : Stage 'webSocket = new WebSocketClientImpl(uri)' : +9 ms
  27. Tyaku WebSocketManagerImpl : Stage 'webSocket.setSocketFactory(getSslSocketFactory(config))' : +75 ms
  28. Tyaku WebSocketManagerImpl : Stage 'onConnected()' : +271 ms
  29. dreamreal please don't paste a lot into #java
  30. dreamreal and yes, we're saying this is pretty normal
  31. Tyaku Can 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. dreamreal Tyaku: from 9 years ago, eh
  33. dreamreal I mean, you ARE using java 8...
  34. dreamreal as far as "does it use..." it depends quite heavily on specifics