Follow the previous chapter!!

4 Basic Optimization

A Optimization idea?

Locate the problem point sucking: Hardware > System > Application > Database > Architecture (high availability, read/write separation, sub-library sub-table).

Processing direction: clear optimization objectives, performance and safety compromise, prevention.

B Hardware Optimization

Host:












C Server hardware optimization






D System optimization




This parameter determines whether Linux prefers swap or frees the file system cache. When memory is tight, lower values tend to free the file system cache.

Of course, this parameter only reduces the probability of using swap and does not prevent Linux from using swap.

Innodb_flush_ method = O_DIRECT

In this case, InnoDB’s buffer pool directly bypasses the file system cache to access disks, but the redo log still uses the file system cache.

Note that the Redo log is in overwrite mode and does not consume much of the file system cache.





E Adjust system parameters






F Application optimization

Independent of service applications and database applications;





Do not start GUI runlevel 3 on the server where GUI is installed.

Also, think about whether we really need MySQL for our business in the future, or use some other kind of database. The best way to use a database is to do without it.

5 Database Optimization

SQL optimization direction: execution plan, index, SQL rewrite.

Architecture optimization direction: high availability architecture, high performance architecture, sub-library and sub-table.

A Database parameter optimization




B Storage engine layer (InnoDB basic optimization parameters)





Java advanced Learning Materials, BAT interview questions, and Effective Java (3rd edition) are available in 2019. You can also add group: 712263501 to receive massive learning materials for learning.