Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per...

31
itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high traffic ASP.NET website Level 400 Dan Fizesan, Lead Developer, NetMatch – Travel Technology Solutions

Transcript of Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per...

Page 1: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Serving 10 million requests per day

How to solve the architecture challenges of a high traffic ASP.NET website

Level 400

Dan Fizesan, Lead Developer, NetMatch – Travel Technology

Solutions

Page 2: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public CloudITCamp 2012 sponsors

Page 3: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Dan Fizesan, 37 years old.

• 15 year experience with Progress / C# / ASP.NET / T-SQL.

• Technical Architect / Lead developer in NetMatch / Zoover project.

• NetMatch international company e-business provider for tourism industry

• Zoover is a website with reviews about trips on average 500.000 unique visitors per day

• Contact: [email protected]

Who am I

Page 4: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Architecture of a web application

• Deep dive into the macro architecture

• Serving 10 million requests a day - final

view

• Demo

• Q & A

Agenda

Page 5: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• More and more users are using the online websites

• Applications on mobile devices are using data from the web data services

• The FOCUS in the presentation are on-premise applications that are also subject to above trends

Context

Page 6: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 7: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Be online as much time as possible

• Serve as many users as possible

• Low cost of ownership

• Good performance

Architectural Goals

Page 8: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Be online as much time as possible

• Serve as many users as possible

• Low cost of ownership

• Good performance

Architectural Goals

Page 9: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• We reach high availability when more than 90% of the time the website is working correctly

• 99% availability = the website is down 87,6 hours in a year (or 15 minutes every day)

• 99.99% availability = the system is down less then 1 hour per year

• Our systems go for 99.9% availability

Availability

Page 10: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

How can we reach 99.9% availability?

• Through passive redundancy – failover

• Through active redundancy

• Through data sources replication

Challenge

Page 11: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 12: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Hardware load balancers

• Software load balancers: Network Load Balancer, Ha Proxy, etc.

• Algorithms to spread the load

• Implementing failover is crucial

• Alternative: Producer-consumer pattern – used in IIS

Load Balancers + Failover

Page 13: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 14: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

Web is stateless, what happens with the state when using a web farm?

Challenge

No sessions stickiness: • SQL (session) state

server, • distributed cache

session state, • use cookies

With session stickiness• performs worse• can lead to

overloaded servers

Page 15: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Be online as much time as possible

• How can we serve as many users as possible?Partly through using load balancersPartly through scalability of the website

• Low cost of ownership

• Good performance

Architectural Goals

Page 16: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• The ability of the website to grow the user base by adding more hardware

• The more linear the relation is, the more scalable the website is

• Vertical scalability

• Horizontal scalability, lower costs using commodity hardware

Scalability

Page 17: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Be online as much time as possible

• How can we serve as many users as possible?Partly through using load balancersPartly through scalability of the website

• Low cost of ownership

• Good performance

Architectural Goals

Page 18: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Helps the backend (database/services)

• Advantage: brings consistency in an webfarm

• Disadvantages: latency

• Some of the free options: Windows Server AppFabric Caching,

memcached

• Some of the commercial options: NCache, Azure AppFabric caching

Distributed Caching

Page 19: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 20: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

How can we protect the website in the case the distributed cache goes down or is not reachable?

• Through implementing failover caching mechanisms in the website

Challenge

Page 21: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Be online as much time as possible Through high availability

• Serve as many users as possiblePartly through using load balancersPartly through scalability of the website

• Low cost of ownership

• Good performance

Architectural Goals

Page 22: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Web code/ business layer performance

• Database queries performanceFlat databasesReplicated databases

• Distributed architecture splitting into sub-applications

• Parallelization of the code (demo)

Perceived good performance

Page 23: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 24: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

How can we use distributed architecture and have a good performance?

• We should externalize the resource-intensive parts of the application into sub-applications

• Choosing wrong parts will only add (network) latency

Challenge

Page 25: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 26: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

OUR ARCHITECTURE TO SERVE

10 MILLION REQUESTS PER DAY

Page 27: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 28: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Page 29: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

300 requests

Demo Results

Approach % s

ThreadPool parallelism 1200% 21,6 s

Task Parallel Library parallelism 4200% 76 s

Simple Threads parallelism 155% 2,8 s

Custom ThreadPool parallelism 100% 1,8 s

Page 30: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Q & A

Contact: [email protected]/itcamp2012/challenges.pptxwww.netmatch.ro/itcamp2012/demo.zip

Page 31: Itcampro @ itcamp12 # Premium conference on Microsoft technologies Serving 10 million requests per day How to solve the architecture challenges of a high.

itcampro@ itcamp12# Premium conference on Microsoft technologies

Private & Public Cloud

• Availability

• Redundancy

• Load balancer

• Scalability

• Distributed caching

• Performance

To Remember