架構師訓練營 week4 總結
系统架构:系统技术挑战与方案
Challenge
High concurrence
Large traffic
High availability
Mass data
Global service, complicated network
security
Change often, deploy often
Vertical expansion => single server
RAID => I/O
SSD => I/O
Add memory
Upgrade network interface
More process or threads
Horizontal expansion => multiple servers
分布式架构演化
0.simple
Separate data and application
Use cache
Application cluster
Read and write separation
Reverse proxy and CDN
Distributed file systems and distributed databases
No SQL, Search Engine
Business separation
Microservice and Middle Platform
架构模式与要素
Multi Layers:
Horizontal split
ex:
nginx
application
database
Vertical split
Separate different services
micro-services
Distributed
Distributed applications and services
Distributed static resources
Distributed storage systems
Distributed computing
Cluster
Same services same cluster
Cache
CDN
Reverse proxy
Local cache
Remote cache
Asynchronous
Increase speed of response
Increase high availability
Reduce high concurrence
Redundancy
Backup, incase server down
Automation
Operation maintenance
How to measure a system
High performance
High availability
Scalability
Easy to add new server to cluster?
Expandability
New Features
Security
Frontend architecture
App, Web tech stack
Browser, Http, tunning
CDN
Dynamic and static separation
Image service
Reverse proxy
DNS
Gateway and application architecture
Load balance
動態頁面靜態化
Separate business
Service architecture
Micro-service
Distributed queue
Distributed cache
Distributed lock system
Storage architecture
Distribute file systems
Distribute databases
NoSQL
Big data
Search engine
Recommendation engine
Dataware house
Operation and security
Data collection and display
Data monitor and alert
Prevent attacks
Data encryption and decryption
架構案例 - wiki
GeoDNS: Proxy DNS to nearby server
LVS: Linux Virtual Server, like load balancer on Linux
Squid: reverse proxy
Lighttpd: Security, speed, compliance, and flexibility web server
PHP: web programming language
Memcached: distributed cache system
Lunce: search engine
Mysql: database
Performance optimization: most operations are read
Frontend Performance optimization
DNS
CDN
There is no dynamic info in content => prevent catch expired or include expired data
LVS
Dispatch to Squid
Reverse proxy (Squid)
Catch frequent content here
Server-side performance optimization
Use best servers on PHP part
Use Imagemagick to handle image processing
Use Tex to format tex, especially transform science formula to image
Backend Performance optimization
Cache, storage, database
Frequently used data cache in application local cache => every small but really high-frequency reading
Cache content is the format that the application can use directly. Ex: HTML. Reduce processing cost
Use cache server to save session
Memcached Persistent connection is very cheap
Mysql Performance optimization
increase memory
RAID0, high performance but low availability (use backup to solve)
Low Transaction consistency, speed up recovery
If master server down => use slave, but close the write operation
架構案例 - Taboo
Team Goals:
The rapid development of the company's business
Concurrent product team development
System scalability
Evolution
Stand-alone architecture
Multi-machine
Distributed cache
Server cluster
Database read and write separation
CDN acceleration and reverse proxy
Distributed file server
Database sharding
Search engines and NoSQL
评论