Database optimization solution: how to optimize MySQL server

There are some optimization techniques for database servers, mainly to manage system configuration rather than adjusting SQL statements. It is suitable for DBAs who want to ensure the performance and scalability of the server, as well as developers who start installation scripts to establish a database and run MySQL to develop and test by themselves to increase productivity.

System factors

Some system-level aspects also have a big impact on performance:

• If you have enough RAM, there is no need to swap devices. Regardless of whether there is free memory, the OS usually uses a swap device in some way.

• Ignore external locking of MyISAM tables. The default setting is to restrict external locking (exterior locking). The alternatives to external locking and skip exterior locking explicitly indicate enabling and disabling external locking. When you only run one server, disabling external locking will not affect MySQL functionality. Make sure to shut down the server before running myisamchk. On a few systems, because external locking does not work, it is important to disable it.

When you are running multiple MySQL servers on similar data, or when you run myisamchk to evaluate tables without seeing the server making a major rating and locking the table, you cannot disable external locking. Remember, unless you are using an NDB cluster, it is generally not recommended to use multiple MySQL servers at the same time to evaluate the same data.

Optimize disk I/O

When you can invest better and faster storage hardware to the database server, it will show the path of the organization's storage devices.

Disk search is a big performance barrier. The problem becomes more obvious when the amount of data starts to grow to the point where efficient caching cannot be achieved.

Enhance the number of current disk spindles by symbolically linking files to other disks or disk strips.

It is a good idea to distinguish RAID levels based on key data types.

Use NFS and MySQL

You need to be cautious when considering using NFS with MySQL. Possible problems caused by different versions of OS and NFS include:

  • The log files and MySQL data files located on the NFS volume are locked and cannot be used.
  • Data is inconsistent due to failure of receiving information or poor network traffic. To eliminate it, use TCP with hard and intr loading support.
  • High file size limit.

Use symbolic links

You can move the database from the database directory to any other location, or replace it with a symbolic link to the new location. You may want to do this, for example, to move the database to a file system with more versatile space, or to increase the speed of the system by expanding the table to a different disk.

The recommended approach is to symbolically link the complete database directory to a separate disk. The symbolic link MYISAM table is only the last option.

1. You can use the symbolic link of the database on Unix.
2. You can use the symbolic link of the MyISAM table on Unix.
3. You can use the symbolic link of the database on Windows.

Guess you like

Origin blog.csdn.net/qq_42444778/article/details/115162405