Upload
alaor-bianco
View
878
Download
0
Embed Size (px)
Citation preview
Scaling Application
ESRI Developer Summit - 2011
Alaor Bianco [email protected] @alaorbianco
IMAGEM - BRAZIL
Agenda
• Some good practices and tools– Cache– Instrumentation– Performance counters
• How did good practices help us?– Webcontrol approach vs. service approach– Performance tests
Introduction
• The main idea– Only who knows can take control!– Understand the application behavior– Understand the application lifecycle
Scaling
• Scale up (Scale vertically)
• Scale out (Scale horizontally)
• 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
• Map Caching– Different scales– Improvements to map cache tile generation (10.0)
• Feature Caching– Esri FeatureCache– GeoFeatureCache (NoSQL and InMemory)
Caching
• Negative Caching– Failed requests– Low expiration– Fail Fast, Fail Cheap– Avoid cascade effects
Caching
Caching• Windows Server AppFabric Caching
(Distributed Cache)
Throughput : Amount of data transferredLatency: Time delayLoad: Work
Caching
• .NET 4.0 System.Runtime.Caching
• Ncache
• Memcached
• Varnish (html)
WikipediaFlickrTwitterYoutubeDiggWordPressCraigslist
• Asynchronous Processing
• Heavy Processing
Queue
Examples:MSMQQueue Class
• Log and Trace
• Audit
• Diagnostic– Analyze
• Behavior• Lifecycle
Instrumentation
• 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
• Different levels– Debug– Error– Info– Notice– Warn– Network
Logs
Others:Log4NetScribe
• Instrumentation• What´s alive• What´s Processing• What´s Processed• Performance• Statistics• Available Resource
Performance Counters
• Performance Counters from Microsoft Enterprise Library Application Block
• Can use Interception just like Logs
• Can be injected by IoC (Dependency Injection)
Performance Counters
• 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
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
ASP.NET Web Controls
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
Architecture
class Disposição Lógica Camadas
GIS
RepositoryServ iceView Controller
Model
Persistence
Serializer
Architecture
• MVC– Easy to test
• AJAX instead of callback• COM Objects lifecycle management• Application Container has all active objects
reference– Layers– Map– etc
• 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
• 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
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)
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)
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)
Performance Tests
• Load Tests in VisualStudio– Web Performance Test
Performance Tests
• Load Test
Performance Tests
Performance Tests
Performance Tests
Thanks and Questions