Top Banner
<Insert Picture Here> MySQL Web Reference Architectures Building Massively Scalable Web Infrastructure Mario Beck ([email protected]) Principal Sales Consultant MySQL
30

MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

Jul 02, 2018

Download

Documents

truongminh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

<Insert Picture Here>

MySQL Web Reference ArchitecturesBuilding Massively Scalable Web Infrastructure

Mario Beck ([email protected])Principal Sales Consultant MySQL

Page 2: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

2

<Insert Picture Here>

Session Agenda

• Requirements for Innovating on the Web

• Reference Architectures• Sizing & Topologies• Enabling Technology• Best Practices

• Server Sizing• Value Added Components & Services• Resources to Get Started

Page 3: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

3

MySQL: The World’s Leading On-Line Database

Powering 9 of the top 10 most trafficked sites on the web** http://www.alexa.com/topsites

Page 4: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

4

Innovating on the WebTranslating Business Requirements to Technology Implementation

• Top Challenges• Fast Time to Market• High availability • High performance • Cost-effectively scale to meet rapidly growing demands • Open, customizable and repeatable • Protection of customer data • Low total cost of ownership

• Leverage “Best Practices”• Accelerating Time to Market with greater agility• Reducing cost, risk and complexity• Eliminate expensive “trial & error”

Page 5: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

5

MySQL Web Reference Architectures• Repeatable best practices developed with leading web

properties• Recommended architectures & topologies

• 4 x Reference Architectures• Small• Medium

• Large

• Extra Large (Social Networking)

• 4 x common platform components• User Authentication & Session Management• Content Management• eCommerce• Analytics

Page 6: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

6

Reference Architecture Sizing

Social Network

Small Medium Large Extra Large

Queries/Second <500 <5,000 10,000+ 25,000+

Transactions/Second <100 <1,000 10,000+ 25,000+

Concurrent Read Users

<100 <5,000 10,000+ 25,000+

Concurrent Write Users

<10 <100 1,000+ 2,500+

Database Size

Sessions <2 GB <10 GB 20+ GB 40+ GB

eCommerce <2 GB <10 GB 20+ GB 40+ GB

Analytics <10 GB <500 GB 1+ TB 2+ TB

Content Management <10 GB <500 GB 1+ TB 2+ TB

Page 7: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

7

Reference Architectures

Page 8: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

8

Small: Web Reference ArchitectureSocial Network

Small Medium Large Extra Large

Queries/Second <500 <5,000 10,000+ 25,000+

Transactions/Second <100 <1,000 10,000+ 25,000+

Concurrent Read Users <100 <5,000 10,000+ 25,000+

Concurrent Write Users <10 <100 1,000+ 2,500+

Database Size

Sessions <2 GB <10 GB 20+ GB 40+ GB

eCommerce <2 GB <10 GB 20+ GB 40+ GB

Analytics <10 GB <500 GB 1+ TB 2+ TB

Content Management <10 GB <500 GB 1+ TB 2+ TB

Page 9: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

9

MySQL Enterprise Monitor

MySQL Enterprise Backup

Small: Web Reference ArchitectureMySQL Master

MyS

QL

Rep

licat

ion

• Single server supporting all workloads

Members/Authentication eCommerce

Content Management Search

• Data replicated to slaves for back-up & analysis• 1st scaling step: move session management to dedicated MySQL Server• Complex to tune

Analytics

Slave 2

Backup

Slave 1

Only deploy when future traffic growth is very limited

Page 10: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

10

Medium: Web Reference ArchitectureSocial Network

Small Medium Large Extra Large

Queries/Second <500 <5,000 10,000+ 25,000+

Transactions/Second <100 <1,000 10,000+ 25,000+

Concurrent Read Users

<100 <5,000 10,000+ 25,000+

Concurrent Write Users

<10 <100 1,000+ 2,500+

Database Size

Sessions <2 GB <10 GB 20+ GB 40+ GB

eCommerce <2 GB <10 GB 20+ GB 40+ GB

Analytics <10 GB <500 GB 1+ TB 2+ TB

Content Management <10 GB <500 GB 1+ TB 2+ TB

Page 11: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

11

Medium: Web Reference ArchitectureSession Management eCommerce

MySQL Master

Content Management

Slave 1 Slave 2 Slave 3 Slave N

MySQL Master

Analytics

Slave 2Slave 1 Slave 3

MySQL Enterprise Monitor

MySQL Enterprise Backup

Memcache / Application ServersMemcache / Application Servers

Heartbeat Mechanism

XOR

Page 12: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

12

Best Practices (1)Medium Web Reference Architecture

