Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Web api scalability and performance

10,925 views

Published on

ASP.NET Web API : Performance and Scalability Key concepts.

Published in: Technology
  • Hello, I would be intereded in the technique 3 (throttling). Could you tell us more about it?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Web api scalability and performance

  1. 1. Discover. Master. Influence.
  2. 2. Lead Consultant at Readify @H_Desai http://himanshudesai.wordpress.com 2Discover. Master. Influence.
  3. 3. With thanks to our sponsors
  4. 4. • Request life cycle • Server Load Reduction • Measuring Performance • Server Configuration • Tools Discover. Master. Influence.
  5. 5. • Response time or latency – Measured @Server/Measured @Client • Throughput – Requests/sec • Resource utilization – CPU/Memory/Disk IO/Network IO Discover. Master. Influence.
  6. 6. HTTP request/response handling Client Server
  7. 7. 7Discover. Master. Influence. • Http Dispatcher Formatting Exception filters Your Code Request Action Filters Model Bind Authorization Filters Select action Route to controller Response
  8. 8. • Transferring Less Data – Http Caching (Etag,Max Age,Expires) –Efficient Content Types –Batching –Push Content Stream(Chunked) Discover. Master. Influence.
  9. 9. 9Discover. Master. Influence. Technique # 1 (Etag)
  10. 10. 10Discover. Master. Influence. Technique # 2 (Cache Control)
  11. 11. 11Discover. Master. Influence. Technique 3 (Throttling)
  12. 12. 12Discover. Master. Influence. Technique 4 (protocol)
  13. 13. Discover. Master. Influence. 0 500 1000 1500 2000 2500 3000 3500 4000 4500 xml json bson protobuf Formatters Payload (lower value - better)
  14. 14. 15Discover. Master. Influence. Serializer size serialize deserialize protobuf-net 3 268 1,881 proto# 3 76 1,792 BinaryFormatter 153 6,694 8,420 SoapFormatter 687 28,609 55,125 XmlSerializer 153 14,594 19,819 DataContractSerial izer 205 3,263 10,516 DataContractJsonS erializer 26 2,854 15,621 Source: https://code.google.com/p/protobuf-net/wiki/Performance
  15. 15. Discover. Master. Influence. How to implement Resource?
  16. 16. • I/O bound operation • Dashboard type app with low users • Long polling Discover. Master. Influence.
  17. 17. 20Discover. Master. Influence. Asynchronous (Demo)
  18. 18. Discover. Master. Influence. Measure?
  19. 19. • ASP.NET • CLR Performance Counters Discover. Master. Influence.
  20. 20. 24Discover. Master. Influence. • ASP.NET Performance Counters (IIS 6.0 or II7.0 classic mode) Client IIS App Domain App Domain QueueNamed Pipe Requests waiting to be written to client WebServiceISAPI Extension ReqSec ASP.NET Rejected Requests ASP.NET Requests Wait Time ASP.NET Requests Queued ASP.NET Requests in Application Queue ASP.NET Application Requests Executing ASP.NET Worker Process Restarts ASP.NET ApplicationsRequest Sec Pipeline ASP.NET Worker Process
  21. 21. 25Discover. Master. Influence. • Additional Performance Counters (IIS 7.0/7.5 integrated mode) Client IIS Named Pipe Pipeline W3SVC_W3WP Process W3SVC_W3WP(_Total)Requests / Sec W3SVC_W3WP(_Total)Active Requests
  22. 22. Discover. Master. Influence.
  23. 23. • IIS App pool – Queue Length (1000 by default) – Idle timeout (default is 20) • Aspnet_config or (registry) – maxConcurrentRequestsPerCPU – in v4.0 is 5000 (default) • ServicePointManager.DefaultConnectionLimit • Max ADO.NET connection Pool Size (default is 100) • Machine.config – Processmodel.Autoconfig (turned on by default) 28Discover. Master. Influence.
  24. 24. • Performance counters • Visual Studio Load test • Visual studio profiler (CPU/Memory/Concurrency measurements) • 3rd Party tools like Red gate’s ANTS profiler • Apache Benchmark 29Discover. Master. Influence.
  25. 25. • Transfer less data and make use of caching • Use efficient mime types for internal application • Don’t block your thread pool threads • Measure your throughput by tests • Tweak IIS settings when needed • Don’t run your test on Client OS 30Discover. Master. Influence.
  26. 26. Discover. Master. Influence.

×