laitimes

QunarCache的应用

author:Flash Gene

一、CDN

1

What is a CDN

CDN(content delivery network)全称是内容分发网络。

Internet Super Courier (Pictures, Text, Music, Movies, Consumer Orders, Weibo...) )

QunarCache的应用

2

The role of a CDN

1. Defend against incursions, resist attacks, and ensure service quality

2. User experience (control latency)

CDN is to reduce the access delay of resources in the case of forwarding, transmission, link jitter, etc., as much as possible, to ensure that users can access quickly and accurately.

3. Save time, effort and money

- Kunark's (CDNPlus)

As we all know, a CDN is actually a layer of proxy set up next to the user, and what really provides services is the final access to the origin server.

So how can you prevent a CDN crash from causing a large amount of traffic to originate?

1

CDN++

1. Multiple CDNs realize multi-node, multi-backup, and multi-guarantee resources

2. Realize DNS resolution control of different operators through intelligent DNS to ensure that access is diverted to each CDN to be allocated

3. Comparison service between multiple companies (service quality, after-sales, price, etc.)

QunarCache的应用

2

CDN + Cache

1. A self-built cache is added behind the CDN to ensure the security of the origin server

2. Multi-region deployment to achieve network advantages and protection of dedicated lines

QunarCache的应用

3. The effect of QunarCache

What kind of protection does this architecture achieve for us?

The downing of a CDN caused a large influx of traffic into our cache cluster, and the growing pressure of the cache was absorbing this burst of traffic, protecting our origin from the pressure of bursts and large volumes of traffic.

QunarCache的应用

1

Cache selection

Squid、Varnish、ATS(Apache Traffic Server)、Nginx

name Jianghu status Belong to the sect Prestige
Squid Historic, mature, old-fashioned The amount of resources is large, and the concurrency is not high 3-star: Mature and professional technology, multi-instance implementation
Varnish The fledgling knows the world three points The hotspots are concentrated, and the total amount of cache is not large 2 stars: high performance, but not for us
ATS Alien masters, unfathomable omnipotence 2 stars: powerful, good performance, high maintenance cost, a bit difficult
Nginx Ten perfect tonic pills, the sword goes sideways omnipotence 2 stars: not mature enough, high maintenance costs

Do what you need

1. Our total resources are large, hotspots are not concentrated, and cache updates are frequent......

2、选型 Nginx + Squid

QunarCache的应用

四、QunarCache 成长

1

Nginx + Squid Sliblings

This mode effectively achieves the horizontal expansion of memory, avoids repeated resource consumption and cached data query time, but is only suitable for small clusters.

QunarCache的应用

2

Nginx UriHash + Squid

This mode not only transfers the query pressure of the cache, but also realizes the horizontal expansion of the cache capacity, gradually replacing the original mode as our cluster expands.

Compared to the original model, this structure plays a role.

QunarCache的应用

3

Nginx UriHash + Squid 多进程

Students who have used Squid know that although Squid has many advantages, it is a short-performance single-process service, so we have improved the performance by adding Squid processes on the original basis.

So how much of an improvement in performance?

QunarCache的应用

五、QunarCache 的运维

1

Third-party detection improves the service experience of QunarCache

Understand the user's experience (the last mile)

Monitor the service health of QunarCache

QunarCache的应用

2

Separate services and manage independent services across multiple clusters

The needs are different, and the focus is different

Make the most of existing hardware resources

QunarCache的应用

3

Saltstack implements service online and offline

Distinguish between clusters and underlying hardware

Unified operations for rapid deployment

六、QunarCache 改进方向

1

The Data Age

Collect CDN logs and analyze them further

● Access effects

● Performance data monitoring

● Sampling alarm

2

Self-service switching

Complete CDN access monitoring and self-service failover with QunarDNS

Author: Duan Kai

Source-WeChat public account: Qunar Technology Salon

Source: https://mp.weixin.qq.com/s/bWR0RzeRt5uVUr4taBWSUA