124
No Mueras de Éxito Victor Jimenez <[email protected] > Giuseppe Maxia <[email protected] > Hola, soy Víctor Jimenez, y voy a ser vuestro ponente durante los próximos 40 minutos. Tenemos el honor de contar con el único, el inigualable, el domador de bytes, el encantador de datos... Giuseppe Maxia, que nos acompaña en esta presentación.

No Mueras De Exito

Embed Size (px)

DESCRIPTION

Has creado un sitio web. Todo va bien hasta que un día tienes éxito y tu aplicación no puede aguantar tantos usuarios.Esta presentación da algunas claves de por dónde empezar a optimizar la base de datos.

Citation preview

Page 1: No Mueras De Exito

No Mueras de Éxito

Victor Jimenez <[email protected]>Giuseppe Maxia <[email protected]>

Hola, soy Víctor Jimenez, y voy a ser vuestro ponente durante los próximos 40 minutos.Tenemos el honor de contar con el único, el inigualable, el domador de bytes, el encantador de datos... Giuseppe Maxia, que nos acompaña en esta presentación.

Page 2: No Mueras De Exito

Decimos que una aplicación ha muerto de éxito, cuando se hace popular y de repente recibe más visitas de las que puede soportar.Como la gallina de los huevos de oro, todo el mundo quería tocarle los huevos...

Page 3: No Mueras De Exito

... y dijo "Ya no puedo más".Igual hace nuestro servidor, cuando recibe muchos usuarios de vez, dice "Ya no más" y se cuelga.

Page 4: No Mueras De Exito

Pasos para no morir de éxito:

•Optimizar la aplicación

•Optimizar la base de datos

•Escalar fácilmente

Si queremos que nuestra aplicación no muera de éxito, tenemos que seguir estos pasos en orden.Optimizar la aplicación: Normalmente nuestro primer código no suele ser muy óptimo.Optimizar la base de datos: Hacer que nuestra base de datos no sea un cuello de botella.Escalar fácilmente: Prepararnos para crecer en un futuro.

Page 5: No Mueras De Exito

Optimización

•Hacer más con lo mismo

•Objetivo: Aumentar consultas/sec

•¿Cómo?: Menor tiempo de ejecución

Optimizar es hacer más con lo mismo que ya tenemos.Aplicado a la base de datos, vamos a querer aumentar la cantidad de consultas que un servidor puede ejecutar.Para ello, intentaremos reducir el tiempo de ejecución de las consultas.

Page 6: No Mueras De Exito

Optimización

0s 1s 2s 3s 4s 5s 6s 7s 8s 9s

Tenemos una consulta que tarda 2,5 segundos en ejecutarse si se ejecuta sola.Pero lo normal es que esa consulta se ejecute en varios procesos en paralelo.

Page 7: No Mueras De Exito

Optimización

0s 1s 2s 3s 4s 5s 6s 7s 8s 9s

Dado que la máquina tiene más recursos ocupados, es posible que tarde más en ejecutarse.En este caso, se ha ejecutado la consulta cinco veces en paralelo, cada una un segundo más tarde que la anterior.

Page 8: No Mueras De Exito

Optimización

0s 1s 2s 3s 4s 5s 6s 7s 8s 9s

C = 5

En un momento se están ejecutando 5 consultas a la vez.El servidor necesita poder soportar estos picos.

Page 9: No Mueras De Exito

Optimización

0s 1s 2s 3s 4s 5s 6s 7s 8s 9s

C max = 1

Si optimizamos esas consultas para que tarden medio segundo...

Page 10: No Mueras De Exito

Optimización

0s 1s 2s 3s 4s 5s 6s 7s 8s 9s

C max = 1

... sólo se ejecuta una consulta cada vez.Reduciendo el nivel de concurrencia que tiene que soportar el servidor.

Page 11: No Mueras De Exito

Optimización

0s 1s 2s 3s 4s 5s 6s 7s 8s 9s

Dejando muchos más recursos libres.

Page 12: No Mueras De Exito

Optimización•Normalización

•Índices

•Cachés

•Buffers

•Actualizaciones de Software

•Mantenimiento

•Motor de Bases de datos

Hay muchas cosas que se pueden hacer para optimizar una base de datos, vamos a hablar sobre algunas de ellas.

Page 13: No Mueras De Exito

Índicestable.MYI

table.MYD

Los índices nos permiten acceder más rápido a los datos.Si indexamos una columna, se guarda una copia aparte, ordenada en una estructura de árbol.Buscar por un índice es la forma más rápida de llegar a una fila.

Page 14: No Mueras De Exito

Índices InnoDB

En Innodb los índices apuntan a la clave primaria,por tanto hay que elegir la clave primaria con sabiduría.

Page 15: No Mueras De Exito

Cachés

•MyISAM Key Cache

•Query Cache

MySQL usa varias cachés que nos permiten cargar parte de los datos en memoria,y así no leer del disco duro.

Page 16: No Mueras De Exito

MySQL server

Query Cache

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

De normal, cuando un usuario ejecuta una consulta en MySQL,MySQL tiene que interpretarla, saber qué quiere el usuario.Luego la optimiza para ver cuál es la mejor manera de ejecutarla, usar un índice u otro, aplicar una condición antes que otra...Y por último la ejecuta, para ello delega en los motores de bases de datos que interactúan directamente con los datos.Todo ello supone una cantidad considerable de trabajo.

Page 17: No Mueras De Exito

MySQL server

Query Cache

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

SELECT

De normal, cuando un usuario ejecuta una consulta en MySQL,MySQL tiene que interpretarla, saber qué quiere el usuario.Luego la optimiza para ver cuál es la mejor manera de ejecutarla, usar un índice u otro, aplicar una condición antes que otra...Y por último la ejecuta, para ello delega en los motores de bases de datos que interactúan directamente con los datos.Todo ello supone una cantidad considerable de trabajo.

