Skip to content

Expand ARM Architecture Compatibility #5954

Closed

Description

@halibobo1205

Background

Java-Tron currently only supports the x86 architecture. Nevertheless, ARM architecture has gained significant traction recently, especially in cloud computing and mobile devices. ARM processors are known for their energy efficiency and cost-effectiveness, making them increasingly popular in data centers, cloud computing, and edge computing scenarios. It would be great to have the option to run Java-Tron on the ARM architecture.

Key developments in ARM architecture:

ARM advantages:

Related Issues and PRs

Scope of Impact

  • Build and deployment processes
  • Core application code
  • Third-party dependencies
  • Development and testing environments

Current Progress Summary

  1. JDK version

    • x86 is limited to JDK 1.8
    • arm is limited to JDK 17
  2. Native code

  3. Third-party dependencies

  4. Floating-point arithmetic

  5. Build and deployment process

    • Update build scripts to support ARM architecture.
    • Ensure CI/CD pipelines can be built and tested in ARM environments.
    • Docker support
  6. only supports RocksDB

    • FullNode.jar and Toolkit.jar only support RocksDB on ARM
    • Tookit.jar db archive,db convert commands are not supported on arm
    • ArchiveManifest.jar is not supported on arm
  7. x86 vs ARM Performance Comparison

Test Category Test Type Winner Performance Difference Notes
Database Read Random Read X86 X86 outperforms ARM by ~60% Significant advantage in random I/O
Database Read Sequential Read ARM ARM outperforms X86 by ~6% Better sequential access efficiency
Serialization Serialization ARM ARM outperforms X86 by ~170% Substantial advantage in data serialization
Serialization Deserialization ARM ARM outperforms X86 by ~3% Minimal but consistent advantage
Transaction TRX Transfer X86 X86 outperforms ARM by ~23.8% Better TRX transaction processing
Transaction USDT Transfer Comparable No significant difference Similar performance on both platforms
Signature Verification Serial Processing X86 X86 outperforms ARM by ~14% Single-threaded verification advantage
Signature Verification Parallel Processing ARM ARM outperforms X86 by ~18% Multi-threaded verification advantage
  1. Related PRs

