优化性能

监控与排障 Azure 解决方案

Ebadur Osib

Senior Cloud Consulting Engineer

性能即特性

慢应用

 

  • 性能影响用户信任。
  • 应用变慢会增加故障。
  • Azure 帮助开发者优化:
    • 低延迟
    • 高并发流量
监控与排障 Azure 解决方案

性能问题从何而来

问题来源

监控与排障 Azure 解决方案

延迟 vs 吞吐量

吞吐量 vs 延迟

监控与排障 Azure 解决方案

优化关键路径

最慢的依赖

  • 优化从识别并缩短最慢的序列开始。
  • 并非所有部分都需同等调优。
监控与排障 Azure 解决方案

降低依赖延迟

 

  • 依赖是最常见的延迟来源。
  • 降低方法:
    • 查询优化
    • 连接池
    • 批量请求
    • 减少频繁小调用
  • 比单纯扩容计算更有效。

降低延迟

监控与排障 Azure 解决方案

缓存

缓存

监控与排障 Azure 解决方案

Azure Cache for Redis

缓存架构

1 https://learn.microsoft.com/en-us/azure/redis/architecture
监控与排障 Azure 解决方案

Azure 托管 Redis

托管 Redis 架构

1 https://learn.microsoft.com/en-us/azure/redis/architecture
监控与排障 Azure 解决方案

缓存设计要点

 

  • 缓存带来重要的设计决策。

  • 需为缓存数据定义过期策略。

  • 在一致性与新鲜度间权衡。

  • 常见模式是旁路缓存(cache-aside),按需加载到缓存。

云端缓存

  • 缓存失效确保过期数据被刷新或移除。
监控与排障 Azure 解决方案

节流与背压

 

  • 过多请求会导致故障。
  • 节流与背压可保护系统。
  • 放慢或拒绝超量流量。

节流

监控与排障 Azure 解决方案

异步与基于队列的模式

异步与队列

监控与排障 Azure 解决方案

业务问题

业务问题

监控与排障 Azure 解决方案

定位瓶颈

瓶颈

监控与排障 Azure 解决方案

为规模与速度优化

已优化

监控与排障 Azure 解决方案

Passons à la pratique !

监控与排障 Azure 解决方案

Preparing Video For Download...