39

How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Embed Size (px)

Citation preview

Page 1: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350
Page 2: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

How to Build High Performance Apps Using Microsoft Azure Redis CachePranav Rastogi | @rustd M350

Page 3: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Introduction

Page 5: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

AgendaWhy CacheRedisAzure Redis CacheFAQs

Page 6: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Typical Caching Pattern

Web Tier

Data

Storage

SQL

Data

Page 7: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Web Tier

Cache

Data

Data

Storage

SQL

- High Throughput- Low Consistent Latency 50% : <3ms 99% : <10ms

AzureRegion

Page 8: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Caching

Page 9: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Redis

Page 10: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

What is Redis?“Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. ” - redis.io

“Redis has many different use cases. The simplest way to describe it is something between a traditional database and doing computations in memory. Redis exposes data structures that are accessed in memory via a set of commands. ” – Salvatore

Page 11: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Rich Ecosystem• Proven at scale: Twitter, GitHub, Weibo,

Pinterest, Snapchat, Craigstlist, StackOverflow, Flickr …

• Knowledgeable community• Rich set of clients, higher level libraries• Easy to hire for

Page 12: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Redis features• Low latency, high throughput key-value

store Per Key expiry, choice of eviction policies.

• Atomic operations on data types Strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

• Transactions• Publisher-Subscriber pattern• LUA scripting• Pipelining• Client libraries in multiple languages

Page 13: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Redis features…• Databases• Highly customizable replication support• Supports hierarchy of ‘Slaves’ per ‘Master’

• Persistence support• Point in time, Log every write, or both

• Clustering

Page 14: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Redis

Page 15: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Azure Redis Cache Service

Page 16: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Redis Cache hosted and managed by Microsoft Dedicated virtual machine per cache Sizes: 256 MB, 1 GB, 2.8 GB, 6 GB, 13 GB, 26 GB, 53 GB Available in all Azure Regions

China and Government cloud coming SSL Basic SKU : Single cache node Standard SKU: Cache node + one replica

Availability SLA of 99.9%

Azure Redis Cache

Page 17: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

• RBAC• Provisioning Redis Cache•Monitoring/ Diagnostics• Alerts• ASP.NET Session & Output Cache Providers•Memcache protocol shim

Azure Redis Cache…

Page 18: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Azure Redis Cache

Page 19: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

FAQs

Page 20: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

We recommend all new developments use Azure Redis Cache.

https://msdn.microsoft.com/en-us/library/azure/dn766201.aspx

Which Azure Cache offering is right for me?

Page 21: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Cache size High Availability - Standard Network bandwidth Cache and client should be in the same

region

How to pick the Cache SKU

Page 22: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

50% : <3ms99% : <10ms

• Pings sent via redis-benchmark.exe•Client and Cache in same region• Lightly loaded Cache

Azure Redis Cache Latency

Page 23: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Cache Name

Cache Size

GET/sec (Simple GET calls of 1 KB

values)

Bandwidth (Mbits/sec)

Cores (Redis)

C0 250 MB 610 5 0.25*C1 1 GB 12,200 100 1*C2 2.5 GB 24,300 200 1C3 6 GB 48,875 400 1C4 13 GB 61,350 500 1C5 26 GB 112,275 1000 1C6 53 GB 153,219 1000+ 1

Azure Redis Cache Performance

Page 24: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Cache and client in the same region. Network bandwidth limits on client or

server. Redis commands usage. Measure and iterate.

High Latency

Page 25: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Scaling Azure Redis Cache

Scale Up– aka Vertical Scaling Increased Cache Size (Memory) Increased Bandwidth Single CPU

Scale Out– aka Horizontal Scaling Increased Cache Size, Bandwidth, CPU Improved Availability Client responsible for sharding

(Static/Dynamic) Sharding on Server (Clustering) in future

roadmap

Page 26: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Monitor in the portal. Set eviction policies. Set Alerts. Monitor using Redis tools eg. redis-cli.exe

High Fragmentation

Benchmarking using redis-benchmark.exe

Monitoring Azure Redis Cache

Page 27: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Use latest version Single instance of ConnectionMultiplexer AbortOnConnectFail=false ConnectRetry ConnectionTimeout Large values/ Long running commands

Use multiple Connection Multiplexers for different connection settings.

Client configuration – StackExchange.Redis

Page 29: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Multi-Region Scenario

Web Tier

Cache

StorageAzure Region 1

Web Tier

Cache

Azure Region 2

Cache Sync

Page 30: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Multi-Region Scenario

Web Tier

Cache

Azure Region 1

Web Tier

Cache

Azure Region 2

SQL SQL

Page 31: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

High Availability

Availability Set

Master

Master

Slave

Slave

Azure Redis

Endpoint [Shim]

Page 32: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

High Availability

Availability Set

Slave

Master

Slave

Master

Azure Redis

Endpoint [Shim]

Page 33: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

High Availability

Availability Set

Slave

Master

Slave

Master

Azure Redis

Endpoint [Shim]

Page 34: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Roadmap

Page 35: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Scale Up/ Down Configuring Redis – key space notification Persistence Azure Regions

China/ Government Cloud support

Clustering Virtual Network Geo Replication

Roadmap

Page 37: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Resources

TechNet & MSDN FlashSubscribe to our fortnightly newsletter

http://aka.ms/technetnz http://aka.ms/msdnnz

http://aka.ms/ch9nz

Microsoft Virtual AcademyFree Online Learning

http://aka.ms/mva

Sessions on Demand

Page 38: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

Complete your session evaluation now and be in to win!

Page 39: How to Build High Performance Apps Using Microsoft Azure Redis Cache Pranav Rastogi | @rustd M350

© 2015 Microsoft Corporation. All rights reserved.Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or

other countries.MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.