Page 18: No Mueras De Exito

MySQL server

Query Cache

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

SELECT

result

De normal, cuando un usuario ejecuta una consulta en MySQL,MySQL tiene que interpretarla, saber qué quiere el usuario.Luego la optimiza para ver cuál es la mejor manera de ejecutarla, usar un índice u otro, aplicar una condición antes que otra...Y por último la ejecuta, para ello delega en los motores de bases de datos que interactúan directamente con los datos.Todo ello supone una cantidad considerable de trabajo.

Page 19: No Mueras De Exito

MySQL server

Query Cache

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

Si activamos la Query Cache,la primera vez que ejecutemos la consulta seguirá los mismos pasos.Con un paso adicional, a la vez que se devuelven los datos al usuario, se guarda una copia en la caché de consultas.

Page 20: No Mueras De Exito

MySQL server

Query CacheSELECT

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

Si activamos la Query Cache,la primera vez que ejecutemos la consulta seguirá los mismos pasos.Con un paso adicional, a la vez que se devuelven los datos al usuario, se guarda una copia en la caché de consultas.

Page 21: No Mueras De Exito

MySQL server

Query CacheSELECT

result

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

Si activamos la Query Cache,la primera vez que ejecutemos la consulta seguirá los mismos pasos.Con un paso adicional, a la vez que se devuelven los datos al usuario, se guarda una copia en la caché de consultas.

Page 22: No Mueras De Exito

MySQL server

Query Cache

SELECT result

SELECT

result

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

Si activamos la Query Cache,la primera vez que ejecutemos la consulta seguirá los mismos pasos.Con un paso adicional, a la vez que se devuelven los datos al usuario, se guarda una copia en la caché de consultas.

Page 23: No Mueras De Exito

MySQL server

Query Cache

SELECT resultQuery Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

La próxima vez que se ejecute la misma consulta,se obtendrán los datos diréctamente de la cache.Lo que es un proceso casi instantáneo.

Page 24: No Mueras De Exito

MySQL server

Query Cache

SELECT result

SELECT

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

La próxima vez que se ejecute la misma consulta,se obtendrán los datos diréctamente de la cache.Lo que es un proceso casi instantáneo.

Page 25: No Mueras De Exito

MySQL server

Query Cache

SELECT result

SELECT

result

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

La próxima vez que se ejecute la misma consulta,se obtendrán los datos diréctamente de la cache.Lo que es un proceso casi instantáneo.

Page 26: No Mueras De Exito

MySQL server

Query Cache

SELECT resultQuery Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

¿Estos datos están siempre actualizados?Sí, porque si se modifican los datos subyacentes, la caché se limpia.

Page 27: No Mueras De Exito

MySQL server

Query CacheUPDATE

SELECT resultQuery Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

¿Estos datos están siempre actualizados?Sí, porque si se modifican los datos subyacentes, la caché se limpia.

Page 28: No Mueras De Exito

MySQL server

Query CacheUPDATE

SELECT resultQuery Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

¿Estos datos están siempre actualizados?Sí, porque si se modifican los datos subyacentes, la caché se limpia.

Page 29: No Mueras De Exito

MySQL server

Query CacheUPDATE

SELECT resultQuery Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

¿Estos datos están siempre actualizados?Sí, porque si se modifican los datos subyacentes, la caché se limpia.

Page 30: No Mueras De Exito

MySQL server

Query CacheUPDATE

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

¿Estos datos están siempre actualizados?Sí, porque si se modifican los datos subyacentes, la caché se limpia.

Page 31: No Mueras De Exito

MySQL server

Query Cache

Query Cache

ParseOptimization

Execution

MyISAM InnoDB Memory

Tablas

¿Estos datos están siempre actualizados?Sí, porque si se modifican los datos subyacentes, la caché se limpia.

Page 32: No Mueras De Exito

Query Cache!"#$%&'()&$*+,-./0102,/345,$6$7$8$9:;7$8$9:;7<

!='>$%&'()&$!#)#?!$&@A"$B*0102,CB<DEEEEEEEEEEEEEEEEEEEEEEEEEDEEEEEEEEEDF$G1-41HI,/J1K,$$$$$$$$$$$F$G1I+,$$$FDEEEEEEEEEEEEEEEEEEEEEEEEEDEEEEEEEEEDF$L0102,/M-,,/HIN0O3$$$$$$F$9$$$$$$$F$F$L0102,/M-,,/K,KN-.$$$$$$F$79PQR77$F$F$L0102,/24S3$$$$$$$$$$$$$F$:$$$$$$$F$F$L0102,/4J3,-S3$$$$$$$$$$F$:$$$$$$$F$F$L0102,/INTK,K/U-+J,3$$$$F$:$$$$$$$F$F$L0102,/JNS/0102,V$$$$$$$F$:$$$$$$$F$F$L0102,/*+,-4,3/4J/0102,$F$:$$$$$$$F$F$L0102,/SNS1I/HIN0O3$$$$$F$9$$$$$$$F$DEEEEEEEEEEEEEEEEEEEEEEEEEDEEEEEEEEED

Para activar la caché de consultas, le asignamos un tamaño en la variable...Disponemos de varias variables de estado de la query cache.Importante, la Qcache_hits, que son las veces que una consulta se lee de la caché.

Page 33: No Mueras De Exito

Query Cache

?31W,$6$L0102,/24S3$X$YL0102,/24S3$D$Z'[/3,I,0S\

!='>$%&'()&$!#)#?!$&@A"$BL0102,/24S3B<DEEEEEEEEEEEEEEEEEEEEEEEEEDEEEEEEEEEDF$L0102,/24S3$$$$$$$$$$$$$F$:$$$$$$$F$DEEEEEEEEEEEEEEEEEEEEEEEEEDEEEEEEEEED

