Documente Academic
Documente Profesional
Documente Cultură
Franz Haberhauer
Chief Technologist & Principal Engineer Sun Microsystems GmbH
Overview of MySQL
11 million product installations 50,000 downloads each day Part of the rapidly growing open source LAMP stack Reduces Database TCO by 90% MySQL Enterprise is our Commercial Offering
Gartner 2006
Source: Gartner
Applications
OEM / ISV's
Telecommunications
Enterprise 2.0
MySQL Architecture
MySQL Enterprise
Knowledge base
Service packs
9
Leveraging unique features in Solaris for MySQL: ZFS & DTrace Leveraging Solaris as stable enterprise OS on x86/x64 and SPARC systems
10
Fotolog
Application Photo sharing and social networking site. Top 50 most trafficked sites on the Internet. Key Business Benefit Scaled Fotolog site to 17 million members and 500 million photos using existing architecture Why MySQL & Sun? - Big Performance Improvement using Sun SPARC Enterprise T5120 Servers - Significantly reduced power consumption
Optimizing MySQL and InnoDB on Solaris 10 for World's Largest Photo Blogging Community Farhan Mashraqi, Director of Database Infrastructure forge.mysql.com/wiki/MySQLConf2008ThursdayNotes
Sun Servers were our dream come true in terms of power consumption. Our investment in theT1000 and T2000 Servers have really paid off. Frank Mash, Director IT Operations
11
Mem
... we can scale horizontally, and we can scale vertically. And we don't have to change one line of our software code to run dual-core, quad-core, or sixteen-core machines ... Jean-Luc Vaillant, CTO, LinkedIn
http://www.sun.com/customers/servers/linkedin.xml
OS Instances
Network Switch
12
Enterprises, Business Critical Applications Unsurpassed Support > 10+ Years Long Release Cycles > 3-5 Years with Quarterly Updates
Project Indiana Developers, Early Adopter Latest Innovations Short Release Cycles > semiannually
13
every 2 weeks
snv_99, snv_100, ...
every 6 months
2008.05, 2008.11, ...
Solaris 10
Download or media kit Long term release and support cycles
> Optimized builds > Currently using gcc, soon using Sun Studio 12 > Link in or preload libmtmalloc
> LD_PRELOAD_64=/usr/lib/amd64/libmtmalloc.so (for x64)
16
17
18
GlassFish Application Server Apache 2.2.x mod_proxy/ mod_jk Interoperability with NetBeans and GlassFish App Server, Tomcat
19
20
# svccfg svc>select mysql:version_50 svc:/application/database/mysql:version_50>setprop mysql/enable_64bit=true # svcadm refresh mysql # svcadm enable mysql
Dynamically configured properties mysql/bin Installation , Default : /usr/mysql/5.0/bin mysql/data Data Directory , Default: /var/mysql/5.0/data mysql/enable_64bit Flag to select 32bit or 64bit , Default : false
21
ZFS
With check-summing and copy-on-write transactions. Integrated fault management across abstraction layers.
Easier Administration
ZFS
ZFS
A pooled storage model no volume manager. Snapshots, clones, compression, filesystem quota and reservations included. Part of Solaris 10 and OpenSolaris now also for root file system
Architected for speed today's disk characteristics. Enables transparent use of SSDs.
22
May use compression > safe I/Os, not just disk space Transactional nature of ZFS obsoletes the need for InnoDB double write buffer More on http://dev.mysql.com/tech-resources/articles/mysql-zfs.html
23
24
> With MyISAM create separate ZFS Intent Log (ZIL) for WAL
# zpool create p <pool devices> mirror c1t10d0 c1t11d0 \
> before Solaris 10 10/08 use separate zpools for data and log (WAL)
= #bytes in /etc/system
25
MySQL on UFS
from http://dev.mysql.com/tech-resources/articles/mysql-zfs.html
need forcedirectio for UFS MyISAM caches indexes only > Relies on UFS buffercache for data caching
26
Sun Studio Compiler Options for MySQL on Solaris 10 x64 OS : Performance Study
> http://blogs.sun.com/krishs/entry/sun_studio_compiler_options_for1
27
DTrace
# dtrace -n 'syscall::write:entry/execname == "iotest"/{@ = quantize(arg2)}'
value 0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 ------------- Distribution ------------- count | 0 |@ 48 | 1 |@ 26 |@ 43 |@@@ 115 |@@ 82 | 13 | 7 |@@ 73 | 5 | 16 | 7 | 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1280 | 0
a.d
b.d
DTrace Consumer plockstat(1M) Userland Kernel DTrace mib Provider ... fbt
dtrace(1M)
DTrace
sysinfo lockstat vminfo syscall sdt
28
DTrace Tools
Collection of useful scripts and oneliners great introduction http://www.BrendanGregg.com/dtrace.html OpenSolaris Community: DTrace (DTrace Scripts, DTrace Toolkit, DExplorer) > http://opensolaris.org/os/community/dtrace/ /usr/demo/dtrace
dappprof profiles user and library function usage
# dappprof -ceoT banner hello # # # # ###### # # # # # # CALL __fsr main banprt banner banset convert banfil TOTAL: CALL banset banfil convert banner __fsr banprt TOTAL: CALL banset convert banfil __fsr banner banprt TOTAL: ###### # ##### # # ###### # # # # # ###### # # # # # ###### # # # # #### # # # #
####
COUNT 1 1 1 1 1 5 5 15 ELAPSED 38733 150280 152113 907212 1695068 1887674 4831080 CPU 7710 9566 11931 15199 52685 776429 873520
Plot of iosnoop output iosnoop traced output from tar -cvf /dev/null /var
29
31
DTrace in MySQL
Instrumenting MySQL with DTrace statically defined probes DTrace will allow performance and trace monitoring > Monitor execution time for
> SELECT, INSERT, UPDATE, DELETE and variants > Total query execution time > Time in locks
> Lock triggers/types > Filesort exection/time > Query Cache hits/misses
MySQL 6.0 will include an extended set of probes MySQL 5.1 will have a patch for the same probes
32
DTrace Example
Comparing execution for SELECT, 50 million rows
QC Dur ms 0 0 0 0 0 0 0 0 8289 0 0 0 8290 331594 0 Matched 0 0 0 0 20 0 0 0 Changed 0 0 0 0 Query select @@version_comment limit 1 SELECT DATABASE() show databases show tables Filesort for select * from s where i > 10 order by i limit 20 0 select * from s where i > 10 order by i limit 20 0 create index si on s (i) 0 select * from s where i > 10 order by i limit 20
33
DTrace Benefits
Dtrace is passive Always available Low overhead to get the information No overhead if you dont use it Allows you to trace and monitor any time Or monitor constantly and highlight
34
Solaris Containers
Virtual application environments within a single OS instance Zones Isolation - Security - Faults - Licensing + Resource Management - CPU, Memory
192.9.9.1
Network
192.9.9.2
192.9.9.3
www
store 192.9.9.4
appserver
Global Zone
Independent Users Separate Networks Independent Storage Isolated Containers
35
Effectively use MySQL on systems with many cores (CMT) > Run multiple instances of MySQL on one system
> one instance per zone > easy setup
36
MySQL Cluster
Transactional database for fast, always-on access to data under high throughput conditions > Scale-out architecture > Most often used as in-memory database
> can be configured to use disk-based data as well > uses NDB storage engine
Setting Up MySQL Cluster Software Using Solaris Zones Partitioning Technology > Hashamkha Pathan, August 2008
> http://www.sun.com/bigadmin/features/articles/mysql_cluster_zones.jsp
37
Solaris Cluster
Proven HA solution
> 10+ years in the enterprise > Wide and varied customer install base
Solaris Cluster
> Cross platform (SPARC/x64) > Deeply integrated with Solaris kernel
> e.g. for cluster membership management, disk fencing Shared storage, shared nothing Active-active and active-passive Failover between Solaris Containers Open sourced as Open HA Cluster http://www.sun.com/cluster
38
> connect to the MySQL instance mysqladmin command with argument ping > if instance is slave configuration check whether instance is connected to its master > verify that the probe can list all databases and tables (not contents) > function test defined test-database Create Table, Insert into Table, Update Table, Delete from Table and Drop Table > Automatic action upon failure: restart, failover > Sun Cluster Data Service for MySQL Guide for Solaris OS > http://docs.sun.com/app/docs/doc/820-2571 > Deployment and Failover Study of HA MySQL on a Solaris Cluster > http://blogs.sun.com/krishs/entry/deployment_and_failover_study_of
39