32
Scaling Application ESRI Developer Summit - 2011 Alaor Bianco [email protected] @alaorbianco IMAGEM - BRAZIL

Scaling Application

Embed Size (px)

Citation preview

Page 1: Scaling Application

Scaling Application

ESRI Developer Summit - 2011

Alaor Bianco [email protected] @alaorbianco

IMAGEM - BRAZIL

Page 2: Scaling Application

Agenda

• Some good practices and tools– Cache– Instrumentation– Performance counters

• How did good practices help us?– Webcontrol approach vs. service approach– Performance tests

Page 3: Scaling Application

Introduction

• The main idea– Only who knows can take control!– Understand the application behavior– Understand the application lifecycle

Page 4: Scaling Application

Scaling

• Scale up (Scale vertically)

• Scale out (Scale horizontally)

Page 5: Scaling Application

• Where to use?• Why to use?

– Reduce data transfer in inter-process communication– Reduce data processing– Reduce disk access

• Types– Files based (disk)– InMemory

• Pre-Build Caching• On-Demand Caching

Caching

Page 6: Scaling Application

• Map Caching– Different scales– Improvements to map cache tile generation (10.0)

• Feature Caching– Esri FeatureCache– GeoFeatureCache (NoSQL and InMemory)

Caching

Page 7: Scaling Application

• Negative Caching– Failed requests– Low expiration– Fail Fast, Fail Cheap– Avoid cascade effects

Caching

Page 8: Scaling Application

Caching• Windows Server AppFabric Caching

(Distributed Cache)

Throughput : Amount of data transferredLatency: Time delayLoad: Work

Page 9: Scaling Application

Caching

• .NET 4.0 System.Runtime.Caching

• Ncache

• Memcached

• Varnish (html)

WikipediaFlickrTwitterYoutubeDiggWordPressCraigslist

Page 10: Scaling Application

• Asynchronous Processing

• Heavy Processing

Queue

Examples:MSMQQueue Class

Page 11: Scaling Application

• Log and Trace

• Audit

• Diagnostic– Analyze

• Behavior• Lifecycle

Instrumentation

Page 12: Scaling Application

• Interception Methods from Microsoft Enterprise Library Application Block

public class Reader : IOperation{ [Common.Logging.Interception.Log] public override IEnumerable<Row> Execute(IEnumerable<Row> rows) {

Log or Trace - Sample

Page 13: Scaling Application

• Different levels– Debug– Error– Info– Notice– Warn– Network

Logs

Others:Log4NetScribe

facebook

Page 14: Scaling Application

• Instrumentation• What´s alive• What´s Processing• What´s Processed• Performance• Statistics• Available Resource

Performance Counters

Page 15: Scaling Application

• Performance Counters from Microsoft Enterprise Library Application Block

• Can use Interception just like Logs

• Can be injected by IoC (Dependency Injection)

Performance Counters

Page 16: Scaling Application

• Scalability– Server do not need to maintain state for each

• Request• User• Etc

• Scaling Horizontally– One server do not worry about a state create by

another one

Stateless

Page 17: Scaling Application

How did it help us?

• Understand the application flow, lifecycle and behavior– Identify bottleneck– Identify improvement points

• Based on this information, build a good architecture

Page 18: Scaling Application

ASP.NET Web Controls

Page 19: Scaling Application

ASP.NET Web Controls

• Server side processed

• Viewstate

• For each callback all viewstate is sent to server

• For each callback all webcontrol fires onLoad event

Page 20: Scaling Application

Architecture

class Disposição Lógica Camadas

GIS

RepositoryServ iceView Controller

Model

Persistence

Serializer

Page 21: Scaling Application

Architecture

• MVC– Easy to test

• AJAX instead of callback• COM Objects lifecycle management• Application Container has all active objects

reference– Layers– Map– etc

Page 22: Scaling Application

• Started on ArcGIS Server 9.2

• GIS Framework with our own well known interfaces, implementation and services

• Migration to AGS 9.3.1 took 5 hours

Architecture

Page 23: Scaling Application

• Migration to AGS 10 (took a little more!!)– Write the controller layer as a SOE– Write the framework initializer to get map objects

references– Can return JSON, GeoJSON or XML

• Was able to reuse all our business layer!!

Architecture

Page 24: Scaling Application

Comparison - Login

System A System B System C System D0

50

100

150

200

250

Requests Times

System A System B System C System D0

100

200

300

400

500

600

700

KBytes Sent

System A System B System C System D0

500

1000

1500

2000

2500

3000

Kbytes Received

System A System B System C System D00:00

00:28

00:57

01:26

01:55

02:24

02:52

Duration

System A – ServiceOthers – Webcontrol (Initialization)

Page 25: Scaling Application

Comparison - Zoom

System A System B System C System D0

20

40

60

80

100

120

Requests Times

System A System B System C System D0

100

200

300

400

500

600

700

Kbytes Received

System A System B System C System D0

50

100

150

200

250

KBytes Sent

System A System B System C System D00:00

00:07

00:14

00:21

00:28

00:36

Duration

System A – ServiceOthers – Webcontrol (Zoom)

Page 26: Scaling Application

Comparison

• System A was able to support 900 simultaneous users

• System B was able to support no more than 30

*Same operational environment (Hardware and Software)

Page 27: Scaling Application

Performance Tests

• Load Tests in VisualStudio– Web Performance Test

Page 28: Scaling Application

Performance Tests

• Load Test

Page 29: Scaling Application

Performance Tests

Page 30: Scaling Application

Performance Tests

Page 31: Scaling Application

Performance Tests

Page 32: Scaling Application

Thanks and Questions