!='>$%&'()&$!#)#?!$&@A"$BZ'[/3,I,0SB<DEEEEEEEEEEEEEEEDEEEEEEEDF$ZNK/3,I,0S$$$$F$;$$$$$F$DEEEEEEEEEEEEEEEDEEEEEEED

La variable de estado COM_select muestra las consultas que se han ejecutado completamente.Así que dividiendo los aciertos de la cache entre el total de consultas que se ejecutan, obtenemos el uso de la cache.

Page 34: No Mueras De Exito

Buffers

Los bu!ers son areas de memoria que MySQL reserva temporalmente para hacer algunas operaciones,como por ejemplo ordenar los resultados de una consulta.

Page 35: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

Buffers

Al ejecutar una consulta con un ORDER BYSe leen los datos de la tabla, y se crea un bu!er en memoria para ordenar los resultados.

Page 36: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

Al ejecutar una consulta con un ORDER BYSe leen los datos de la tabla, y se crea un bu!er en memoria para ordenar los resultados.

Page 37: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

Al ejecutar una consulta con un ORDER BYSe leen los datos de la tabla, y se crea un bu!er en memoria para ordenar los resultados.

Page 38: No Mueras De Exito

Sort Buffer

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

R ESU L T

Al ejecutar una consulta con un ORDER BYSe leen los datos de la tabla, y se crea un bu!er en memoria para ordenar los resultados.

Page 39: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

Sort Buffer

BuffersSELECT ... ORDER BY ...

R E S U L T

Una vez ordenados, se devuelven al usuario.

Page 40: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

Sort Buffer

BuffersSELECT ... ORDER BY ...

R E S U L T

result

Una vez ordenados, se devuelven al usuario.

Page 41: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

Sort Buffer

Buffers

Una vez ordenados, se devuelven al usuario.

Page 42: No Mueras De Exito

Sort Buffer

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

Buffers

Si el bu!er es más reducido

Page 43: No Mueras De Exito

Sort Buffer

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

Buffers

puede que mysql no tenga espacio suficiente para realizar la ordenación

Page 44: No Mueras De Exito

Sort Buffer

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

ER SU L T

puede que mysql no tenga espacio suficiente para realizar la ordenación

Page 45: No Mueras De Exito

Sort Buffer

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

ER SU L T

puede que mysql no tenga espacio suficiente para realizar la ordenación

Page 46: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

R ESU L T

Sort Buffer

teniendo que mover los datos al disco, que es mucho más lento.Esto influirá negativamente en el rendimiento.

Page 47: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

R E S U L T

Sort Buffer

Page 48: No Mueras De Exito

MySQL server

Hard Disk

MySQL

MyISAM

table on Disk

BuffersSELECT ... ORDER BY ...

result

R E S U L T

Sort Buffer

Page 49: No Mueras De Exito

Buffers

El tamaño del bu!er está gobernado por la variable sort_bu!er_size.Por defecto es de 2MB.Cuidado con este tamaño, ya que se creará por cada consulta que debe ser ordenada.

Page 50: No Mueras De Exito

Buffers!"#$%&'()&$3N-S/H+MM,-/345,$6$];$8$9:;7<

El tamaño del bu!er está gobernado por la variable sort_bu!er_size.Por defecto es de 2MB.Cuidado con este tamaño, ya que se creará por cada consulta que debe ser ordenada.

Page 51: No Mueras De Exito

Buffers!"#$%&'()&$3N-S/H+MM,-/345,$6$];$8$9:;7<

^^$#1K1_N$UN-$ZNJ3+IS1$``

El tamaño del bu!er está gobernado por la variable sort_bu!er_size.Por defecto es de 2MB.Cuidado con este tamaño, ya que se creará por cada consulta que debe ser ordenada.

Page 52: No Mueras De Exito

Actualizaciones

Source: http://datacharmer.blogspot.com/2009/04/mysql-54-performance-with-logging.html

Algunas actualizaciones de software aumentan el rendimiento,como es el caso de MySQL 5.4, que escala mejor en máquinas con varios núcleos

Page 53: No Mueras De Exito

Actualizaciones

Source: http://dev.mysql.com/tech-resources/articles/mysql-54.html

x 1.59

Y que en algunos casos puede ser hasta un 59% más rápido que 5.1

Page 54: No Mueras De Exito

Actualizaciones

Actualizar de 5.1 a 5.4 es algo muy sencillo que puede hacer el mono de la empresa.

Page 55: No Mueras De Exito

Herramientas

•Slow-queries log

•EXPLAIN

•Enterprise Manager

Sabemos solucionar algunos problemas,¿pero cómo sabemos qué problemas tenemos?Vamos a ver algunas herramientas para detectar problemas.

Page 56: No Mueras De Exito

Slow-queries log

•Tiempo de ejecución alto

•Consultas que no están utilizando índices

El registro de consultas lentas...

Page 57: No Mueras De Exito

