Java performance tuning in the AIX Environment (1)

Source: Internet
Author: User

1. What is Java

Java is an object-oriented programming language. It uses C ++ as a model and is designed as a small, simple, source-binary cross-platform portable language, Java program (applets and applications) it can run on any machine that has a Java Virtual Machine (JVM) installed. Java has significant advantages over other computer languages and is suitable for any programming task. Java has the following advantages:

Java is platform-independent: One of the most significant advantages of Java is its ability to easily move from one computer system to another. What is critical to any Web software is the ability to run the same program on many different systems. The success of Java lies in that it can be independent of the platform at the source and binary levels.

Java is object-oriented: Another advantage of Java is the use of object-oriented methods. This allows you to create modular programs and reusable code.
Java is easy to learn: Java is designed as an easy-to-use language, so it is easier to write, compile, debug, and learn.
Java is an e-commerce solution. Due to Java's robustness, ease of use, cross-platform capabilities, and security features, Java has become a language of choice for providing Internet solutions worldwide.

2. Java version in the AIX Environment

Currently, the AIX operating system supports multiple Java versions. you can install multiple Java versions in one operating system, you can set the PATH to the directory of this version. The following are the supported Java versions of AIX:

Java 1.1.8
Java 1.2.2
Java 1.3.0
Java 1.3.1 32bit
Java 1.3.1 64bit
Java 1.4 32bit
Java 1.4 64bit

In terms of performance, try to use later versions of AIX and later versions of Java, and install the latest operating system and Java patch packages. 64-bit Java is required when a Java heap exceeding 2 GB is required. In the AIX environment, Java is free of charge. You can download Java software from the following URL:

Http://www6.software.ibm.com/dl/dka/dka-p
Download the patch packages for the AIX operating system and Java from the following urls:
Http://techsupport.services.ibm.com/server/fixes.

 3. Java performance criteria

When writing Java applications, the following are the basic principles:
Use a string buffer instead of a string connection. When performing consecutive string operations, you must avoid unnecessary creation of objects that must eventually be recycled.
Avoid writing data to the Java console consecutively to reduce the cost of string operations, text formatting, and output.
If necessary, use the primitive type of the variable to avoid the cost of object creation and operation.
Frequently cache used objects to reduce the required amount of garbage collection and avoid repeated object creation.
Group local operations as much as possible to reduce calls to Java local interfaces (JNI.
You can only use the synchronization method when necessary to limit the number of tasks in the JVM and operating system.
Unless necessary, avoid calling the garbage collector. If you have to call it, do so only in idle time or some non-critical stages.
An integer may be used instead of a long integer, because 32-bit operations are faster than 64-bit operations.
If possible, declare the method as final. The method for JVM to process final is better.
When creating a constant, use the keyword static final to reduce the number of times the variable needs to be initialized.
Avoid unnecessary "casts" and "instanceof" references, because the destruction operation in Java is not executed at runtime during compilation.
When the array can meet the requirements, avoid using vectors as much as possible.
Add and delete items from the end of the vector to get high performance.
Use the-O option to compile the Java file.
Avoid allocating objects in a loop.
Use the buffer I/O and tune the buffer size.
Use the connection pool and prepare the cache statement for database access.
Connect to the database using the connection pool and try again instead of opening or closing the connection repeatedly.
Maximize thread lifetime and minimize thread creation and destruction cycles.
Minimize competition for shared resources.
Minimize the creation of short-lived objects.
Avoid remote method calls.
Use callback to avoid blocking remote method calls.
Avoid creating an object that is only used to access one method.
Try to keep the synchronization method out of the loop.
Stores string and character data in Unicode format in the database.
Record CLASSPATH so that the most common library appears first.


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.