jackyxiong / jackyxiong.github.io Goto Github PK
View Code? Open in Web Editor NEWblog
Home Page: http://jackyxiong.github.io
blog
Home Page: http://jackyxiong.github.io
单包攻击原理和防御:https://cshihong.github.io/2019/05/16/%E5%8D%95%E5%8C%85%E6%94%BB%E5%87%BB%E5%8E%9F%E7%90%86%E4%B8%8E%E9%98%B2%E5%BE%A1/
网络层(TCP/UDP)攻击与防御原理:https://cshihong.github.io/2019/05/14/%E7%BD%91%E7%BB%9C%E5%B1%82-TCP-UDP-%E6%94%BB%E5%87%BB%E4%B8%8E%E9%98%B2%E5%BE%A1%E5%8E%9F%E7%90%86/
应用层(DNS/HTTP/HTTPS)攻击与防御原理:https://cshihong.github.io/2019/05/14/%E5%BA%94%E7%94%A8%E5%B1%82-DNS-HTTP-HTTPS-%E6%94%BB%E5%87%BB%E4%B8%8E%E9%98%B2%E5%BE%A1%E5%8E%9F%E7%90%86/
记录看过的一些技术资源
Web 服务的负载均衡是个老生常谈的话题,也出现了多种实现方案。如硬件层的 F5 ,作用于 OSI 七层模型中第四层的 LVS ,通过对 IP 包的拦截修改和转发,来实现流量分发。这两个方案,F5 是硬件,而 LVS 又是扎根于内核,所以性能和稳定性都极高。
而往上,Nginx 来作负载均衡则是作用于应用层,在这一层可以支持更加细粒度的指标来选择后端源服务,而不只是简单的流量分发了。比如可根据UA的不同、IP 所在地区的不同,以及不同的URL等把流量发送到对应的服务实例上。使用 Nginx 作负载均衡一般与其反向代理的功能同时使用,相比于 LVS 而言,部署简单,功能丰富。
看一个 Nginx 配置文件的实例
upstream backend {
server backend1.example.com weight=5;
server backend2.example.com:8080;
server unix:/tmp/backend3;
server backup1.example.com:8080 backup;
server backup2.example.com:8080 backup;
}
server {
location / {
proxy_pass http://backend;
}
}
weight参数默认为1,值越大,对应服务的权重越高。
server backend1.example.com weight=5;
server backend2.example.com:8080;
像这样的配置,则Nginx会每向 backend1 发送5个请求,就会想 backend2 发送一个请求。
除了weight之外,ip_hash
可根据访问者的IP hash值对应到不同的服务实例,有些情况下可以保证session不丢失。
hash
可设置根据变量、常量或者两者的组合来计算hash值,进而映射到不同的服务。
fair
叫做是智能模式,这个模块会根据处理请求的响应时间和响应内容大小,动态调整流量的分配。 但是这个指令是第三方库的功能,不是 Nginx自带的功能,如果要使用,需要将其编译到Nginx内部。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.