• Each component deployed onto dedicated server & storage infrastructure• Deployed, managed and scaled independently

• Server ratio: 8 application servers to each MySQL Server• More for PHP applications, less for Java

• Add more slaves as the application tier scales

• Memcached deployed in session & content management components• Distributed memory caching layer• Reads fulfilled from cache, relieving load on the source database

servers

Page 13: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

13

Best Practices (2)Medium Web Reference Architecture

• Content Management• Each slave can handle around 3,000 concurrent

users• Each master can handle up to 30 slaves• MySQL Replication for high availability

• Can include Heartbeat, depending on application failover requirements

• Meta-data & indexing of content assets managed by MySQL

• File System & physical storage manage content assets

• Distributed file system (i.e. MogileFS)• High quality SAN (redundancy for HA)• Distributed across local storage with OS level clustering for

HA

XOR

Page 14: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

14

Best Practices (3)Medium Web Reference Architecture

• Session Management & eCommerce• Both deployed onto InnoDB storage engine• Session data maintained for up to 1 hour in a dedicated partition,

rolling partitions used to delete aged data• More users persist session data to provide greater personalization for repeat

visitors

• Data is captured in Analytics Datababase• MySQL Replication with Heartbeat for HA

• Configure semi-synchronous replication or OS-level DRBD for eCommerce

• If web traffic grows, move Session Management to MySQL Cluster• HA and in-memory data management can reduce need for external HA

mechanisms & memcached

Page 15: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

15

Large: Web Reference Architecture

Social Network

Small Medium Large Extra Large

Queries/Second <500 <5,000 10,000+ 25,000+

Transactions/Second <100 <1,000 10,000+ 25,000+

Concurrent Read Users

<100 <5,000 10,000+ 25,000+

Concurrent Write Users

<10 <100 1,000+ 2,500+

Database Size

Sessions <2 GB <10 GB 20+ GB 40+ GB

eCommerce <2 GB <10 GB 20+ GB 40+ GB

Analytics <10 GB <500 GB 1+ TB 2+ TB

Content Management <10 GB <500 GB 1+ TB 2+ TB

Page 16: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

16

Large: Web Reference ArchitectureSession Management eCommerce

MySQL Master

Content Management

Slave 1

MySQL Master

Analytics

MySQL Enterprise Monitor

Slave 2 Slave 3 Slave 4 Slave 5

Slave 6 Slave 7 Slave 8 Slave 9 Slave 10

Slave N

Slave 2

Node Group 2

F2

F4

No

de 3

No

de 4 F2

F4

Node Group 1

F1

F3

No

de 3

No

de 4 F1

F3

MySQL Cluster Data Nodes

MySQL Servers

Node Group 2

F2

F4

No

de 3

No

de 4 F2

F4

Node Group 1

F1

F3

No

de 3

No

de 4 F1

F3

MySQL Cluster Data Nodes

MySQL Servers

Slave 1 Slave 3

Data Refinery

MySQL Enterprise Backup

Memcache / Application Servers

Distributed Storage

XOR

Page 17: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

17

Large: Web Reference ArchitectureConceptual View

Geographic Replication

Wien Data Center Sidney Data Center

Session Mgmt

eCommerce

Data Refinery

Content Mgmt Analytics

Session Mgmt

eCommerce

Data Refinery

Page 18: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

18

Best Practices Large Web Reference Architecture

• Builds on best practices of Medium Web Ref Arch• Dedicated infrastructure for each workload, MySQL

Replication, Memcached, etc.

• Introduces Data Refinery• Aggregate data across the web components• Data cleansing

• Supports higher volume content management and analytics

• Builds Data Warehouse Dimensions

• Introduces MySQL Cluster• Session Management and eCommerce• 4 x Data Nodes support 6k page hits per second• Each page hit generating 8 – 12 database operations

Page 19: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

19

Extra Large: Social Network Reference Architecture

Social Network

Small Medium Large Extra Large

Queries/Second <500 <5,000 10,000+ 25,000+

Transactions/Second <100 <1,000 10,000+ 25,000+

Concurrent Read Users

<100 <5,000 10,000+ 25,000+

Concurrent Write Users

<10 <100 1,000+ 2,500+

Database Size

Sessions <2 GB <10 GB 20+ GB 40+ GB

eCommerce <2 GB <10 GB 20+ GB 40+ GB

Analytics <10 GB <500 GB 1+ TB 2+ TB

Content Management <10 GB <500 GB 1+ TB 2+ TB

Page 20: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

20

Extra Large: Social Network

Lookup

Authentication

MySQL Master

Analytics

MySQL Enterprise Monitor

Slave 2

