3. • Qué es la plataforma de instancias EC2 y una
pequeña cartilla sobre virtualización.
• Cómo obtener lo máximo de su experiencia con
EC2 desde la lente de tres tipos de instancias?
• Cómo pensar sobre el futuro de las instancias
EC2
Agenda
9. Cartilla en virtualización: x86 CPU
• Antes de Intel VT-x
– Traducción binaria
– Para-virtualization (PV)
• Luego de Intel VT-x
– Virtualización asistida por hardware (HVM)
• PV vs. HVM Amazon Machine Images
• Opciones de agendamiento vCPU y variabilidad
11. Cartilla en virtualización: I/O and Devices
• Agendamiento de I/O requests entre
dispositivos virtuales y hardware físico
compartido
• Modelo de driver separado para dispositivos
compartidos; requiere recursos de host
• Intel VT-d
– Direct pass through y IOMMU para dispositivos dedicados
12. Nuestra filosofía
• Más grande, más rápido, más
económico, consistente y flexible
• Nuestro objetivo en performance es el
bare metal
• Los clientes nos ayudan a priorizar
nuestro roadmap
• Mirada bajo el capó a través de la lente
de tres nuevas plataformas: C4, T2 e I2
15. Instancias T2: Resumen
• Instancias EC2 de bajo costo. Hasta $0.013 por
hora.
• Performance Variable vs. Fijo
Name vCPUs
Baseline
Performance
Platform RAM (GiB)
CPU Credits /
Hour
t2.micro 1 10% 32-bit or 64-bit 1 6
t2.small 1 20% 32-bit or 64-bit 2 12
t2.medium 2 40% 32-bit or 64-bit 4 24
t2.large 2 60% 64-bit 8 36NEW!
16. Tip: Entienda cómo funcionan los créditos de CPU
• http://aws.amazon.com/blogs/aws/low-cost-
burstable-ec2-instances/
• http://aws.amazon.com/ec2/instance-types/t2/
• Attend this session
17. Cómo funcionan los créditos?
Baseline Rate
Credit
Balance
• Un crédito de CPU provee el
performance de un core de CPU
completo por un minuto.
• Una instancia gana créditos de
CPU a una tasa constante.
• Una instancia consume los
créditos cuando está activa.
• Los créditos expiran (desbordan)
en el tiempo.
Burst
Rate
18. Los créditos de CPU
• Un crédito de CPU provee el performance de un
core de CPU completo por un minuto.
• Se provee con una balance inicial de créditos
para una buena experiencia durante el
arranque.
• Se usan créditos cuando se está activo y se
acumulan cuando se está en reposo.
• Transparentes con los balances de créditos.
23. Tip: Use el kernel 3.8+
• Amazon Linux 13.09 or later
• Ubuntu 14.04 or later
• RHEL7 or later
• Etc.
24. Antes de los Kernels -3.8.0
• Todos los I/O deben pasar a través del I/O Domain
• Requiere un “grant mapping” antes del kernel 3.8.0
• Grant mappings son operaciones costosas debido a los TLB flushes
read(fd, buffer, BLOCK_SIZE)
25. 3.8.0+ Kernels – Persistente e indirecto
• Grant mappings son definidos por grupos una sola vez
• La data es copiada desde y hacia el grant pool
• El copiado es significativamente más rápido que el re mapeo
read(fd, buffer, BLOCK_SIZE)
27. SSDs y Wear Leveling
• FLASH tiene un número limitado de escrituras por
cada sector físico
– Los sectores se degradan; deben ser borrados antes de re escribir
en ellos
– Borrar coloca a todo 1s, lo que es lento
• Los firmware modernos son muy sofisticados para
extender la vida de FLASH
• TRIM y/o over provisioning ayuda a evitar el
garbage collection y el write amplification
28. Capa de traducción Flash
• Todas las escrituras van al TAIL
• Escritas aleatorias == Escritas secuenciales
• Desgaste homogéneo de los sectores (Wear Leveling)
HEAD
TAIL
29. Garbage Collection
• Nuevas escrituras tienen que buscar espacio disponible.
• Resulta en pausas de garbage collection
• Grandes escrituras pueden requerir desfragmentación.
HEAD
TAIL
33. Por qué PV-HVM es más rápido que PV
• PV-HVM permite al Application llamar directamente al Kernel
• PV requiere ir a través del VMM
• Las aplicaciones que son restrictas a llamadas del sistema son
las más afectadas.
Kernel
Application
Kernel
Application
VMM
Application
VMM
Kernel
Bare Metal PV-HVM PV
35. Manteniendo el tiempo
• Llevar el tiempo en una instancia es engañosamente difícil
• gettimeofday(), clock_gettime(), QueryPerformanceCounter()
• El TSC
– Contador de CPU, accesible desde el userspace
– Sin cambios a partir de los procesadores Sandy Bridge+
• Por defecto está el Xen pvclock.
• En las generaciones actuales de instancias, use TSC como
clocksource
El equipo de EC2 pasa mucho tempo hablando con los clientes, mirando entre datos de uso y qué construir luego.
Documento interno de product requests totalmente basado en las experiencias de los usuarios.
Pasan largas horas en la noche para lograr desplegar nuevas instancias y que ustedes reciban un email de algo nuevo en EC2.
Hablar de 3 cosas
EC2 y la evolución de la virtualización
Como obtener lo mejor de su experiencia de uso con EC2 para que se lleven una seria de mejores prácticas.
Como va a ser el futuro de EC2
Amazon Elastic Compute Cloud es un servicio web que hace más facil para ustedes obtener servidores virtuales de forma rápida, económica y sin invertir en capex.
Ok, todos sabemos eso..
Esta charla realmente es difícil de dar porque tiene demasiados temas posibles para cobrir. APIs/Redes/Pricing models/Instancias como tal..
Vamos a hacer entonces algo un poco más enfocado.
En seguida VPC a profundidad (Avanzando) y a la 1:15 Almacenamiento y respaldo en AWS (Principiante).
Al incio solo m1.small 2GB de memoria. Rápidamente percibimos que el cliente requería variedad para diferentes cargas.
When you own the hardware and rent it, rather than sell it, everything changes. We understand much more intimately how customers use the hardware, and we become obsessed with total cost of ownership.
The selection of instances has grown, now reaching 44 instances. And over the past 2 years we’ve grown disproportionately compared to previous years.
What’s enabled us to do this and how do we make sense of the options?
The EC2 platform is the engine that allows us to produce new instance sizes quickly to meet the needs of different workload segments
It’s the hardware and the hypervisor depicted a couple slides ago, it’s the EC2 control plane, and it’s also a procurement and supply chain teams, and datacenter operations teams
Lot’s of technologies, teams, and processes tat make up the EC2 platform.
With the platform we’re able to ingest new technologies to do one of two things, either create a new instance family to address a different market segment, or bring forward a new generation which serves an existing segment with more performance, new feature, and or lower prices.
As technology improves, we want to ensure customer are able to benefit from improvements in CPU, SSD, and other components. We do this through our current generation instance types.
Nivelarnos em conocimientos
Encontramos y administramos el hardware para rodar sus instancias
EC2 instances are virtual machines that are spun up when you issue an ec2-run-instances call, or a ec2-start-instances call
We find available hardware and signal the hypervisor to create your virtual machine instance
We then hand over the SSH keys or the Windows Administrator password, and its yours to do as you please
Server often have more processing power than your application needs, and virtual machines provide us a way to consolidate a number of instances on a single host, providing you low prices while also preserving isolation
So there can be multiple virtual machines per host and there is sometimes only one virtual machine per host, depending on the instance size
Definimos las instancias de forma similar a como usted lo haría con un servidor.
Optimizamos el número de dimensiones.
When we define instances we define them similarly to how you might spec out a server
Optimize on a number of dimensions
When we talk about families these are the drivers
EC2 has a broad selection of instance types to satisfy the resource needs of a diversity of workloads.
Our instance families are logical groupings of instances, and you can see each has a different focus
For example, compute optimized instances have a higher balance of CPU power and offer the best price for compute performance
Memory optimized instances have a higher balance of memory and offer the best price per GB of RAM
And you can see where I’m going with storage optimized, which offers the best value for either IO performance or per GB of instance storage
Things have changed since we first started up EC2 back in 2006, when we launched the m1.small instance. It’s CPU was specified as a performance measure, the ECU. We now provide a lot more transparency. For example, you know the model number, base clock frequency, and turbo of the processor underlying a c3.large
This is all reflected in our API name, but we haven’t really called it out this way before.
Quick review since these terms will come up often in the remainder of the presentaiton
Within each family are generations
You’ll see listed at the top of each family the current generation, for example C3 in compute optimized and R3 in memory optimized
Within each generation or instance type, we offer multiple sizes
Each size within a generation has a similar balance of resources, so each C3 size has a similar ratio of compute, memory, and storage
Each size is typically 2x the resources and 2x the price of the next smallest size, so for example a c3.2xlarge has twice the resources of a c3.xlarge and is 2x the price
You can pick the size that meets the needs of your workload
Evolucion en virtualización x86
Lo que hemos hecho +performance – jitter, OS flexibilities.
El hipervisor tiene que interceptar cualquier instrucción que haga um cambio sobre el sistema.
Antes de VT-x (Tecnología de virtualización assistida por hardware)
Escanear la instrucción y traduccion binaria. –Perfor +Sin cambiar el guest OS
Ignorar y usar hypercalls para reemplazarlas. -Requiere modificación del OS del guest (PV)
VTX – nuevo modo de ejecución de CPU.
No tiene perdida de perf y no requ modif. El OS del guest. (HVM)
T2, R3, I2, C4 solo HVM
Opciones de scheduling.
Cuando el hipervisor asigna según necesidad vCPUs basado en el CPU físico, esto resulta en variabilidad de recursos de CPU asignados.
Creamos controles como asignación directa de puertos para mantener la consistencia que es lo más importante para nosotros.
Going to talk about some industry trends in virtualization, which is important background for understanding some of the things Anthony will dive into
A lot of what we have done over the years relates to the challenges of virtualization – increasing performance, reducing jitter, and providing operating system flexibility.
The hypervisor must be able to trap any instruction that changes the hardware or state of the system. This is to provide isolation between virtual machines.
Before Inten VT-x, there were 17 instructions in x86 instruction set that don’t have this property. So you have a couple options
So you can scan the instruction stream of each virtual machine for privileged instructions and do binary translation – performance is not ideal
Ignore those instructions and provide “hypercalls” to replace instructions that lose their functionality – modified OS Kernel, compatibility and portability
Use hardware assisted virtualization technology provide a new CPU execution mode feature that allows the hypervisor to run in a new root mode below ring 0.
The hypervisor also provides hypercall interfaces for other critical kernel operations such as memory management, interrupt handling and time keeping.
When virtualizing the CPU, one also has a choices of how to assign physical CPU cores to virtual CPUs.
Tendendencias de virtualizacion.
Lo que hemos hecho +performance – jitter, OS flexibilities.
Nuestro hipervisor debe interceptar cualquier instrucción que cambie el estado del hardware para aislar.
Antes de VT-x habia 17 instrucciones que no lograban hacer esto.
Escanear la instrucción y traduccion binaria. –Perfor
Ignorar y usar hypercalls para reemplazarlas. Requiere modificacion de kernel
VTX permite al hipervisor tener más privilégios usando hardware assisted virtualization.
Cuando se virtualiza cpu se debe escoger bien como hacerlo para mantener la independência
También debemos mantener el performance consistente en términos de IO y acceso a dispositivos.
El reto es hacer el agendamento de los IO requiest entre los dispositivos virtuales y físicos.
Tradicionalmente se usa um modelo de driver dividido. Uma parte em el host OS y outra em el guest OS. – Genera variabilidade. – Uso de recursos de host.
Uma opcion es hacer um pass through del dispositivo directo a la VM. + No usa recursos – Es peligroso al ser multi tenant
Intel VT-d que dejar hacer pass throug a travez de um IO memory management unit y logra hacer memory address translation com page tables.
Drivers consistentes entre dispositivos entrega mejor portabilidad entre diferentes HW.
El principal reto assignar memoria permitiendo el OS usar diretamente. Seguridad!
IOMMU puede identificar la fuente y puede rechazar accesos. Tiene tablas para manejar espacios
Se usa para Memoria, isntancias GPU, drivers PCI
Consistent device drivers provided in a split driver model allows for better portability of machine images across hardware generations. Allows hardware specific drivers to reside in a control operating system, and simple front-end driver in the guest communicates to the back-end through ring buffers in shared memory pages. The multiplexing happens on the host, and it can require host CPU resoruces.
The original challenge of assigning a device to a virtual machine has to with direct memory access, so a device can modify memory without bothering the CPU. That would be a serious security hole if allowed in the context of a multi-tenant host.
IOMMU can identify source devices and either deny or translate memory requests using IOMMU page tables. This enables the hypervisor to assign specific devices to a guest and restrict device memory access to pages owned by the guest. This is how we enable PCI-passthrough for things like GPU instances and SR-IOV network devices.
Lo logramos por la escala que tenemos
Objetico de eliminar trade offs.
With our scale we’re able to bring things to customers which might not otherwise come as quickly
Much of our investment in the EC2 Platform has been to tackle one or more of these virtualization challenges, eliminate tradeoffs
Les voy a mostrar como obtener el máximo com su experiência.
T2:
Las de más bajo costo
Perfecta para um uso general.
Muy baja latência de acceso al disco
Para obtener esto se require um tunning
Corta explicación de instance store
Use este kernel o superior
Les voy a explicar por que es esta la recomendacion
Cada vez que la instancia iba a hace i/o, se decide ler a esta posicion em memoria
Instancias no tiene acceso directo a sus ssd
Tenemos um I/O Domain
Por defecto el i/o domain no tiene acceso a la memoria. La instancia tiene que darlo
Es rápido para grandes cantaidades de datos
Requiere TLB flush por operación. Es muy costosos
Se pre aprueba acceso a um pull de bloques de memoria
Procesadores nuevos son muy Buenos haciendo copias de datos, hasta doblar el IO performance.
Igual com kernel anterior funcionan bien si la necesidad es solo latência y no cant de io
Se debe usar o no trim?
Operación solo para SSD. Depende de la ami pero se obtienen excelentes resultados al Hacer periódica uma vez por semana o por dia, Windows no soporta trim
Si no hay trim, se reserva el 10% del disco y nunca se usa. Mismo efecto
Por qué es importante:
Los SSD son muy sofisticados. La tecnologia de FLASH se degrada com cada escrita. Sectores de disco
Despues de millones de escritas, para de funcionar.
Uma DB podria re escribir logs de transaciones. Si se realiza esto em el mismo sector, llegaran mas temprano al final de la vida.
SSD Wear leveling. Trim y Overprovisionan disminuyen el garbage collection.
Para explicar um poco mas a fondo.
Anillo.
Todas las escritas son random.
Hace que se gaste el anillo.
Van a llegar al final del anillo.
Habrá espacios libres.
Mover bloques para liberar espacio cerca de la cosla.
Trim va a guardar donde hay espacios, lo que acelera las escritas de forma más dinâmica.
Tim o no Trim puede hasta cuadruplicar sis i/os
Enh Networking les dará la máxima capacidade de performance de red posible em EC2
Usen HVM. Se ve um gran performance imprivement.
Bare metal tiene kernel mode o application / user mode. Es muy rápido gracias a intel.
Com PV el hipervisor media comunicaciones entre el kernel y el app. Esto requiere TLB flushes tambien
Para algunas aplicaciones no habrá diferencia. Si es mucho io / muchos paquetes en la red
Ultimo consejo
Usen TSC –time stamp conter como clocksource.
Puerbas automatizadas.
TSC hardware clock source. Em Linux se puede hablar com tsc sin el kernel.
Si
Take yourself back to 2006, for the EC2 beta program. We offered one instance size – the m1.small. It has less than 2 GiB of memory and a virtual CPU
We knew that one size doesn’t fit all workloads, and over time we invested in a platform to help us accelerate bringing more EC2 instance selection to customers
When you own the hardware and rent it, rather than sell it, everything changes. We understand much more intimately how customers use the hardware, and we become obsessed with total cost of ownership.
The selection of instances has grown, now reaching 44 instances. And over the past 2 years we’ve grown disproportionately compared to previous years.
What’s enabled us to do this and how do we make sense of the options?
The EC2 platform is the engine that allows us to produce new instance sizes quickly to meet the needs of different workload segments
It’s the hardware and the hypervisor depicted a couple slides ago, it’s the EC2 control plane, and it’s also a procurement and supply chain teams, and datacenter operations teams
Lot’s of technologies, teams, and processes tat make up the EC2 platform.
With the platform we’re able to ingest new technologies to do one of two things, either create a new instance family to address a different market segment, or bring forward a new generation which serves an existing segment with more performance, new feature, and or lower prices.
As technology improves, we want to ensure customer are able to benefit from improvements in CPU, SSD, and other components. We do this through our current generation instance types.