JAVA performance optimization and deployment of distributed architecture

First, the performance optimization of design optimization JAVA 
design optimization in the upper performance optimization means. It often needs to take place before the software development. Prior to software development, systems architect should be on evaluating various potential problems and technical difficulties that may exist in the system, and gives reasonable design, because the software design and system architecture has a decisive influence on the quality of the software Zongtisheji. Therefore, affect the performance tuning of the system design is also the largest, it is assumed that the code optimization. JVM optimized systems are optimized for micro-level "amount", that is to optimize the design of the "quality" of the optimization system 
design optimization of a large salient features are: it can avoid performance problems one component, but modified components implementation; for example: component a continuous detection time E has occurred through the cycle monitoring, which detects the behavior will certainly occupy part of the system resources, so developers must strike a balance frequency detection and resource consumption, assuming that detection frequency is too low, although lower resource consumption, but the real-time response of the system is lowered, it is assumed tune the code layer, on the need to achieve and optimize the most appropriate required to obtain a detection frequency of the detection method for this problem, we can observe a design pattern by mode, when the time of the event E occurs, event notification component E a, thereby triggering components a behavior. this design fundamentally overcome the cycle there is a performance monitor risks, to overcome this problem fundamentally. 
design optimization, and the designer must be familiar with the design method often used, design patterns, and the main components and performance advantages frequently used Ideas, and organically integrated in the software system. 
Note: a good system design can avoid a lot of potential in performance problems and therefore, as much as possible to spend some time on the system design is the key to creating a high-performance program 
Second, the performance optimization of JAVA code optimization 
codes tuning in software development, or the software developed, software improvement and optimization of the program code is performed during maintenance. Code optimization involves many coding techniques, the need for developers familiar with the language API, and the scenes are related to the correct use of API or library. the same time, algorithms, flexible data structures, but also an important part of the code optimization. 
Although performance on code optimization from the micro adjustment, but the influence of a "good" and achieve a "bad" implementation of the system is very large. For example, to achieve the same as List, LinkedList and ArrayList in random access but poor performance on several of the order; the same analogy is to achieve read and write files using Stream mode and manner of use of JAVA NIO, the system may well be able to be there an order of magnitude. 
Therefore, although compared optimization and design , I will be the optimization code optimization at the micro level, but it is the most direct impact on system performance optimization. 
three, JVM optimized 
because the JAVA software is always performed on the JVM virtual machine. JVM optimized for virtual machine can also enhance the performance of JAVA program on a certain extent. JVM can usually late in the software development, as a milestone in the completion of the development phase of software development or in. 
As JAVA software execution platform. JVM parameters will directly affect the performance of JAVA program.

For example, the JVM heap size, garbage collection policies, and so on. 
To tune JVM level. Developers need to have some understanding of the implementation of the principles and basic JVM memory structures. For example, a heap memory structure, the type of GC and the like. Then, according to the characteristics of the program references. Set reasonable JVM startup parameters.


four. Database optimized 
for the vast majority of applications. The database is an indispensable part. JAVA programs to connect to the database using JDBC manner. Tuning of the database can be divided into three parts:

  • In the application layer to optimize the SQL statement;
  • Optimize the database.
  • Database software optimization.

Optimized database access at the application layer. Involves a lot of programming skills. For example. When using JDBC query SQL query for a large number has the same structure can be used to replace PerparedStatement Statement. To improve the efficiency of the database query. Select statement in use, the display column name you want to query, to avoid the use * 
in the database optimization, the main purpose is to establish a good database table structure.

For example, in order to improve the efficiency of the cascade multi-table queries, use of reasonably redundant field; For large tables, it is possible to use a horizontal split line or similar techniques Oracle partition; To improve the efficiency of data queries can be established effective levels divided Oracle's partition table or similar technology; in order to improve the efficiency of database queries. In the select statement. Displays the column names to be queried, avoid the use of *. 
When the database optimization. The main aim is to establish a good database table structure. For example, in order to improve the efficiency of multi-table queries cascade can reasonably use a redundant field. For large tables. Can be used to separate data line level, in order to improve the efficiency of database queries, and to establish effective and matters index 
V. optimize performance optimization of JAVA Caozuojitong 
Caozuoxitong, tuning tools and data may differ, for example, in the mainstream Unix systems. Shared memory segment. Semaphores, shared memory maximum (shmmax). Shared memory minimum (shmmin) are all capable of optimizing system resources. In addition, as the maximum number of file handles, virtual memory size, disk block size and other parameters could have an impact on the performance of the software. Configure Virtual Memory Interface

Guess you like

Origin www.cnblogs.com/java8899/p/11622741.html