Recently wrote a program, real-time read Rsyslog log, but encountered a problem: MySQL insertion speed delay, very slow, so began to troubleshoot;
1. Analysis procedures, will be considered more time-consuming place for threading analysis, invalid;
2. According to the online, multi-line insertion, commit has no effect;
3. Reload MySQL driver, invalid;
4. Write a simple test statement inserted into the database, found slower, further in MySQL to execute SQL statements found slower, OK is the problem of MySQL;
5. Check the MySQL log size, as well as the directory space, found that there are no problems, excluded;
6. Turn off the myql bin option, and find that the insertion speed is almost half, but still unacceptable, this is not the right approach;
7. Do you finally think that the IO load on the disk is too high? Troubleshooting when found that the disk IO speed is very slow, only 100 trillion, the initial positioning should be the problem;
8. Switch MySQL data directory to SSD, found that the problem is resolved, the original disk IO is too slow to cause the insertion speed too slow.
Of course, the above problem may be the case, if all the methods are discharged, may wish to see whether it is the problem I encountered.
Fuck, troubleshooting Python's slow process of writing to MySQL database (heart is broken)