Bug #105607 MySQL5.7.23 The startup process takes too long
Submitted: 17 Nov 2021 2:06 Modified: 18 Nov 2021 0:28
Reporter: Shunlu Shi Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S5 (Performance)
Version:5.7.23 OS:Windows (windows server 2019)
Assigned to: CPU Architecture:Any

[17 Nov 2021 2:06] Shunlu Shi
Description:
I installed MySQL5.7.23 on a Windows Server 2019 VIRTUAL machine,It starts fine when no other databases or tables are created.When I created more than 100 databases, I used the InnoDB engine,There are about a thousand tables in each database,It will take a long time to start the MySQL service when I close it and start it again,It takes about 30 minutes in my test environment,Two hours in production environment.I didn't see any errors in the log
------------------err.log-------------------
2021-11-16T14:01:00.803802+08:00 0 [Warning] option 'read_buffer_size': unsigned value 0 adjusted to 8192
2021-11-16T14:01:00.804091+08:00 0 [Warning] option 'read_rnd_buffer_size': unsigned value 0 adjusted to 1
2021-11-16T14:01:00.804179+08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-11-16T14:01:00.804239+08:00 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2021-11-16T14:01:00.809836+08:00 0 [Note] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe (mysqld 5.7.23-log) starting as process 3204 ...
2021-11-16T14:01:00.910778+08:00 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2021-11-16T14:01:00.911700+08:00 0 [Note] InnoDB: Uses event mutexes
2021-11-16T14:01:00.912246+08:00 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2021-11-16T14:01:00.912986+08:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2021-11-16T14:01:00.915857+08:00 0 [Note] InnoDB: Number of pools: 1
2021-11-16T14:01:00.916928+08:00 0 [Note] InnoDB: Not using CPU crc32 instructions
2021-11-16T14:01:00.922199+08:00 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 2, chunk size = 128M
2021-11-16T14:01:01.084893+08:00 0 [Note] InnoDB: Completed initialization of buffer pool
2021-11-16T14:01:01.624961+08:00 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-11-16T14:33:17.708704+08:00 0 [Warning] InnoDB: Resizing redo log from 2*16384 to 2*32768 pages, LSN=540672645
2021-11-16T14:33:17.832268+08:00 0 [Warning] InnoDB: Starting to delete and rewrite log files.
2021-11-16T14:33:17.863322+08:00 0 [Note] InnoDB: Setting log file .\ib_logfile101 size to 512 MB
2021-11-16T14:33:17.867049+08:00 0 [Note] InnoDB: Progress in MB:
 100 200 300 400 500
2021-11-16T14:33:18.958389+08:00 0 [Note] InnoDB: Setting log file .\ib_logfile1 size to 512 MB
2021-11-16T14:33:18.960342+08:00 0 [Note] InnoDB: Progress in MB:
 100 200 300 400 500
2021-11-16T14:33:19.871499+08:00 0 [Note] InnoDB: Renaming log file .\ib_logfile101 to .\ib_logfile0
2021-11-16T14:33:19.886435+08:00 0 [Warning] InnoDB: New log files created, LSN=540672645
2021-11-16T14:33:33.568248+08:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-11-16T14:33:33.569872+08:00 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-11-16T14:33:33.615638+08:00 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2021-11-16T14:33:33.750584+08:00 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-11-16T14:33:33.753835+08:00 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-11-16T14:33:33.757424+08:00 0 [Note] InnoDB: Waiting for purge to start
2021-11-16T14:33:33.829009+08:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 1952688ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2021-11-16T14:33:33.829605+08:00 0 [Note] InnoDB: 5.7.23 started; log sequence number 540672636
2021-11-16T14:33:33.919767+08:00 0 [Note] InnoDB: Loading buffer pool(s) from C:\ProgramData\MySQL\MySQL Server 5.7\Data\ib_buffer_pool
2021-11-16T14:33:34.025786+08:00 0 [Note] Plugin 'FEDERATED' is disabled.
2021-11-16T14:33:34.025804+08:00 0 [Note] InnoDB: Buffer pool(s) load completed at 211116 14:33:34
2021-11-16T14:33:35.322313+08:00 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2021-11-16T14:33:35.332360+08:00 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-11-16T14:33:35.334645+08:00 0 [Note] IPv6 is available.
2021-11-16T14:33:35.338263+08:00 0 [Note]   - '::' resolves to '::';
2021-11-16T14:33:35.339321+08:00 0 [Note] Server socket created on IP: '::'.
2021-11-16T14:33:40.257887+08:00 0 [Note] Event Scheduler: Loaded 0 events
2021-11-16T14:33:40.261208+08:00 0 [Note] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe: ready for connections.
Version: '5.7.23-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
-------------------------end-----------------------------------
I observed that idB files are read during startup,Is there any way to speed up MySQL startup time?

How to repeat:
Create one hundred InnoDB databases with one thousand tables in each database and use separate tablespaces
[17 Nov 2021 2:17] Shunlu Shi
Startup logs in the test environment

Attachment: WIN-3MGSNS44M7C.err (application/octet-stream, text), 93.14 KiB.

[17 Nov 2021 13:22] MySQL Verification Team
Hi Mr. Shi,

Thank you for your bug report.

However, it is not a bug.

Working with big number of schemas and tables requires careful tuning of both MySQL server and tuning of the operating system. This is fully described in our Reference Manual, practically in large number of its chapters.

Not a bug.
[18 Nov 2021 0:28] Shunlu Shi
Thanked your reply,
  I tried to adjust the MySQL configuration file and tried to use MySQL 8.0, but I didn't improve the startup speed too much.
  Maybe the system environment or disk has a greater impact on the startup speed?I will continue to refer to the manual to adjust the MySQL server.Maybe you can share some of the adjustments in the reference manual with me,Be deeply grateful.