D61762GC31 Les02
D61762GC31 Les02
D61762GC31 Les02
2-2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
MySQL Architecture
Database
PHP
mysqld TCP/IP
MySQL Server Process
TCP/IP Socket
Linux
(localhost) TCP/IP
mysql PHP ODBC
Client Client
Process Process
Windows
2-3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Client Programs
2-4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Administrative and Utility Programs
2-5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
MySQL Server
2-6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Server Process
Connection layer
mysqld
SQL layer
Storage layer
2-7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Connection Layer
Connection layer
• Communication protocols
• Threads
• Authentication
mysqld
SQL layer
Storage layer
2-8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Communication Protocols
2-9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
SQL Layer
Connection layer
SQL layer
mysqld
Storage layer
Optimize
No query
FOUND?
Execute
Yes
query
Update cache
query
Finish
Connection layer
SQL layer
mysqld
Storage layer
Disk Memory Network
• InnoDB • MEMORY • NDB
• MyISAM
• Storage medium
• Transactional capabilities
• Locking
• Backup and recovery
• Optimization
• Special features
– Full-text search
– Referential integrity
– Spatial data handling
Database Directory
(per database)
Data and Index Files
Program
Format Files (.frm) Log Files
Triggers
• Global
– Allocated once
– Shared by the server process and its threads
• Session
– Allocated for each thread
– Dynamically allocated and deallocated
– Used for handling query results
– Buffer sizes per session
• Query cache
Server/Shared
• Thread cache
• Sort buffer
Connection/
• Read buffer
Session
• Temporary table