Application performance optimization

zhaozj2021-02-16  98

In these days, the previously developed system was tested due to the reasons for work. The main role of this system is to transmit data. Move the data of a database to another database, and may need to pass through the Internet, and the target recipient does not necessarily change this.

Two databases were tested, and their data was transferred to the transfer process. Often said that you have low programs that you write, not available. In fact, this test discovery is very important:

1) Code

Since the program uses Java written, it is necessary to compatibility with different databases, and thus the data of the string type data is required.

String str = new string (rs.getstring (i) .getbyte (dataBaseEncoding);

When the amount of data is small, it is noticeable that when the amount of data is large, this consumption is somewhat amazing.

IF (DatabaseEncoding.equals (fileEncoding) {

Return New String (rs.getstring (i) .getbyte (DatabaseEncoding);

}

After the changes, when FileEncoding and DatabaseEncoding, data processing efficiency is more than 5 times.

2) Hard disk

When doing testing, when the database is on the same machine, it is found that the hard drive light has never exted. Remove the application to another machine, reproduce the test, and find that performance is at least 50%. This is the opposite of my previous experience. After analysis, I used to use a notebook, and the hard disk is only 4200 rpm. When the amount of data is large, the hard disk is fundamentally possible. After separating the application, the network communication overhead of JDBC writes data is less than the overhead of hard disk resources, and the speed is of course put it.

It seems that the same application in different environments is not necessarily the same.

3) Comprehensive loss

When doing testing, the optimal performance of the system is not data, nor is the maximum data, but is in an intermediate value. Analysis found that there are some "comprehensive losses" in operation, which are objectively exist, such as data connection, format check, or more regardless of your data. When the amount of data is small, these losses account for more time, while when the amount of data is large, although the specific gravity of these integrated losses occupies, the amount of dynamic loss of data is large. " Only when a value is in the middle, the two losses are not particularly visible, and the efficiency of the system has reached the highest value.

转载请注明原文地址:https://www.9cbs.com/read-13167.html

New Post(0)