Node Group 2

F2

F4

No

de 3

No

de 4 F2

F4

Node Group 1

F1

F3

No

de 3

No

de 4 F1

F3

MySQL Cluster Data Nodes

MySQL Servers

Slave 1 Slave 3

Data Refinery

MySQL Enterprise Backup

Node Group 2

F2

F4

No

de 3

No

de 4 F2

F4

Node Group 1

F1

F3

No

de 3

No

de 4 F1

F3

MySQL Cluster Data Nodes

MySQL Servers

App /Memcache

Servers

Central DatabasesCustomers1% – 33%

Slave 1

Slave 2 Slave N

Customers34% – 66%

Slave 1

Slave 2 Slave N

Customers67% – 100%

Slave 1

Slave 2 Slave N

Shards

Page 21: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

21

Best Practices Social Networking Reference Architecture

• Introduces Sharding• Implemented at the application layer for scaling very high volume of writes• Data divided into smaller sets, distributed across low-cost hardware

• Shards based on Hash of a single column – ie. User ID

• Sharding is complex• Recommend the Architecture and Design Consulting Engagement

• Sharding only used in a small percentage of workloads• Most Web 2.0 workloads are still read-intensive, ie record is read before

updates applied

Page 22: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

22

Server Sizing

Page 23: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

23

• MySQL 5.1: 4-8 Cores, MySQL 5.5: 16 – 24 cores for 5.5• x86_64 - 64 bit for more memory is important

- Data/Memory ration 1/3 to 1/10 to good (rule of thumb)- The more the better

• Linux or Solaris best, Windows and Unix also fine.

• RAID 10 for most, RAID 5 OK if very read intensive

• Hardware RAID battery backed up cache critical!- More disks are always better!

- 4+ recommended, 8-16 can increase IO performance if needed

• At least 2 x NICs for redundancy• Slaves should be as powerful as the Master• Oracle Sun X4170 for example

The Perfect MySQL Server

Page 24: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

24

MySQL Cluster Hardware Selection - RAM & CPU

• Storage Layer (Data nodes) • One data node can (7.0+) use 8 cores• CPU: 2 x 4 core (Nehalem works really well). Faster CPU → faster

processing of messages.• RAM: As much as you need

• RAM per Server = Data Size * Replicas * 1.25 / # Data Nodes• (data redundancy + indexes drive overall memory requirement).

• Example: 10GB database * 2 replicas * 1.25 / 2 Data Nodes =

12.5GB of RAM per data node.

• SQL Layer (MySQL Servers)• CPU: 2 – 16 cores• RAM: Not as important – 4GB enough (depends on connections and

buffers)

Page 25: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

25

Value-Added Components & Services

Page 26: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

26

• Comprehensive offering of MySQL Database, Management tools, and Oracle Lifetime Support services

Database

MySQL Enterprise Monitor

Performance Monitoring/ Alerts

Hot fixes

Service packs

MySQL Workbench

Oracle Lifetime Support

MySQL Enterprise Backup

MySQL Commercial Editions

Query Analyzer

Management Support

MySQL Cluster Manager

Page 27: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

27

MySQL Services from Oracle

• MySQL Support• Global, 24 x 7 support coverage

• MySQL Consulting• Architecture and Design• Performance Tuning• High Availability• Migration• Remote DBAs

• MySQL Training• DBAs & Developers of all levels

• Database and applications

• Developing Dynamic Web Applications

Page 28: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

28

Summary

• Reference Architectures designed as a springboard to innovating on the web

• Based on insight from most successful web properties

• Best practices & repeatable technologies for Scale & HA

• Next Step: Engage with MySQL Consulting from Oracle

Page 29: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

29

Resources

• MySQL Web Reference Architectures Whitepaper http://www.mysql.com/why-mysql/white-papers/mysql_wp_high-availability_webrefarchs.php

• Designing and Implementing Scalable Applications with MySQL & Memcached http://www.mysql.com/why-mysql/white-papers/mysql_wp_cluster_ScalingWebServices.php

• MySQL Enterprise Whitepaper http://www.mysql.com/why-mysql/white-papers/mysql_wp_enterprise_ready.php

• MySQL Cluster for Web & eCommerce Applications, Whitepaper http://www.mysql.com/why-mysql/white-papers/mysql_wp_Cluster_For_OnlineApps.php

Page 30: MySQL Web Reference Architectures - Home: DOAG … Best Practices (2) Medium Web Reference Architecture •Content Management • Each slave can handle around 3,000 concurrent users

<Insert Picture Here>

MySQL Web Reference ArchitecturesBuilding Massively Scalable Web Infrastructure