Top Banner
Junio 2016 - Pablo Moretti @elsantob Latencia en la Web
27

Latencia en la Web

Jan 09, 2017

Download

Technology

melidevelopers
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: Latencia en la Web

Junio 2016 - Pablo Moretti @elsantob

Latenciaen laWeb

Page 2: Latencia en la Web

Latencia de red“El tiempo que tarda en viajar un paquete de origen a un destino y volver”

Page 3: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

RTT - Round-Trip delay Time- Distancia : 20ms RTT 3000km (SpeedLight)- Red : Fibra / Cable Modem / Mobile Network

30 ms (cable) + 120 ms (fiber) = 150 ms

180 ms (3G) + 120 ms (fiber) = 300 ms

Page 4: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

The Long Road of the WebLa latencia está presente cada uno de los siguiente pasos

Page 5: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

DNS Part / UDP

Page 6: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

DNS Optimization- Los servidores de DNS puede guardar en su cache

una respuesta obtenida de otro servidor por un tiempo (TTL)

- El SO tiene su cache de DNS.- El Browser también tiene su cache.- Algunos browser realiza un prefetch de DNS

predictivo mientras se escribe en el buscador.

Page 7: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

dns-prefetch

<link rel="dns-prefetch" href="//www.domain1.com">

- Este tag funciona como un hint para que el browser pueda hacer el lookup de dominio antes de llegar a pedir el recurso.

Page 8: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

TCP Handshake

Page 9: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

SSL - Negociation

Page 10: Latencia en la Web

Numeros

TCP150 ms (Fibertel) 300 ms (3G - Personal)

TCP + SSL500 ms (Fibertel) 1000 ms (3G - Personal)

Page 11: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

Keep-alive - TCP OptimizationPara reutilizar la conexión TCP se envía el header “Connection: keep-alive” que indica al cliente que no cierre la conexión.

300 segundos el tiempo que mantiene chrome abierta la conexión, es importante no cerrarla antes desde el server.

Timeout 30s -> 300s en el server

Page 12: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

Reduce the gap

Disponibilizar servidores más cercanos al usuario para servir contenido estático y dinámico.

- Content Delivery Network- Eary termination SSL and TCP- Consultar en elserver.com si soporta docker :P

Page 13: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

preconnect

<link rel="preconnect" href="//www.domain1.com">

- Este tag funciona como un hint para que el browser pueda establecer una conexión TCP.

Page 14: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

Preconnect en Mercado LibreRedujo ~1 segundo para Document Complete en el buscador.

Mobile 3G - Slow (780 Kbps/330 Kbps 200ms RTT)

Page 15: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

Critical path

Se llama a la técnica en la cual enviamos el css inline en el html para evitar establecer una conexión para descargarlo por el costo que tiene la latencia.

Page 16: Latencia en la Web

VIP+30% Visual Comparation

Mobile 3G - Slow (780 Kbps/330 Kbps 200ms RTT)

Page 17: Latencia en la Web

Login+30% Visual Comparation

Mobile 3G - Slow (780 Kbps/330 Kbps 200ms RTT)

Page 18: Latencia en la Web

Ok, pero todavía seguimos esperando el response...

Page 19: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

prefetch

<link rel="prefetch" href="//www.domain1.com/voy">

- Este tag descarga un objeto y lo guarda en el cache, por defecto se guarda por un hit a menos que tenga cache-control

goprefetch

Page 20: Latencia en la Web

Prefetch VIP Cards

Mobile 3G - Slow (780 Kbps/330 Kbps 200ms RTT)

Page 21: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

prerender

<link rel="prerender" href="//www.domain1.com/voy">

- Este tag descarga la página en un tab insibile por decirlo y la deja lista. Atención ejecuta el javascript usar Page Visibility API.

Page 22: Latencia en la Web

Prebrowsing Techniques

Page 23: Latencia en la Web

Speed Matters !

Page 24: Latencia en la Web

This is our visionBuilding the foundation to Build a 3B Company by FY20

Aceleramos el inicio del checkoutPrefetch CSS + Negociaciones de TCP/SSL en VIP para reducir el tiempo de carga de checkout más de ~3 segundos (Mobile 3G - Slow).

Page 25: Latencia en la Web

The present ?

Page 26: Latencia en la Web

Service Workers !!!HTTP2 (HTTPS only)Brotli

Page 27: Latencia en la Web

Muchasgracias