Activity

  1. angrynurd commented on Aug 15, 2024

    @angrynurd

    I am totally in favor of extending ARM architecture compatibility. This will allow Java-Tron to run on more platforms and take advantage of the benefits of the ARM architecture, such as higher energy efficiency and lower cost.
    In my opinion, we can start with the following:

    1. Prioritize ARM support for key dependencies: For example, RocksDB/LevelDB is an important database component in Java-Tron and it is critical to ensure its compatibility on ARM.
    2. Establish an ARM test environment: We need to establish a dedicated ARM test environment to ensure the stability and performance of Java-Tron on ARM.
    3. Collaborate with the community: We can work with the community to solve ARM compatibility issues and share experiences and best practices.
  2. tomatoishealthy commented on Aug 15, 2024

    @tomatoishealthy
    Contributor

    It sounds great, but I am a novice in ARM architecture. I am curious about the challenges of supporting ARM architecture.

    Can you list something like a task list in the future? It is convenient to clearly understand the current status and future challenges.

  3. halibobo1205 commented on Aug 15, 2024

    @halibobo1205
    CollaboratorAuthor

    Here are some common considerations:

    Important

    1. JDK version compatibility
      Ensure the JDK version supports ARM Architecture. Consider using ARM-optimized JDK distributions.
    • Linux got support in JDK 9(non-LTS) by JEP 237
    • Windows got support in JDK 16(non-LTS) by JEP 388
    • Macs got support in JDK 17(LTS) by JEP 391

    Important

    2. Native code
    JNI (Java Native Interface) or other native code.
    These native code components need to be recompiled or upgraded for ARM architecture.

    • LevelDBJni
    • RocksDBJni
    • zksnark-java-sdk

    Tip

    3. Endianness
    x86 is little-endian, while some ARM processors may be big-endian.
    Check if any operations in the code(such as TVM) depend on a specific endianness, especially when handling binary data.

    Tip

    4. Memory alignment:
    ARM architecture may have different memory alignment requirements than x86.
    Check for code(such as TVM) that assumes specific memory alignments.

    Tip

    5. Atomic operations and concurrency
    Some atomic operations(TVM) may be implemented differently on different architectures.
    Review concurrent code to ensure it works correctly on ARM as well.

    Caution

    6. Floating-point arithmetic
    ARM and x86 may have subtle differences in floating-point precision and behavior.
    For applications that rely on precise floating-point calculations, comprehensive testing is necessary.

    Tip

    7. Performance optimization
    x86-specific performance optimizations(TVM) may no longer be applicable on ARM.
    Consider using ARM-specific optimization techniques.

    Important

    8. Third-party dependencies
    Ensure all third-party libraries and dependencies support ARM architecture.
    Some incompatible dependencies may need to be updated or replaced.

    • protoc-gen-grpc-java

    Important

    9. Build and deployment process:

    • Update build scripts to support ARM architecture.
    • Ensure CI/CD pipelines can be built and tested in ARM environments.
    • Docker support

    Tip

    10. Hardware feature dependencies:
    Check if the code(TVM) relies on x86-specific hardware features.
    Alternatives may need to be found for ARM.

    Tip

    11. System calls and OS interactions
    If the code makes direct system calls, adjustments may be needed for ARM.

    Important

    12. Cross-platform testing

    • Establish comprehensive test suites to ensure the functionality works correctly on ARM.
    • Conduct performance benchmarking to compare x86 and ARM performance differences.
  4. 317787106 commented on Aug 15, 2024

    @317787106
    Collaborator

    @halibobo1205 Do you want to support ARM Architecture and latest JVM version at the same time ? Or just support ARM Architecture using JDK8 ?

  5. halibobo1205 commented on Aug 15, 2024

    @halibobo1205
    CollaboratorAuthor

    @317787106 JVM officially supports ARM:

    • Linux got support in JDK 9 by JEP 237
    • Windows got support in JDK 16 by JEP 388
    • Macs got support in JDK 17 by JEP 391

    According to Oracle Java SE Support Roadmap, JDK9 and JDK16 are non-LTS, and JDK 17 is LTS. Based on the above information, I propose that ARM support JDK17 as a minimum.

    Warning

    This is the last planned update of JDK 17 under the NFTC. Updates after September 2024 will be licensed under the Java SE OTN License (OTN) and production use beyond the limited free grants of the OTN license will require a fee.

  6. angrynurd commented on Aug 15, 2024

    @angrynurd

    Here are some common considerations:


    Regarding JDK version compatibility.
    You recommend using an ARM-optimized JDK distribution. What specific ARM-optimized JDK distributions do you recommend? What are their performance and stability advantages?

  7. abn2357 commented on Aug 15, 2024

    @abn2357
    Contributor

    When is the expected completion time for this work? It sounds like a big project.

  8. halibobo1205 commented on Aug 15, 2024

    @halibobo1205
    CollaboratorAuthor

    @endiaoekoe I propose that ARM support JDK17 as a minimum.

  9. halibobo1205 commented on Aug 15, 2024

    @halibobo1205
    CollaboratorAuthor

    @abn2357 Tron currently only supports JDK 8, based on the above information, JDK17 supports ARM fully, perhaps Tron needs to upgrade JDK17 first, which is another big project.

  10. zeusoo001 commented on Aug 20, 2024

    @zeusoo001
    Contributor

    @halibobo1205 It sounds great, and I look forward to your implementation. I see that there may be subtle differences in floating point precision and behavior between ARM and x86. When supporting it, be sure to ensure data consistency. Also investigate whether there are other places that may cause data inconsistency.

  11. Murphytron commented on Aug 20, 2024

    @Murphytron

    This issue has been added to the core devs community call #22, welcome to share the latest progress @halibobo1205, and discuss together with @endiaoekoe @tomatoishealthy @317787106 @zeusoo001 @abn2357.

  12. halibobo1205 commented on Aug 20, 2024

    @halibobo1205
    CollaboratorAuthor

    1. JDK version compatibility
    After some brief research, I found ARM 64-bit versions of JDK 8 available. cc @endiaoekoe @317787106 @abn2357

    Provider Linux Mac Windows Notes
    Oracle ✓ ✓ ✗ • Official support
    • Requires payment for commercial use
    Eclipse Temurin ✓ ✗ ✗ • Free OpenJDK
    • Regularly updated and supported by the Adoptium community
    Azul Zulu ✓ ✓ ✗ • Free OpenJDK
    • Full enterprise version requires payment
    BellSoft Liberica ✓ ✓ ✗ • Free OpenJDK for all users
    • Relatively less well-known
    Amazon Corretto ✓ ✓ ✗ • Free OpenJDK
    • long-term support by Amazon
    • Amazon runs Corretto internally on thousands of production services
  13. halibobo1205 commented on Aug 20, 2024

    @halibobo1205
    CollaboratorAuthor

    6. Floating-point arithmetic known issues:

    Unfortunately, Tron does use Math.pow() for floating-point calculations for the Bancor trading pair in ExchangeProcessor:

    private long exchangeToSupply(long balance, long quant) {
        logger.debug("balance: " + balance);
        long newBalance = balance + quant;
        logger.debug("balance + quant: " + newBalance);
    
        double issuedSupply = -supply * (1.0 - Math.pow(1.0 + (double) quant / newBalance, 0.0005));
        logger.debug("issuedSupply: " + issuedSupply);
        long out = (long) issuedSupply;
        supply += out;
    
        return out;
      }
    
      private long exchangeFromSupply(long balance, long supplyQuant) {
        supply -= supplyQuant;
    
        double exchangeBalance =
            balance * (Math.pow(1.0 + (double) supplyQuant / supply, 2000.0) - 1.0);
        logger.debug("exchangeBalance: " + exchangeBalance);
    
        return (long) exchangeBalance;
      }

    Test case

     @Test
      public void testPow() {
        double x = 29218;
        double q = 4761432;
        double ret = Math.pow(1.0 + x / q, 0.0005);
        double ret2 = StrictMath.pow(1.0 + x / q, 0.0005);
    
        System.out.printf("%s%n", doubleToHex(ret)); //  3ff000033518c576
        System.out.printf("%s%n", doubleToHex(ret2)); // 3ff000033518c575
        Assert.assertEquals(0, Double.compare(ret, ret2)); // fail in jdk8_X86, success in jdk8_ARM64
      }
    
      public static String doubleToHex(double input) {
        // Convert the starting value to the equivalent value in a long
        long doubleAsLong = Double.doubleToRawLongBits(input);
        // and then convert the long to a hex string
        return Long.toHexString(doubleAsLong);
      }

    Tron Should Use StrictMath to Avoid Cross-Platform Consistency Issues. To help ensure the portability on ARM for Java-Tron, I suggest a new proposal to convert Math to StrictMath. cc @zeusoo001

  14. 317787106 commented on Aug 20, 2024

    @317787106
    Collaborator

    @halibobo1205 First support JDK8 on mac ARM and then extend to support JDK17 on linux and mac ARM may be smooth.

  15. 98 remaining items

  16. Benson0224 commented on Jul 24, 2025

    @Benson0224
    Collaborator

    Status Update: This issue has been scheduled for implementation in the next release, tentatively V4.8.1. The resolution plan is as follows

    • ✅ Added to development pipeline
    • ⏳ Will close automatically when core PRs land
    • 🔔 Maintain real-time status updates here

    However, all discussions related to this issue remain welcome. Please continue the conversation here if you have relevant topics to contribute. Thanks!

    At last, please follow V4.8.1 status at Issue #6342 and watch this issue (via Subscribe button) to track progress if needed. We value your involvement in TRON's development!

  17. waynercheung commented on Aug 1, 2025

    @waynercheung
    Collaborator

    Hi @halibobo1205 , after supporting ARM architecture, is there any impacts on x86 architecture?

  18. halibobo1205 commented on Aug 4, 2025

    @halibobo1205
    CollaboratorAuthor

    Hi @halibobo1205 , after supporting ARM architecture, is there any impacts on x86 architecture?

    Previously, the following scenario was supported on X86 but will no longer be supported:

    Developers could download a LevelDB database without an engine.properties file while having RocksDB configured in the config file. In this case, the node could start normally (initializing engine.properties as RocksDB) because RocksDB 5.15.10 was compatible with the LevelDB data format.

    However, after ARM deployment, RocksDB will be upgraded to version 7.7.3 (upgrade applies to ARM only), which is no longer compatible with the LevelDB data format. To minimize the occurrence of this issue, we will uniformly prohibit RocksDB from opening LevelDB databases in the future. Note that existing users who have already opened LevelDB databases will not be affected, as their LevelDB data has already been converted to RocksDB format by the compatible RocksDB version.

  19. waynercheung commented on Aug 13, 2025

    @waynercheung
    Collaborator

    @halibobo1205 , are there specific Java JDK version requirements for x86 and ARM architectures?

  20. halibobo1205 commented on Aug 13, 2025

    @halibobo1205
    CollaboratorAuthor

    Are there specific Java JDK version requirements for x86 and ARM architectures?

    @waynercheung X86 platforms strictly restrict JDK 1.8 usage, while ARM platforms support JDK 17 as the minimum requirement. JDK 17 has been tested and confirmed compatible on ARM platforms, with other versions not yet fully validated. JDK 17 is recommended for ARM deployments.

  21. linked a pull request that will close this issuerefactor(crypto,api): improve code quality #6417on Aug 25, 2025
  22. linked a pull request that will close this issuefeat(db): update to rocksdb 9 for arm #6440on Nov 5, 2025
  23. moved this from In Review to Done in java-tronon Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions