当前位置: 首页 > article >正文

nginx基础http基础

目录

  • nginx简介
    • 正向代理&反向代理
      • 正向代理
      • 反向代理
      • What Is a Reverse Proxy Server?
    • High-Performance Load Balancing (负载均衡)
      • Problem(问题)
      • Solution(解决方案)
      • 常见负载均衡算法
        • Round Robin(轮询)
        • Weight Round Robin(加权轮询)
        • Least connections(最小连接数)
        • Least time(最短响应时间负载均衡算法)
        • Generic hash(哈希)
        • Random
        • IP hash
        • URL hash
      • TCP/UDP load balance
    • cookie & session
      • http无连接和Keep-Alive
      • Session
      • Cookie
        • how to create cookie
    • HTTP Health Checks(HTTP健康检查)
      • Server Slow Start(服务慢开始)
      • Passive Health Checks(被动健康检查)
      • Active Health Checks(主动健康检查)
    • TCP Health Checks(TCP健康检查)
      • Passive TCP Health Checks(被动的TCP健康检查)
      • Active TCP Health Checks(主动的TCP健康检查)
      • Fine-Tuning TCP Health Checks
    • Massively Scalable Content Caching(内容缓存)

nginx简介

https://nginx.org/

Nginx是一个轻量级、高性能、稳定性高、并发性好的HTTP和反向代理服务器。由俄罗斯的程序设计师Igor Sysoev所开发,官方测试nginx能够支支撑5万并发链接,并且cpu、内存等资源消耗却非常低,运行非常稳定。

Nginx的应用场景

  1. http服务器。Nginx是一个http服务可以独立提供http服务,可以做网页静态服务器。
  2. 虚拟主机。可以实现在一台服务器虚拟出多个网站。例如个人网站使用的虚拟主机。
    • 基于端口的,不同的端口
    • 基于域名的,不同域名
  3. 反向代理,负载均衡。当网站的访问量达到一定程度后,单台服务器不能满足用户的请求时,需要用多台服务器集群可以使用nginx做反向代理。并且多台服务器可以平均分担负载,不会因为某台服务器负载高宕机而某台服务器闲置的情况。

正向代理&反向代理

-正向代理反向代理
代理服务器位置客户端与服务都能连接的们位置目标服务器内部
主要作用屏蔽客户端IP、集中式缓存、解决客户端不能直连服务端的问题。屏蔽服务端内部实现、负载均衡、缓存。
应用场景爬虫、翻墙、maven 的nexus 服务Nginx 、Apache负载均衡应用

正向代理

其实是"代理服务器"代理了"客户端",去和"目标服务器"进行交互;正向代理的用途如下

  • 突破访问限制

通过代理服务器,可以突破自身IP访问限制,访问国外网站,教育网等。即,租客可以通过中介,来解决无法联系上房东的问题。

  • 提高访问速度

通常代理服务器都设置一个较大的硬盘缓冲区,会将部分请求的响应保存到缓冲区中,当其他用户再访问相同的信息时, 则直接由缓冲区中取出信息,传给用户,以提高访问速度。即,中介手里留存了很多房源信息和钥匙,可以直接带租客去看房。

  • 隐藏客户端真实IP

上网者也可以通过这种方法隐藏自己的IP,免受攻击。即,房东并不知道租客的真实身份。PS:但是中介知道了,可能骚扰更多….

反向代理

其实是"代理服务器"代理了"目标服务器",去和"客户端"进行交互。要点如下

  • 隐藏服务器真实IP
  • 负载均衡
  • 提高访问速度:反向代理服务器可以对于静态内容及短时间内有大量访问请求的动态内容提供缓存服务,提高访问速度。
  • 提供安全保障

What Is a Reverse Proxy Server?

nginx reverse proxy docs

A proxy server is a go‑between or intermediary server that forwards requests for content from multiple clients to different servers across the Internet. A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.

