Discussion on memory contention of Java application on multiprocessor platform

Source: Internet
Author: User
Tags requires

With the need for highly scalable Java applications in an enterprise environment, parallel processing of threads is required on multiprocessor platforms. The memory and concurrency required for threading in the JVM heap have become bottlenecks in the performance and scalability of these Java EE applications at deployment. This article explores the thread synchronization problem that Java EE uses to access memory in the JVM heap on multiprocessor platforms.

Java application's memory requirements

Currently, the Java EE application in the enterprise environment needs to be able to handle thousands of user requests in one second. This data request from a large number of concurrent users creates a larger demand for space and requires more memory. With more memory to provide a larger Java EE application heap space, and multiprocessor can handle more concurrent threads, so now the way the threads access memory and the time it takes to access the bottleneck.

Multi-processor Platform

Increasing the number of processors can increase scalability, but it also requires processing more threads. Threads need to consume memory when working with data, creating Java objects, and other Java operations. Because multiple threads are running on multiple processors, it is necessary to ensure the consistency and integrity of the data in the system. The threads in the processor read and write memory at the same time, which requires synchronizing the threads to prevent reading and writing of the wrong data. In Figure 1, the similarities and differences between the single processor and multiprocessor in accessing memory are shown. In a single-processor platform, only one thread is executed at any given time, so there is no need for synchronization. However, on multiprocessor platforms, multiple threads may be executed at the same time, which requires synchronous access to memory to ensure data correctness, which can lead to contention and bottlenecks.

Figure 1. Single-processor versus multi-processor platforms accessing memory

The thread local heap tries to solve this problem by pre-configured a small chunk of memory in the JVM heap for each thread. However, in this way the memory space for the high memory requirements of the Java application is not enough.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.