那年花开月正圆
China-built VLCC featuring green technologies delivered in Dalian_我的网站

A |
一键部署OpenClaw 服务器CPU莫名飙高,带宽跑满,看日志全是同一个IP一秒打来几十个请求——这不是业务火了,是被CC了。 (ECNS) -- A new-generation very large crude carrier (VLCC), independently developed and built by China, was delivered in Dalian, Liaoning Province, on Monday. Named Front Fraser, the 307,000-metric-ton crude oil tanker was built by Dalian Shipbuilding Industry Co., Ltd. (DSIC) and China Shipbuilding Trading Co., Ltd. for Norwegian shipping company SEATANKERS. The vessel measures about 333 meters in length, 60 meters in width and 30 meters in depth, with a deck area of more than 18,000 square meters. Its total coated surface area exceeds 540,000 square meters, equivalent to about 76 standard football fields. Designed for strong adaptability to different ports and waterways, the tanker can carry more than 2 million barrels of crude oil at a design draft of 20.5 meters and is capable of navigating through the Strait of Malacca. Equipped with an exhaust gas cleaning system, the vessel is expected to save about 35 million yuan ($4.9 million) in fuel costs annually. Its nitrogen oxide emissions meet Tier III standards, the strictest requirements under relevant international conventions, while the vessel also complies with Phase III of the Energy Efficiency Design Index (EEDI). Wang Rongtao, project manager at DSIC, said the vessel successfully passed all sea trials on its first attempt and was delivered 43 days ahead of schedule, with several key technical indicators exceeding contractual requirements. (By Intern Liu Shuangjing, Zhang Dongfang)
。扛CC的第一道闸门不在代码里,在Nginx的限流模块里,配置成本几乎为零。 limit_req的原理是漏桶:你设定一个速率,超速的请求直接返回503或延迟排队。先用limit_req_zone定义一个计数区,再在location里挂上limit_req,两步完事。
# nginx.conf 的 http 块里定义限流区 # 以客户端IP为key,10MB内存可存约16万个IP状态 # rate=10r/s 表示平均每秒最多放行10个请求 limit_req_zone $binary_remote_addr zone=req_per_ip:10m rate=10r/s; # server 或 location 块里应用 server { location / { limit_req zone=req_per_ip burst=20 nodelay; proxy_pass http://127.0.0.1:8080; } } burst=20是缓冲队列长度,配合nodelay表示突发20个请求立即处理、不排队,超出就直接拒。
B | 想对登录、搜索这类昂贵接口管得更严,单独再定义一个rate=2r/s的zone挂上去就行,互不影响。
# 对登录接口单独限流:每秒2个,突发5个
limit_req_zone $binary_remote_addr zone=login_limit:10m rate=2r/s;
location /login.php {
limit_req zone=login_limit burst=5 nodelay;
# 被限流的请求返回429而不是默认503
limit_req_status 429;
fastcgi_pass 127.0.0.1:9000;
} 验证很简单:reload之后用ab压一下,ab -n 200 -c 20 https://你的域名/,看返回里有没有429或503;同时tail -f日志确认正常用户没被误伤。限流阈值别拍脑袋定,先统计自己站点的正常峰值,设成峰值的两倍左右再逐步收紧。限流是防守,如果卡死自己人就本末倒置了。 数据来源:nginx.org官方文档 ngx_http_limit_req_module 模块说明 申请创业报道,分享创业好点子。点击此处,共同探讨创业新机遇!。
Current article:http://www.hanninhuaxituochunkui.pics/esr/z76gi.htm
Published on:09:11:11