单词短语解释
intermediaryadj.中间人的; 调解的; 居间的; 媒介的; n. 中间人; 媒介; 调解人; 中间阶段
go‑between中间人
firewalln.防火墙;vt.用作防火墙;
backend server后端服务器
smoothadj.光滑的; 流畅的; 柔软的; 温和的,安详的;vt.使平滑; 排除,消除; 安抚,平息; 使优雅;vi.变平和,变缓和;;n.平地,平面;
forwardsadv.向前方,继续向前;v.促进( forward的第三人称单数 ); (按新地址)转寄; 发送; 助长;

Common uses for a reverse proxy server include:

  • Load balancing – A reverse proxy server can act as a “traffic cop”, sitting in front of your backend servers and distributing client requests across a group of servers in a manner that maximizes speed and capacity utilization while ensuring no one server is overloaded, which can degrade performance. If a server goes down, the load balancer redirects traffic to the remaining online servers.

  • Web acceleration – Reverse proxies can compress inbound and outbound data, as well as cache commonly requested content, both of which speed up the flow of traffic between clients and servers. They can also perform additional tasks such as SSL encryption to take load off of your web servers, thereby boosting their performance.

  • Security and anonymity – By intercepting requests headed for your backend servers, a reverse proxy server protects their identities and acts as an additional defense against security attacks. It also ensures that multiple servers can be accessed from a single record locator or URL regardless of the structure of your local area network.

单词短语解释
Load balancing负载均衡
Web acceleration网络加速
Security and anonymity安全和匿名
degradevt.降低,贬低; 使降级; 降低…身份; 使丢脸;vt.& vi.(使)退化,降解,分解; 降解; 撤职,免职; 降低品格[身价,价值(等)]
traffic copn.<美口>交通警察;
inboundadj.回内地的; 归本国的; 到达的; 入境的
outboundadj.开往外地的,开往外国的;
take load off卸下包袱
boostvt.促进,提高; 增加; 吹捧; 向上推起;vi.宣扬; [美国俚语](尤指在商店)行窃,偷窃;n.提高,增加; 帮助; 吹捧; 加速[助推]器

High-Performance Load Balancing (负载均衡)

  • multiple copies of the same system
  • horizontal scaling(水平扩展)

Problem(问题)

You need to distribute load between two or more HTTP servers.

(需要解决的是:将用户请求分发到 2 台以上 HTTP 服务器)

Solution(解决方案)

  • 将后端请求路由到2个服务器,并配置权重