aK.3*IVbINWE3INTE*+,-4,3INJW/*+,-./S4K,$6$9INWE*+,-4,3EJNSE+34JWE4JV,c,3

d$K.3*IV+KU3INT$X+3-XIN01IXK.3*IXK.3*I/3INTeINW

Slow-queries log

El log de consultas lentas se activa con las opciones de configuración...long_query_time son los segundos que tiene que tardar una consulta para que se considere lenta. Por defecto son 10 segundos.Podemos ver resumido el log de consultas lentas con mysqldumpslow

Page 58: No Mueras De Exito

EXPLAIN

Con el comando EXPLAIN podemos saber qué va a hacer el optimizador...

Page 59: No Mueras De Exito

EXPLAINTN-IVf$"gh&)@i$!"&"Z#$ZNV,j$i1K,$$$$$$$$$$$$$$$$$$$$kl'[$ZN+JS-.$$$$$$$$$$$$$$$$$$$$>="l"$ZNJS4J,JS$6$B"+-NU,Bm%888888888888888888888$9e$-NT$888888888888888888888$$$$$$$$$$$4Vn$9$$3,I,0S/S.U,n$!@[h&"$$$$$$$$S1HI,n$ZN+JS-.$$$$$$$$$S.U,n$)&&UN334HI,/O,.3n$i?&&$$$$$$$$$$O,.n$i?&&$$$$$$O,./I,Jn$i?&&$$$$$$$$$$-,Mn$i?&&$$$$$$$$$-NT3n$;o;$$$$$$$$"cS-1n$?34JW$T2,-,

Con el comando EXPLAIN podemos saber qué va a hacer el optimizador...En este caso se han seleccionado los países de Europa. Explain nos dice que se va a Escanear toda la tabla (type: ALL), que no se van a utilizar todas las claves (key: NULL), y que se van a leer 252 filas (rows: 252).Si estuvieramos ordenando y usáramos el disco para ello, lo marcaría en el campo Extra como "using filesort".

Page 60: No Mueras De Exito

EXPLAINTN-IVf$"gh&)@i$!"&"Z#$ZNV,j$i1K,$$$$$$$$$$$$$$$$$$$$kl'[$ZN+JS-.$$$$$$$$$$$$$$$$$$$$>="l"$ZNV,$&@A"$B)CBm%888888888888888888888$9e$-NT$888888888888888888888$$$$$$$$$$$4Vn$9$$3,I,0S/S.U,n$!@[h&"$$$$$$$$S1HI,n$ZN+JS-.$$$$$$$$$S.U,n$-1JW,UN334HI,/O,.3n$hl@[)lp$$$$$$$$$$O,.n$hl@[)lp$$$$$$O,./I,Jn$]$$$$$$$$$$-,Mn$i?&&$$$$$$$$$-NT3n$9q$$$$$$$$"cS-1n$?34JW$T2,-,

Con esta otra consulta podemos ver que se va a usar un índice...Seleccionamos países cuyo código empieza por A.No escaneamos toda la tabla, sino un rango (type: range), los países entre Axx y Bxx.Usamos la clave primaria (key: PRIMARY), que es la columna Code.Se van a escanear sólo 18 filas (rows: 18). Que es un 5% de las consultas anteriores.

Page 61: No Mueras De Exito

Enterprise Monitor

•Disponible con MySQL Enterprise

•Monitorización de servidores

•Solución de problemas

•Query Analizer

Otra herramienta para detectar errores es el MySQL Enterprise Monitor.El Enterprise Monitor monitoriza el estado de nuestros servidores MySQL.Una de las partes del EM es Query Analizer, que analiza todas las consultas que se ejecutan en un servidor y detecta las que pueden ser problemáticas...

Page 62: No Mueras De Exito

Enterprise Monitor

MySQL Enterprise Monitor

MySQL ServerApplication

MySQL Server

Agent

Agent

Consultas SQL

Estado Servidores

¿Cómo funciona el Enterprise Manager?En un servidor tenemos la aplicación Enterprise Monitor.Por cada servidor MySQL tendremos un agente que lo irá monitorizando y enviará los datos al Enterprise Monitor.

Page 63: No Mueras De Exito

Enterprise Monitor

MySQL Enterprise Monitor

MySQL ServerApplication

MySQL Server

Agent

Agent

Consultas SQL

Estado Servidores

¿Cómo funciona el Enterprise Manager?En un servidor tenemos la aplicación Enterprise Monitor.Por cada servidor MySQL tendremos un agente que lo irá monitorizando y enviará los datos al Enterprise Monitor.

Page 64: No Mueras De Exito

Enterprise Monitor

MySQL Enterprise Monitor

MySQL ServerApplication

MySQL Server

Agent

Agent

Consultas SQL

Estado Servidores

¿Cómo funciona el Enterprise Manager?En un servidor tenemos la aplicación Enterprise Monitor.Por cada servidor MySQL tendremos un agente que lo irá monitorizando y enviará los datos al Enterprise Monitor.

Page 65: No Mueras De Exito

Enterprise Monitor

MySQL Enterprise Monitor

(Query Analizer)

MySQL ServerApplication Agent(Proxy)

MySQL ServerAgent(Proxy)

Consultas SQL

Estado Servidores Estadísticas Consultas

Para filtrar las consultas que se ejecutan en un servidor, el Agente actúa como un proxy.

Page 66: No Mueras De Exito

Enterprise Monitor

MySQL Enterprise Monitor

(Query Analizer)

MySQL ServerApplication Agent(Proxy)

MySQL ServerAgent(Proxy)

Consultas SQL

Estado Servidores Estadísticas Consultas

Para filtrar las consultas que se ejecutan en un servidor, el Agente actúa como un proxy.

Page 67: No Mueras De Exito

Enterprise Monitor

MySQL Enterprise Monitor

(Query Analizer)

MySQL ServerApplication Agent(Proxy)

MySQL ServerAgent(Proxy)

Consultas SQL

Estado Servidores Estadísticas Consultas

Para filtrar las consultas que se ejecutan en un servidor, el Agente actúa como un proxy.

Page 68: No Mueras De Exito

Escalabilidad

•Hacer más con más hardware

•Objetivo: Aumentar consultas/sec

•¿Cómo?: Aumentar concurrencia

Cuando ya no podemos sacarle más rendimiento a lo que tenemos, es hora de cambiar.Entendemos como escalabilidad al hecho de obtener más rendimiento ampliando el hardware.

Page 69: No Mueras De Exito

Escalabilidad

2GHz CPUx2 cores

2 GB RAM

100 GB HDD

Hay dos formas de escalar.La primera consiste en mejorar el servidor de la aplicación.

Page 70: No Mueras De Exito

Escalabilidad

2GHz CPUx2 cores

2 GB RAM

100 GB HDD

3GHz CPUx8 cores

8 GB RAM

Escalado Vertical 500 GB HDDx2 (RAID)

Hay dos formas de escalar.La primera consiste en mejorar el servidor de la aplicación.

Page 71: No Mueras De Exito

Escalabilidad

2GHz CPUx2 cores

2 GB RAM

100 GB HDD

De nuevo, comprar una máquina más grande es algo tan sencillo, que puede hacerlo el mono de la empresa.

Page 72: No Mueras De Exito

Escalabilidad

2GHz CPUx2 cores

2 GB RAM

100 GB HDD

Otra forma de escalar consiste en comprar más máquinas igules a las que ya tenemos.Y sobre ellas, ejecutar algún servicio que aproveche varias máquinas.Como la replicación.

Page 73: No Mueras De Exito

Escalabilidad

2GHz CPUx2 cores

2 GB RAM

100 GB HDD

Escalado Horizontal

2GHz CPU

x2 cores

2 GB RAM

2GHz CPUx2 cores

2 GB RAM

100 GB HDD 100 GB HDD

Otra forma de escalar consiste en comprar más máquinas igules a las que ya tenemos.Y sobre ellas, ejecutar algún servicio que aproveche varias máquinas.Como la replicación.

Page 74: No Mueras De Exito

Escalabilidad

2GHz CPUx2 cores

2 GB RAM

100 GB HDD

Escalado Horizontal

2GHz CPU

x2 cores

2 GB RAM

2GHz CPUx2 cores

2 GB RAM

100 GB HDD 100 GB HDD

MySQL Master MySQL Slave MySQL Slave

Otra forma de escalar consiste en comprar más máquinas igules a las que ya tenemos.Y sobre ellas, ejecutar algún servicio que aproveche varias máquinas.Como la replicación.

Page 75: No Mueras De Exito

Replicación

MySQL Master

Binary Log

Tabla

MySQL Slave

Tabla

Tenemos un servidor Maestro y uno esclavo.Se inserta en el maestro, y se registra en el log binarioPeriódicamente, el esclavo pedirá los últimos cambios al MaestroConforme los reciba, los aplicará en sus tablasEl resultado es que tanto el maestro como el esclavo mantienen los mismos datos

Page 76: No Mueras De Exito

Replicación

MySQL Master

INSERT

Binary Log

Tabla

MySQL Slave

TablaINSERT

Tenemos un servidor Maestro y uno esclavo.Se inserta en el maestro, y se registra en el log binarioPeriódicamente, el esclavo pedirá los últimos cambios al MaestroConforme los reciba, los aplicará en sus tablasEl resultado es que tanto el maestro como el esclavo mantienen los mismos datos

Page 77: No Mueras De Exito

Replicación

MySQL Master

INSERT

Binary Log

Tabla

INSERT

MySQL Slave

TablaINSERT

Tenemos un servidor Maestro y uno esclavo.Se inserta en el maestro, y se registra en el log binarioPeriódicamente, el esclavo pedirá los últimos cambios al MaestroConforme los reciba, los aplicará en sus tablasEl resultado es que tanto el maestro como el esclavo mantienen los mismos datos

Page 78: No Mueras De Exito

Replicación

MySQL Master

Binary Log

Tabla

INSERT

MySQL Slave

TablaINSERT

Tenemos un servidor Maestro y uno esclavo.Se inserta en el maestro, y se registra en el log binarioPeriódicamente, el esclavo pedirá los últimos cambios al MaestroConforme los reciba, los aplicará en sus tablasEl resultado es que tanto el maestro como el esclavo mantienen los mismos datos

Page 79: No Mueras De Exito

Replicación

MySQL Master

Binary Log

Tabla

INSERT

MySQL Slave

TablaINSERT INSERT

Tenemos un servidor Maestro y uno esclavo.Se inserta en el maestro, y se registra en el log binarioPeriódicamente, el esclavo pedirá los últimos cambios al MaestroConforme los reciba, los aplicará en sus tablasEl resultado es que tanto el maestro como el esclavo mantienen los mismos datos

Page 80: No Mueras De Exito

Replicación

MySQL Master

Binary Log

Tabla

INSERT

MySQL Slave

TablaINSERT INSERT

Tenemos un servidor Maestro y uno esclavo.Se inserta en el maestro, y se registra en el log binarioPeriódicamente, el esclavo pedirá los últimos cambios al MaestroConforme los reciba, los aplicará en sus tablasEl resultado es que tanto el maestro como el esclavo mantienen los mismos datos

Page 81: No Mueras De Exito

ReplicaciónMySQL Master

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

Podemos aplicar la replicación en el caso de una aplicación con mucha carga de lectura.En ese caso, tendremos un esclavo donde se realizarán las modificaciones de datos.Y varios esclavos para consultar datos.

Page 82: No Mueras De Exito

ReplicaciónMySQL MasterINSERT

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

Podemos aplicar la replicación en el caso de una aplicación con mucha carga de lectura.En ese caso, tendremos un esclavo donde se realizarán las modificaciones de datos.Y varios esclavos para consultar datos.

Page 83: No Mueras De Exito

ReplicaciónMySQL Master

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

MySQL Slave

SELECT

Podemos aplicar la replicación en el caso de una aplicación con mucha carga de lectura.En ese caso, tendremos un esclavo donde se realizarán las modificaciones de datos.Y varios esclavos para consultar datos.

Page 84: No Mueras De Exito

Replicación Circular

1MySQL Master for 2MySQL Slave for 3

2MySQL Master for 3MySQL Slave for 1

3MySQL Master for 1MySQL Slave for 2

Se puede realizar una replicación circular si un esclavo replica cambios a un maestro.Así podríamos soportar aplicaciones con cargas altas de escritura y lectura,o podemos distribuír geográficamente nuestros datos.

Page 85: No Mueras De Exito

MySQL Cluster

Otra forma de escalar horizontalmente es MySQL Cluster...Tenemos los nodos de datos... Un nodo de gestión... Varios servidores MySQL...Al insertar una fila... es el servidor MySQL en encargado de guardada en el cluster.MySQL Cluster nos deja escalar añadiendo nodos en caliente...MySQL Cluster escala muy bien y ofrece muy alta disponibilidad, pero requiere muchas máquinas para funcionar.

Page 86: No Mueras De Exito

MySQL ClusterMySQL Cluster

NDB

NDB

NDB

NDB

NDBNDB

Otra forma de escalar horizontalmente es MySQL Cluster...Tenemos los nodos de datos... Un nodo de gestión... Varios servidores MySQL...Al insertar una fila... es el servidor MySQL en encargado de guardada en el cluster.MySQL Cluster nos deja escalar añadiendo nodos en caliente...MySQL Cluster escala muy bien y ofrece muy alta disponibilidad, pero requiere muchas máquinas para funcionar.

Page 87: No Mueras De Exito

MySQL ClusterMySQL Cluster

NDB

NDB

NDB

NDB

NDBNDB

Management

Otra forma de escalar horizontalmente es MySQL Cluster...Tenemos los nodos de datos... Un nodo de gestión... Varios servidores MySQL...Al insertar una fila... es el servidor MySQL en encargado de guardada en el cluster.MySQL Cluster nos deja escalar añadiendo nodos en caliente...MySQL Cluster escala muy bien y ofrece muy alta disponibilidad, pero requiere muchas máquinas para funcionar.

Page 88: No Mueras De Exito

MySQL ClusterMySQL Cluster

NDB

NDB

NDB

NDB

NDBNDB

Management

MySQL

MySQL

MySQL

Otra forma de escalar horizontalmente es MySQL Cluster...Tenemos los nodos de datos... Un nodo de gestión... Varios servidores MySQL...Al insertar una fila... es el servidor MySQL en encargado de guardada en el cluster.MySQL Cluster nos deja escalar añadiendo nodos en caliente...MySQL Cluster escala muy bien y ofrece muy alta disponibilidad, pero requiere muchas máquinas para funcionar.

Page 89: No Mueras De Exito

MySQL ClusterMySQL Cluster

NDB

NDB

NDB

NDB

NDBNDB

Management

INSERT

INSERT INSERT

MySQL

MySQL

MySQL

Otra forma de escalar horizontalmente es MySQL Cluster...Tenemos los nodos de datos... Un nodo de gestión... Varios servidores MySQL...Al insertar una fila... es el servidor MySQL en encargado de guardada en el cluster.MySQL Cluster nos deja escalar añadiendo nodos en caliente...MySQL Cluster escala muy bien y ofrece muy alta disponibilidad, pero requiere muchas máquinas para funcionar.

Page 90: No Mueras De Exito

MySQL ClusterMySQL Cluster

NDB

NDB

NDB

NDB

NDBNDB

Management

INSERT

INSERT INSERT

MySQL

MySQL

MySQL

NDBNDB

Otra forma de escalar horizontalmente es MySQL Cluster...Tenemos los nodos de datos... Un nodo de gestión... Varios servidores MySQL...Al insertar una fila... es el servidor MySQL en encargado de guardada en el cluster.MySQL Cluster nos deja escalar añadiendo nodos en caliente...MySQL Cluster escala muy bien y ofrece muy alta disponibilidad, pero requiere muchas máquinas para funcionar.

Page 91: No Mueras De Exito

Hemos visto muchas cosas para optimizar un servidor mysql...Un consejo... ¡¡¡ No toques el servidor de producción !!!Por muchos motivos...

Page 92: No Mueras De Exito

¡¡¡ No toques producción !!!

Hemos visto muchas cosas para optimizar un servidor mysql...Un consejo... ¡¡¡ No toques el servidor de producción !!!Por muchos motivos...

Page 93: No Mueras De Exito

Preparar la migración

•Entorno de pruebas

•Posibilidad de volver atrás

Lo recomendable es probar las cosas siempre en un entorno controlado donde podamos volver atrás.Para este entorno de pruebas, podemos usar MySQL Sandbox.

Page 94: No Mueras De Exito

MySQL Sandbox•one (unix) host

•many database servers

•single or multiple sandboxes

•installs IN SECONDS

•Free software (GPL)

http://mysqlsandbox.net

MySQL Sandbox is a tool that installs an additional MySQL server in a few seconds.You can have more than one database servers in your host, all of them independent from each other. Installing a new server with MySQL Sandbox is a matter of seconds. You can install either a single sandbox or a system including multiple ones.It is free software, and it works on most every unix system.http://www.slideshare.net/datacharmer/mysql-sandbox-quick-demo

Page 95: No Mueras De Exito

1 host - many servers

HOST

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 96: No Mueras De Exito

1 host - many servers

HOST

5.0.83

single

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 97: No Mueras De Exito

1 host - many servers

HOST

5.0.83

single

5.1.35

single

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 98: No Mueras De Exito

1 host - many servers

HOST

5.0.83

single

5.1.35

single

5.4.1single

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 99: No Mueras De Exito

1 host - many servers

HOST

5.0.83

single

5.1.35

single

5.4.1single

master

slave slave

5.0.82

standardreplication

5.0.825.0.82

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 100: No Mueras De Exito

1 host - many servers

HOST

5.0.83

single

5.1.35

single

5.4.1single

5.1.35

5.4.15.0.83

group

master

slave slave

5.0.82

standardreplication

5.0.825.0.82

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 101: No Mueras De Exito

1 host - many servers

HOST

5.0.83

single

5.1.35

single

5.4.1single

5.1.34

5.1.34

5.1.345.1.34

circularreplication

5.1.35

5.4.15.0.83

group

master

slave slave

5.0.82

standardreplication

5.0.825.0.82

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 102: No Mueras De Exito

1 host - many servers

HOST

5.0.83

single

5.1.35

single

5.4.1single

5.1.34

5.1.34

5.1.345.1.34

circularreplication

5.1.35

5.4.15.0.83

group

master

slave slave

5.0.82

standardreplication

5.0.825.0.82

ALL

INDEPENDENT

When you need to test enterprise software, the database is a core component. For this, it's important to be able to have test database servers in your host. You want to be able to test in di!erent conditions, possibly with di!erent versions.With MySQL Sandbox, it's easy to create single servers of di!erent versions, or a replicated system with master and salves, or a group of servers with various versions, or a circular replication system. You can have all of them, one by one , or all at once, and they will not interfere with each other.

Page 103: No Mueras De Exito

Installation

•as root

!"#$%&"'()*+,,)%&-./0

Installing MySQL Sandbox is easy. It is a Perl module. Getting it in your server is just a matter of typing one commend as root.If you want, you can also install in the user space. The reference manual explains how to do it.

Page 104: No Mueras De Exito

Creating a single sandbox

•as normal user

!"1%2345%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

Let's make your first sandbox. It's as simple as saying "make_sandbox" and the name of a MySQL tarball.This will expand the tarball and create a sandbox very fast.If you have already expanded the tarball in a predefined directory, you can call "make_sandbox" with the simplified syntax.It is FAST!

Page 105: No Mueras De Exito

Creating a single sandbox

•as normal user

!"1%2345%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

•if you have expanded tarballs already

Let's make your first sandbox. It's as simple as saying "make_sandbox" and the name of a MySQL tarball.This will expand the tarball and create a sandbox very fast.If you have already expanded the tarball in a predefined directory, you can call "make_sandbox" with the simplified syntax.It is FAST!

Page 106: No Mueras De Exito

Creating a single sandbox

•as normal user

!"1%2345%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

•if you have expanded tarballs already

!"1%2345%&-./0"=>?>@=

Let's make your first sandbox. It's as simple as saying "make_sandbox" and the name of a MySQL tarball.This will expand the tarball and create a sandbox very fast.If you have already expanded the tarball in a predefined directory, you can call "make_sandbox" with the simplified syntax.It is FAST!

Page 107: No Mueras De Exito

Creating a single sandbox

•as normal user

!"1%2345%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

•if you have expanded tarballs already

!"1%2345%&-./0"=>?>@=

< 10 seconds!

Let's make your first sandbox. It's as simple as saying "make_sandbox" and the name of a MySQL tarball.This will expand the tarball and create a sandbox very fast.If you have already expanded the tarball in a predefined directory, you can call "make_sandbox" with the simplified syntax.It is FAST!

Page 108: No Mueras De Exito

Creating a replication sandbox

•as normal user

!"1%234G3$;H#%8H/&45%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

Creating a replication system is equally easy. If you have ever set up MySQL replication servers you know that it is not extremely complicated, but the chances of making mistakes are quite a lot. Using MySQL Sandbox, you can create a replication system as easoly as you make a single one. And you will be surprised at how fast it is!

Page 109: No Mueras De Exito

Creating a replication sandbox

•as normal user

!"1%234G3$;H#%8H/&45%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

•if you have expanded tarballs already

Creating a replication system is equally easy. If you have ever set up MySQL replication servers you know that it is not extremely complicated, but the chances of making mistakes are quite a lot. Using MySQL Sandbox, you can create a replication system as easoly as you make a single one. And you will be surprised at how fast it is!

Page 110: No Mueras De Exito

Creating a replication sandbox

•as normal user

!"1%234G3$;H#%8H/&45%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

•if you have expanded tarballs already

!"1%234G3$;H#%8H/&45%&-./0"=>?>@=

Creating a replication system is equally easy. If you have ever set up MySQL replication servers you know that it is not extremely complicated, but the chances of making mistakes are quite a lot. Using MySQL Sandbox, you can create a replication system as easoly as you make a single one. And you will be surprised at how fast it is!

Page 111: No Mueras De Exito

Creating a replication sandbox

•as normal user

!"1%234G3$;H#%8H/&45%&-./0"6

"""7$%8978/71(5:;<=>?>@=<ABCDB)>EF

•if you have expanded tarballs already

!"1%234G3$;H#%8H/&45%&-./0"=>?>@=

< 20 seconds!

Creating a replication system is equally easy. If you have ever set up MySQL replication servers you know that it is not extremely complicated, but the chances of making mistakes are quite a lot. Using MySQL Sandbox, you can create a replication system as easoly as you make a single one. And you will be surprised at how fast it is!

Page 112: No Mueras De Exito

SHORTCUT - Creating and Using a sandbox

Starting with MySQL Sandbox 3.0.04, there is also a shortcut script that can make your life much easier.You can create a sandbox and use it with a very short command.You need to try it to believe it.

Page 113: No Mueras De Exito

SHORTCUT - Creating and Using a sandbox

•as normal user (requires version 3.0.04)

Starting with MySQL Sandbox 3.0.04, there is also a shortcut script that can make your life much easier.You can create a sandbox and use it with a very short command.You need to try it to believe it.

Page 114: No Mueras De Exito

SHORTCUT - Creating and Using a sandbox

•as normal user (requires version 3.0.04)

!"5."=>I>J@

Starting with MySQL Sandbox 3.0.04, there is also a shortcut script that can make your life much easier.You can create a sandbox and use it with a very short command.You need to try it to believe it.

Page 115: No Mueras De Exito

SHORTCUT - Creating and Using a sandbox

•as normal user (requires version 3.0.04)

!"5."=>I>J@

< 5 seconds!

Starting with MySQL Sandbox 3.0.04, there is also a shortcut script that can make your life much easier.You can create a sandbox and use it with a very short command.You need to try it to believe it.

Page 116: No Mueras De Exito

exampleK"1%2345%&-./0"=>I>JL"M>>>N>"5%&-./0"53GO3G"58%G83-A/PG"5%&-./0"53GO3G"Q%5"H&58%;;3-"H&"K)RSTUBV4WB'X715.4=4I4JL

K"K)RSTUBV4WB'X715.4=4I4JL7P53"6"""<3"Y53;3#8"O3G5H/&Z[Y\<<<<<<<<<<<\]"O3G5H/&Z["]\<<<<<<<<<<<\]"=>I>JL""""]"\<<<<<<<<<<<\

Here's an example of a single sandbox. First you create it. MySQL Sandbox will show you what it's doing and ask for confirmation. This will take a few seconds. Once the sandbox has been created, you can use it immediately. No need to remember complicated options. The sandbox includes scripts to use it easily, as you see in the screen. Just say "use", and it will invoke the mysql command line with all the necessary options, which you don't have to remember

Page 117: No Mueras De Exito

example (shortcut)

K"8H13"5."=>I>JL"<3"Y53;3#8"O3G5H/&Z[YM>>>N>"5%&-./0"53GO3G"58%G83-A/PG"5%&-./0"53GO3G"Q%5"H&58%;;3-"H&"K)RSTUBV4WB'X715.4=4I4JL\<<<<<<<<<<<\]"O3G5H/&Z["]\<<<<<<<<<<<\]"=>I>JL""""]"\<<<<<<<<<<<\

G3%;" I1L>I^?5P53G" I1I>L_I55(5"I1I>L?I5

The same two tasks that you have seen in the previous slide can be achieved at once with the new shortcut.One single command that creates the sandbox and lets you use it.This timing is in my laptop. Using a powerful server will be even faster.

Page 118: No Mueras De Exito

example replication K"1%234G3$;H#%8H/&45%&-./0"=>I>JL"M>>>NG3$;H#%8H/&"-HG3#8/G("H&58%;;3-"/&"K)RSTUBV4WB'X7G5%&-./04=4I4JL

K"K)RSTUBV4WB'X7G5%&-./04=4J4JL71"6""<3"Y53;3#8"O3G5H/&Z[Y

\<<<<<<<<<<<\]"O3G5H/&Z["]\<<<<<<<<<<<\]"=>I>JL""""]"\<<<<<<<<<<<\

Creating a replication system is similar. Just use the make_replication_sandbox script instead of make_sandbox, and the program will take care of all the details.Inside a replication sandbox you will have one sandbox for the master and one for each slave. No need to remember which is which. The sandbox o!ers a shortcut script for each role. "m" is for master, "s1" for the first slave, and so on.

Page 119: No Mueras De Exito

example replication(shortcut)

K"8H13"5."G=>I>JL"<3"Y53;3#8"O3G5H/&Z[YM>>>NG3$;H#%8H/&"-HG3#8/G("H&58%;;3-"H&"KWB'X7G5%&-./04=4I4JL\<<<<<<<<<<<<\]"O3G5H/&Z[""]\<<<<<<<<<<<<\]"=>I>JL<;/E"]"\<<<<<<<<<<<<\

G3%;" I1^>`JL5P53G" I1I>a_=55(5"I1I>=J=5

You can use the shortcut script for the replication as well.Here's an example of such call. You will invoke sb, followed by an "r" and the version number. The shortcut script will do everything for you. Create a replication system and then invoke the master.

Page 120: No Mueras De Exito

more control with replication

K"#-"K)RSTUBV4WB'X7G5%&-./04=4J4JLK">7P534%;;"Y)X+Xbc"dd53GO3G4H-Y!"1%583G""dd53GO3G4H-?!"53GO3G,"?,"dd53GO3G4H-?I?!"53GO3G,"L,"dd53GO3G4H-?IL

For multiple sandboxes, you have additional scripts. There are scripts for starting, stopping, and cleaning up all the depending sandboxes at once. And there is a script that lets you tun the same SQL statement in all the nodes. In this example, you see the query "SELECT @@server_id" executed by the master and the slaves in sequence.

Page 121: No Mueras De Exito

Self contained•All sandboxes are created inside

$SANDBOX_HOME

•Use all at once

•Great control

http://mysqlsandbox.netUsing MySQL Sandbox servers is safe and easy. Stopping and starting all the servers at once is a simple script call. Since all sandboxes are under the same tree, it's also easy to keep track of storage.There is much more that you can do. Check the MySQL Sandbox site for the reference manual and a detailed cookbook with practical guidance.

Page 122: No Mueras De Exito

Pasos para no morir de éxito:

•Optimizar la aplicación

•Optimizar la base de datos

•Escalar fácilmente

A modo de resúmen, unos pasos para mejorar el rendimiento en una aplicación.

Page 123: No Mueras De Exito

¡Gracias!

No Mueras de Éxito Víctor Jiménez <[email protected]>

Giuseppe Maxia <[email protected]>

http://mysql.com/products/enterprisehttp://mysqlsandbox.net

http://mysql.com/traininghttp://www.warp.es

The Chicken and the monkey are licensed under Public Domain, find them in:http://openclipart.org/media/people/johnny_automatic

Muchas gracias, podéis encontrar más información en...Este tema está tratado más en profundidad en los cursos de PT y HA...

Page 124: No Mueras De Exito

Q & A