31
park the future. May 4 – 8, 2015 Chicago, IL

Typical Caching Patterns Web Tier Data Storage SQL Data

Embed Size (px)

Citation preview

Spark the future.

May 4 – 8, 2015Chicago, IL

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

BRK2708

Introduction

AgendaWhy CacheAzure Redis Cache OfferingRedisFAQs

Typical Caching Patterns

Web Tier

Data

Storage

SQL

Data

Web Tier

Cache

Data

Data

Storage

SQL

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

AzureRegion

Caching

Redis

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

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

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

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

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

• Clustering

Azure Redis Cache Service

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

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

Azure Redis Cache…

Azure Redis Cache

FAQs

Cache size High Availability - Standard Network bandwidth

How to pick the right Cache SKU

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

server. Client usage. Redis Commands usage. Measure and iterate.

High Latency

50% : <3ms99% : <10ms

• Pings sent via RedisBenchmark.exe•Client and Cache in same region• Lightly loaded Cache

Azure Redis Cache Latency

Cache Name

Cache Size GET/sec (Simple GET calls of 1 KB values)

Bandwidth (Mbits/sec)

C0 250 MB 610 5

C1 1 GB 12,200 100

C2 2.5 GB 24,300 200

C3 6 GB 48,875 400

C4 13 GB 61,350 500

C5 26 GB 112,275 1000

C6 53 GB 153,219 1000+

Azure Redis Cache Performance

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

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

Use latest version of clients Single ConnectionMultiplexer AbortOnConnectFail ConnectRetry ConnectionTimeout Large values

Use multiple Connection Multiplexers for different connection settings.

Client configuration – StackExchange.Redis

Cache Aside pattern Retry logic Local cache Caching highly dynamic data

Cache patterns

Roadmap

Scale Up/ Down Configuring Redis – key space notification China/ Government Cloud support Persistence Clustering Geo Replication Virtual Network

Roadmap

Visit Myignite at http://myignite.microsoft.com or download and use the Ignite Mobile App with the QR code above.

Please evaluate this sessionYour feedback is important to us!

© 2015 Microsoft Corporation. All rights reserved.