upstream backend {server 10.10.12.45:80 weight=1;server app.example.com:80 weight=2;
}
server {location / {proxy_pass http://backend;}
}
单词短语解释
upstreamadj.向上游的; 逆流而上的; (石油工业等)上游的;adv.向上游; 逆流地;n.上游部门;
  • 如下,默认使用Round Robin使用两台服务器
http {upstream backend {server backend1.example.com;server backend2.example.com;server 192.0.0.1 backup;}server {location / {proxy_pass http://backend;}}
}

常见负载均衡算法

Round Robin(轮询)

This is the default load-balancing method, which distributes requests in the order of the list of servers in the upstream pool.You can also take weight into consideration for a weighted round robin, which you can use if the capacity of the upstream servers varies. The higher the integer value for the weight, the more favored the server will be in the round robin. The algorithm behind weight is simply statistical probability of a weighted average.

将请求按顺序轮流分配到后台服务器上,均衡的对待每一台服务器,而不关心服务器实际的连接数和当前的系统负载。也可以考虑假如权重。

Weight Round Robin(加权轮询)
Least connections(最小连接数)

This method balances load by proxying the current request to the upstream server with the least number of open connections.Least connections, like round robin, also takes weights into account when deciding to which server to send the connection. The directive name is least_conn.

由于后台服务器的配置不尽相同,对请求的处理有快有慢,它正是根据后端服务器当前的连接情况,动态的选取其中当前积压连接数最少的一台服务器来处理当前请求,尽可能的提高后台服务器利用率,将负载合理的分流到每一台服务器。

Least time(最短响应时间负载均衡算法)

Available only in NGINX Plus, least time is akin to least connections in that it proxies to the upstream server with the least number of current connections but favors the servers with the lowest average response times. This method is one of the most sophisticated load-balancing algorithms and fits the needs of highly performant web applications. This algorithm is a valueadd over least connections because a small number of connections does not necessarily mean the quickest response. A parameter of header or last_byte must be specified for this directive. When header is specified, the time to receive the response header is used. When last_byte is specified, the time to receive the full response is used. The directive name is least_time.

将请求 分发给平均响应时间更短的应用服务器。它是负载均衡算法最复杂的算法 之一,能够适用于需要高性能的 Web 服务器负载均衡的业务场景。该算法 是对最少连接数负载均衡算法的优化实现,因为最少的访问连接并非意味着 更快的响应。该指令的配置名称是 least_time。

Generic hash(哈希)

The administrator defines a hash with the given text, variables of the request or runtime, or both. NGINX distributes the load among the servers by producing a hash for the current request and placing it against the upstream servers. This method is very useful when you need more control over where requests are sent or for determining which upstream server most likely will have the data cached. Note that when a server is added or removed from the pool, the hashed requests will be redistributed. This algorithm has an optional parameter, consistent, to minimize the effect of redistribution. The directive name is hash.

缓存使用,一致性哈希问题

Random

This method is used to instruct NGINX to select a random server from the group, taking server weights into consideration. The optional two [method] parameter directs NGINX to randomly select two servers and then use the provided loadbalancing method to balance between those two. By default the least_conn method is used if two is passed without a method. The directive name for random load balancing is random.

IP hash

This method works only for HTTP. IP hash uses the client IP address as the hash. Slightly different from using the remote variable in a generic hash, this algorithm uses the first three octets of an IPv4 address or the entire IPv6 address. This method ensures that clients are proxied to the same upstream server as long as that server is available, which is extremely helpful when the session state is of concern and not handled by shared memory of the application. This method also takes the weight parameter into consideration when distributing the hash. The directive name is ip_hash.

  • 通过客户端请求ip进行hash,再通过hash值选择后端server

当你服务端的一个特定url路径会被同一个用户连续访问时,如果负载均衡策略还是轮询的话,那该用户的多次访问会被打到各台服务器上,这显然并不高效(会建立多次http链接等问题)。甚至考虑一种极端情况,用户需要分片上传文件到服务器下,然后再由服务器将分片合并,这时如果用户的请求到达了不同的服务器,那么分片将存储于不同的服务器目录中,导致无法将分片合并。所以,此类场景可以考虑采用nginx提供的ip_hash策略。既能满足每个用户请求到同一台服务器,又能满足不同用户之间负载均衡。

URL hash

一般来讲,要用到url hash,是要配合缓存命中来使用。举一个我遇到的实例:有一个服务器集群A,需要对外提供文件下载,由于文件上传量巨大,没法存储到服务器磁盘中,所以用到了第三方云存储来做文件存储。服务器集群A收到客户端请求之后,需要从云存储中下载文件然后返回,为了省去不必要的网络带宽和下载耗时,在服务器集群A上做了一层临时缓存(缓存一个月)。由于是服务器集群,所以同一个资源多次请求,可能会到达不同的服务器上,导致不必要的多次下载,缓存命中率不高,以及一些资源时间的浪费。在此类场景下,为了使得缓存命中率提高,很适合使用url_hash策略,同一个url(也就是同一个资源请求)会到达同一台机器,一旦缓存住了资源,再此收到请求,就可以从缓存中读取,既减少了带宽,也减少的下载时间。

TCP/UDP load balance

Load balancing refers to efficiently distributing network traffic across multiple backend servers.

In NGINX Plus Release 5 and later, NGINX Plus can proxy and load balance Transmission Control Protocol) (TCP) traffic. TCP is the protocol for many popular applications and services, such as LDAP, MySQL, and RTMP.

In NGINX Plus Release 9 and later, NGINX Plus can proxy and load balance UDP traffic. UDP (User Datagram Protocol) is the protocol for many popular non-transactional applications, such as DNS, syslog, and RADIUS.

cookie & session

http无连接和Keep-Alive

HTTP的设计者有意利用这种特点将协议设计为请求时建连接、请求完释放连接,以尽快将资源释放出来服务其他客户端。随着时间的推移,网页变得越来越复杂,里面可能嵌入了很多图片,这时候每次访问图片都需要建立一次 TCP 连接就显得很低效。后来,Keep-Alive 被提出用来解决这效率低的问题。

我们知道HTTP协议采用"请求-应答"模式,当使用非KeepAlive模式时,每个请求/应答客户和服务器都要新建一个连接,完成之后立即断开连接;当使用Keep-Alive模式时,Keep-Alive功能使客户端到服务器端的连接持续有效,当出现对服务器的后继请求时,Keep-Alive功能避免了建立或者重新建立连接。

http 1.0中默认是关闭的,需要在http头加入”Connection: Keep-Alive”,才能启用Keep-Alive;

http 1.1中默认启用Keep-Alive,如果加入"Connection: close",才关闭,目前大部分浏览器都是用http1.1协议,也就是说默认都会发起Keep-Alive的连接请求了。Keep-Alive不会永久保持连接,它有一个保持时间。

Session

A session creates a file in a temporary directory on the server where registered session variables and their values are stored. This data will be available to all pages on the site during that visit.

A session ends when the user closes the browser or after leaving the site, the server will terminate the session after a predetermined period of time, commonly 30 minutes duration.

Cookie

mozilla doc of cookie

An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to the user’s web browser. The browser may store it and send it back with the next request to the same server. Typically, it’s used to tell if two requests came from the same browser — keeping a user logged-in, for example. It remembers stateful information for the stateless HTTP protocol.

Cookies are mainly used for three purposes:

  • Session management

Logins, shopping carts, game scores, or anything else the server should remember

  • Personalization

User preferences, themes, and other settings

  • Tracking

Recording and analyzing user behavior

how to create cookie

When receiving an HTTP request, a server can send a Set-Cookie header with the response. The cookie is usually stored by the browser, and then the cookie is sent with requests made to the same server inside a Cookie HTTP header. An expiration date or duration can be specified, after which the cookie is no longer sent. Additionally, restrictions to a specific domain and path can be set, limiting where the cookie is sent.

HTTP Health Checks(HTTP健康检查)

Server Slow Start(服务慢开始)

A recently recovered server can be easily overwhelmed by connections, which may cause the server to be marked as unavailable again. Slow start allows an upstream server to gradually recover its weight from zero to its nominal value after it has been recovered or became available. This can be done with the slow_start parameter of the the upstream server directive:

upstream backend {server backend1.example.com slow_start=30s;server backend2.example.com;server 192.0.0.1 backup;
}

Note that if there is only a single server in a group, the slow_start parameter is ignored and the server is never marked unavailable. Slow start is exclusive to NGINX Plus.

Passive Health Checks(被动健康检查)

For passive health checks, NGINX and NGINX Plus monitor transactions as they happen, and try to resume failed connections. If the transaction still cannot be resumed, NGINX Open Source and NGINX Plus mark the server as unavailable and temporarily stop sending requests to it until it is marked active again.

Active Health Checks(主动健康检查)

NGINX Plus can periodically check the health of upstream servers by sending special health‑check requests to each server and verifying the correct response.

TCP Health Checks(TCP健康检查)

NGINX and NGINX Plus can continually test your TCP upstream servers, avoid the servers that have failed, and gracefully add the recovered servers into the load‑balanced group.

Passive TCP Health Checks(被动的TCP健康检查)

If an attempt to connect to an upstream server times out or results in an error, NGINX Open Source or NGINX Plus can mark the server as unavailable and stop sending requests to it for a defined amount of time. To define the conditions under which NGINX considers an upstream server unavailable, include the following parameters to the server directive

  1. fail_timeout – The amount of time within which a specified number of connection attempts must fail for the server to be considered unavailable. Also, the amount of time that NGINX considers the server unavailable after marking it so.

  2. max_fails – The number of failed attempts that happen during the specified time for NGINX to consider the server unavailable.

Active TCP Health Checks(主动的TCP健康检查)

NGINX Plus sends special health check requests to each upstream server and checks for a response that satisfies certain conditions. If a connection to the server cannot be established, the health check fails, and the server is considered unhealthy. NGINX Plus does not proxy client connections to unhealthy servers. If several health checks are configured for an upstream group, the failure of any check is enough to consider the corresponding server unhealthy.

Fine-Tuning TCP Health Checks

单词短语解释
fine-tuningv.调整,使有规则( fine-tune的现在分词 );

By default, NGINX Plus tries to connect to each server in an upstream server group every 5 seconds. If the connection cannot be established, NGINX Plus considers the health check failed, marks the server as unhealthy, and stops forwarding client connections to the server.

  • interval – How often (in seconds) NGINX Plus sends health check requests (default is 5 seconds)

  • passes – Number of consecutive health checks the server must respond to to be considered healthy (default is 1)

  • fails – Number of consecutive health checks the server must fail to respond to to be considered unhealthy (default is 1)

Massively Scalable Content Caching(内容缓存)

单词短语解释
massiveadj.大的,重的; 大块的,大量的; 魁伟的,结实的; 大规模的

Caching accelerates content serving by storing request responses to be served again in the future. Content caching reduces load to upstream servers, caching the full response rather than running computations and queries again for the same request. Caching increases performance and reduces load, meaning you can served faster with fewer resources. Scaling and distributing caching servers in strategic locations can have a dramatic effect on user experience. It’s optimal to host content close to the consumer for the best performance. You can also cache your content close to your users. This is the pattern of content delivery networks, or CDNs. With NGINX you’re able to cache your content wherever you can place an NGINX server, effectively enabling you to create your own CDN. With NGINX caching, you’re also able to passively cache and serve cached responses in the event of an upstream failure.

通过对请求的响应结果进行缓存,能够为后续相同请求提供加速服务。对相同请求 响应内容进行内容缓存(Content Caching),相比每次请求都重新计算和查询被代理 服务器,能有效降低被代理服务器负载。内容缓存能提升服务性能,降低服务器负载压力,同时意味着能够使用更少的资源提供更快的服务。可伸缩的缓存服务从架构 层面来讲,能够显著提升用户体验,因为响应内容经过更少的转发就能够发送给用户,同时能提升服务器性能。

Web缓存类型描述
数据库缓存当web应用关系复杂,数据表蹭蹭蹭往上涨时,可以将查询后的数据放到内存中进行缓存,下次再查询时,就直接从内存缓存中获取,从而提高响应速度。
CDN缓存当我们发送一个web请求时,CDN会帮我们计算去哪得到这些内容的路径短且快。这个是网站管理员部署的,所以他们也可以将大家经常访问的内容放在CDN里,从而加快响应。
代理服务器缓存代理服务器缓存,跟浏览器缓存性质类似,但是代理服务器缓存面向的群体更广,规模更大。它不只为一个用户服务,一般为大量用户提供服务,同一个副本会被重用多次,因此在减少响应时间和带宽使用方面很有效。
浏览器缓存每个浏览器都实现了 HTTP 缓存,我们通过浏览器使用HTTP协议与服务器交互的时候,浏览器就会根据一套与服务器约定的规则进行缓存工作。当我们在浏览器中点击前进和后退 按钮时,利用的便是浏览器的缓存机制。

相关文章:

nginx基础http基础

目录 nginx简介正向代理&反向代理正向代理反向代理What Is a Reverse Proxy Server? High-Performance Load Balancing &#xff08;负载均衡&#xff09;Problem&#xff08;问题&#xff09;Solution(解决方案)常见负载均衡算法Round Robin&#xff08;轮询&#xff09;…...

5. MySQL 存储引擎(详解说明)

5. MySQL 存储引擎(详解说明) 文章目录 5. MySQL 存储引擎(详解说明)1. 查看存储引擎2. 设置系统默认的存储引擎3. 设置表的存储引擎3.1 创建表时指定存储引擎3.2 修改表的存储引擎 4. 引擎介绍4.1 InnoDB 引擎&#xff1a;具备外键支持功能的事务存储引擎4.2 MyISAM 引擎&…...

基于LabVIEW的伺服阀高频振动测试闭环控制系统

为实现伺服阀在设定位置上下快速移动&#xff08;1kHz控制频率&#xff09;的振动测试目标&#xff0c;需构建基于LabVIEW的闭环控制系统。系统需满足高速数据采集、实时控制算法&#xff08;如PID或自适应控制&#xff09;、高精度电流驱动及传感器反馈处理等需求。结合用户提…...

97.在 Vue 3 中使用 OpenLayers 根据两行根数 (TLE) 计算并显示卫星轨迹(EPSG:3857)

前言 在许多卫星应用场景中&#xff0c;我们需要 基于 TLE&#xff08;Two-Line Element Set, 两行根数&#xff09;计算卫星轨迹&#xff0c;并在地图上进行可视化。本文将使用 Vue 3 OpenLayers satellite.js&#xff0c;实现 实时计算卫星轨迹&#xff0c;并在地图上动态更…...

Android Coil总结

文章目录 Android Coil总结概述添加依赖用法基本用法占位图变形自定义ImageLoader取消加载协程支持缓存清除缓存监听 简单封装 Android Coil总结 概述 Coil 是一个用于 Android 的 Kotlin 图像加载库&#xff0c;旨在简化图像加载和显示的过程。它基于 Kotlin 协程&#xff0…...

fastjson漏洞#不出网#原理#流量特征

原理 本质是java的反序列化漏洞&#xff0c;由于引进了自动检测类型的&#xff08;autotype&#xff09;功能&#xff0c;fastjson在对json字符串反序列化的时候&#xff0c;会读取type内容&#xff0c;会试图将json内容反序列化成这个对象&#xff0c;并调用这个类的setter方…...

云计算:虚拟化、容器化与云存储技术详解

在上一篇中,我们深入探讨了网络安全的核心技术,包括加密、认证和防火墙,并通过实际案例和细节帮助读者全面理解这些技术的应用和重要性。今天,我们将转向一个近年来迅速发展的领域——云计算。云计算通过提供按需访问的计算资源,彻底改变了IT基础设施的构建和管理方式。本…...

使用 marked.min.js 实现 Markdown 编辑器 —— 我的博客后台选择之旅

最近&#xff0c;我决定为个人博客后台换一个编辑器。之前的富文本编辑器虽然功能齐全&#xff0c;但生成的 HTML 代码繁杂&#xff0c;维护起来非常麻烦。为了追求更简洁高效的写作体验&#xff0c;我开始研究 Markdown 编辑器&#xff0c;并最终选择了 marked.min.js。 1. 传…...

Linux系统基于ARM平台的LVGL移植

软硬件介绍&#xff1a;Ubuntu 20.04 ARM 和&#xff08;Cortex-A53架构&#xff09;开发板 基本原理 LVGL图形库是支持使用Linux系统的Framebuffer帧缓冲设备实现的&#xff0c;如果想要实现在ARM开发板上运行LVGL图形库&#xff0c;那么就需要把LVGL图形库提供的关于帧缓冲设…...

LeetCode 2070.每一个查询的最大美丽值:排序 + 二分查找

【LetMeFly】2070.每一个查询的最大美丽值&#xff1a;排序 二分查找 力扣题目链接&#xff1a;https://leetcode.cn/problems/most-beautiful-item-for-each-query/ 给你一个二维整数数组 items &#xff0c;其中 items[i] [pricei, beautyi] 分别表示每一个物品的 价格 和…...

电力场景绝缘子缺陷分割数据集labelme格式1585张4类别

数据集格式&#xff1a;labelme格式(不包含mask文件&#xff0c;仅仅包含jpg图片和对应的json文件) 图片数量(jpg文件个数)&#xff1a;1585 标注数量(json文件个数)&#xff1a;1585 标注类别数&#xff1a;4 标注类别名称:["broken part","broken insulat…...

【计算机网络】深入解析 HTTP 协议的概念、工作原理和通过 Fiddler 抓包查看 HTTP 请求/响应的协议格式

网络原理— HTTP 1. 什么是HTTP? HTTP(全称为"超文本传输协议")是一种应用非常广泛的应用层协议&#xff1a; HTTP 往往是基于传输层的 TCP 协议实现的 (HTTP1.0,HTTP1.1,HTTP2.0 均为TCP,HTTP3基于UDP实现) 我们平时打开一个网站&#xff0c;就是通过HTTP协议来…...

IPFS:下一代互联网传输协议

IPFS&#xff1a;下一代互联网传输协议 1. 引言2. IPFS概述3. IPFS的核心优势3.1 去中心化3.2 高效性3.3 安全性3.4 持久性3.5 可扩展性 4. IPFS的工作原理4.1 内容寻址4.2 分布式哈希表&#xff08;DHT&#xff09;4.3 文件分块4.4 版本控制4.5 网络协议 5. IPFS的应用场景5.1…...

线上接口tp99突然升高如何排查?

当线上接口的 TP99 突然升高时&#xff0c;意味着该接口在 99% 的情况下响应时间变长&#xff0c;这可能会严重影响系统的性能和用户体验。可以按照下面的步骤进行排查。这里我们先说明一下如何计算tp99&#xff1a;监控系统计算 TP99&#xff08;第 99 百分位数的响应时间&…...

SpringBoot优雅关机,监听关机事件,docker配置

Spring Boot 提供了多种方法来实现优雅停机&#xff08;Graceful Shutdown&#xff09;&#xff0c;这意味着在关闭应用程序之前&#xff0c;它会等待当前正在处理的请求完成&#xff0c;并且不再接受新的请求。 一、优雅停机的基本概念 优雅停机的主要步骤如下&#xff1a; …...

在【k8s】中部署Jenkins的实践指南

&#x1f407;明明跟你说过&#xff1a;个人主页 &#x1f3c5;个人专栏&#xff1a;《Kubernetes航线图&#xff1a;从船长到K8s掌舵者》 &#x1f3c5; &#x1f516;行路有良友&#xff0c;便是天堂&#x1f516; 目录 一、引言 1、Jenkins简介 2、k8s简介 3、什么在…...

Unity DOTS从入门到精通之 C# Job System

文章目录 前言安装 DOTS 包C# 任务系统Mono 环境DOTS 环境运行作业NativeContainer 前言 作为 DOTS 教程&#xff0c;我们将创建一个旋转立方体的简单程序&#xff0c;并将传统的 Unity 设计转换为 DOTS 设计。 Unity 2022.3.52f1Entities 1.3.10 安装 DOTS 包 要安装 DOTS…...

Spring Boot 本地缓存工具类设计与实现

在 Spring Boot 应用中&#xff0c;缓存是提升性能的重要手段之一。为了更方便地使用缓存&#xff0c;我们可以设计一套通用的本地缓存工具类&#xff0c;封装常见的缓存操作&#xff0c;简化开发流程。本文将详细介绍如何设计并实现一套 Spring Boot 本地缓存工具类&#xff0…...

【Godot4.4】浅尝Godot中的MVC

概述 基于一个Unity的视频。学习了一下基本的MVC概念&#xff0c;并尝试在Godot中实现了一下。 原始的MVC&#xff1a; Godot中的MVC&#xff1a; Model、View和Controller各自应该实现的功能如下&#xff1a; Model: 属性(数据字段)数据存取方法数据更新信号 View: 控…...

如何解决前端的竞态问题

前端的竞态问题通常是指多个异步操作的响应顺序与发起顺序不一致&#xff0c;导致程序出现不可预测的结果。这种问题在分页、搜索、选项卡切换等场景中尤为常见。以下是几种常见的解决方法&#xff1a; 1. 取消过期请求 当用户发起新的请求时&#xff0c;取消之前的请求&…...

Elasticsearch为索引设置自动时间戳,ES自动时间戳

文章目录 0、思路1、配置 ingest pipeline2、在索引映射中启用_source字段的时间戳3、使用 index template 全局设置时间戳4、写入测试数据5、验证结果6、总结 在使用 Elasticsearch 进行数据存储和检索时&#xff0c;时间戳字段是一个非常重要的组成部分。它可以帮助我们追踪数…...

计算机网络:计算机网络的组成和功能

计算机网络的组成&#xff1a; 计算机网络的工作方式&#xff1a; 计算机网络的逻辑功能; 总结&#xff1a; 计算机网络的功能&#xff1a; 1.数据通信 2.资源共享 3.分布式处理:计算机网络的分布式处理是指将计算任务分散到网络中的多个节点&#xff08;计算机或设备&…...

FPGA设计时序约束用法大全保姆级说明

目录 一、序言 二、时序约束概览 2.1 约束五大类 2.2 约束功能简述 2.3 跨时钟域约束 三、时序约束规范 3.1 时序约束顺序 3.2 约束的优先级 四、约束示例 4.1 设计代码 4.2 时序结果 4.2.1 create_clock 4.2.2 create_generated_clock 4.2.3 Rename_Auto-Derive…...

云服务运维智能时代:阿里云操作系统控制台

阿里云操作系统控制台 引言需求介绍操作系统使用实例获得的帮助与提升建议 引言 阿里云操作系统控制台是一款创新型云服务器运维工具&#xff0c;专为简化用户的运维工作而设计。它采用智能化和可视化的方式&#xff0c;让运维变得更加高效、直观。借助AI技术&#xff0c;控制…...

硬件学习笔记--48 磁保持继电器相关基础知识介绍

目录 1.磁保持继电器工作原理 2.磁保持继电器内部结构及组成部分 3.磁保持继电器主要参数 4.总结 1.磁保持继电器工作原理 磁保持继电器利用永磁体的磁场和线圈通电产生的磁场相互作用&#xff0c;实现触点的切换。其特点在于线圈断电后&#xff0c;触点状态仍能保持&#…...

【云岚到家】-实战问题(上)

【云岚到家】-实战问题&#xff08;上&#xff09; 基础架构项目涉及那些角色云岚的业务流程&#xff1f;云岚家政包括那些模块项目采用什么架构如何开发一个接口&#xff1f;RESTful风格的去定义一个接口如何开发一个接口的service方法接口的异常处理怎么实现的&#xff1f;Sp…...

简记_硬件系统设计之需求分析要点

目录 一、 功能需求 二、 整体性能需求 三、 用户接口需求 四、 功耗需求 五、 成本需求 六、 IP和NEMA防护等级需求 七、 认证需求 功能需求 供电方式及防护 供电方式&#xff1a;市电供电、外置直流稳压电源供电、电池供电、PoE&#xff08;Power Over Ether…...

K8s 1.27.1 实战系列(五)Namespace

Kubernetes 1.27.1 中的 ​Namespace​(命名空间)是集群中实现多租户资源隔离的核心机制。以下从功能、操作、配置及实践角度进行详细解析: 一、核心功能与特性 ​1、资源隔离 Namespace 将集群资源划分为逻辑组,实现 Pod、Service、Deployment 等资源的虚拟隔离。例如,…...

ubuntu 20.04下ZEDmini安装使用

提前安装好显卡驱动和cuda&#xff0c;如果没有安装可以参考我的这两篇文章进行安装&#xff1a; ubuntu20.04配置YOLOV5&#xff08;非虚拟机&#xff09;_ubuntu20.04安装yolov5-CSDN博客 ubuntu20.04安装显卡驱动及问题总结_乌班图里怎么备份显卡驱动-CSDN博客 还需要提前…...

Deepseek可以通过多种方式帮助CAD加速工作

自动化操作&#xff1a;通过Deepseek的AI能力&#xff0c;可以编写脚本来自动化重复性任务。例如&#xff0c;使用Python脚本调用Deepseek API&#xff0c;在CAD中实现自动化操作。 插件开发&#xff1a;结合Deepseek进行二次开发&#xff0c;可以创建自定义的CAD插件。例如&a…...