Why Java and Python Behave Differently on Armv8 and How to Optimize JVM Performance
This article compares Java and Python on Armv8 platforms, explaining why both compile to machine code and rely on virtual machines, detailing JVM feature support across architectures, and offering configuration tips to prevent CodeCache overflow and improve performance, while also noting Python's compatibility on Kunpeng servers.
The two languages are discussed together because, in certain scenarios, their behavior is very similar: both generate machine code from source files and use a virtual machine to execute that code.
In most cases Java bytecode is interpreted by the JVM, and Python compiles source to bytecode at runtime and then interprets it, so both can be regarded as interpreted languages.
In theory, a codebase composed entirely of Java or Python source and generated machine code is platform‑agnostic, but platform‑specific features still exist. For example, Java NIO uses epoll on Linux and IOCP on Windows, while many Python scientific libraries (e.g., SciPy, NumPy) rely on native C/Fortran implementations.
Java Section
The Java community provides relatively complete support for the Armv8 instruction set. Using JDK 8, the JVM already supports all major features such as client/server modes, minimal runtime, multiple JIT tiers (C1, C2, TieredCompilation), various garbage collectors (SerialGC, ParallelGC, CMS, G1, ZGC), container runtime support, Application Class‑Data Sharing (AppCDS), HugePages, and serviceability tools like Java Flight Recorder.
During execution, the JIT compiles hot bytecode into machine code stored in the Code Cache. If the Code Cache becomes full, the JVM falls back to interpreting bytecode, causing a dramatic performance drop, especially on Arm64 where generated code can be several times larger than on x86.
To prevent Code Cache overflow, adjust JVM options such as -XX:+TieredCompilation (disable to reduce multiple code tiers), and -XX:ReservedCodeCacheSize (increase, e.g., to 512 MB).
Python Section
The Python ecosystem is more loosely organized; the core interpreter supports Armv8, but many native modules do not. Nevertheless, tests on Kunpeng servers show that Python 2.7.9 and Python 3.5 can run full OpenStack workloads (Nova, Cinder, Swift, Glance, Neutron, Ceilometer) without issues, indicating good compatibility.
Overall, Java offers extensive JVM feature support on Arm platforms, while Python relies heavily on external native libraries; both require careful configuration to achieve optimal performance on Arm architectures.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Huawei Cloud Developer Alliance
The Huawei Cloud Developer Alliance creates a tech sharing platform for developers and partners, gathering Huawei Cloud product knowledge, event updates, expert talks, and more. Together we continuously innovate to build the cloud foundation of an intelligent world.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
