CN105959413B - Network proxy method and proxy system - Google Patents
Network proxy method and proxy system Download PDFInfo
- Publication number
- CN105959413B CN105959413B CN201610510314.5A CN201610510314A CN105959413B CN 105959413 B CN105959413 B CN 105959413B CN 201610510314 A CN201610510314 A CN 201610510314A CN 105959413 B CN105959413 B CN 105959413B
- Authority
- CN
- China
- Prior art keywords
- server
- proxy
- access request
- region
- server cluster
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Abstract
本发明提供了一种用于网络的代理方法,包括:对访问请求执行域名解析,将该访问请求解析至多个代理服务器中的第一代理服务器,该多个代理服务器部署于不同的地域;以及由该第一代理服务器基于自身的配置信息将该访问请求代理至首选地域内的服务器集群。
The present invention provides a proxy method for a network, comprising: performing domain name resolution on an access request, resolving the access request to a first proxy server among a plurality of proxy servers, the plurality of proxy servers being deployed in different regions; and proxying the access request by the first proxy server to a server cluster in a preferred region based on its own configuration information.
Description
技术领域technical field
本发明涉及互联网技术,尤其涉及网络代理方法和代理系统。The present invention relates to Internet technology, in particular to a network proxy method and proxy system.
背景技术Background technique
网络代理功能是由代理服务器执行的一项常见互联网功能,即代理网络用户去取得网络信息。形象的说,代理服务器是网络信息的中转站。在一般情况下,我们使用客户端,例如网络浏览器直接去连接其他Internet站点取得网络信息时,须送出访问请求来得到回答,然后对方再把信息传送回来。代理服务器是介于浏览器和Web服务器之间的一台服务器,有了它之后,浏览器不是直接到Web服务器去取回网页而是向代理服务器发出请求。访问请求会先送到代理服务器,由代理服务器来取回浏览器所需要的信息并传送给你的浏览器。而且,大部分代理服务器都具有缓冲的功能,就像一个大的Cache,它有很大的存储空间,它不断将新取得数据储存到它本机的存储器上,如果浏览器所请求的数据在它本机的存储器上已经存在而且是最新的,那么它就不重新从Web服务器取数据,而直接将存储器上的数据传送给用户的浏览器,这样就能显著提高浏览速度和效率。The network proxy function is a common Internet function performed by a proxy server, that is, proxy network users to obtain network information. To put it figuratively, a proxy server is a transfer station for network information. Under normal circumstances, when we use a client, such as a web browser, to directly connect to other Internet sites to obtain network information, we must send an access request to get an answer, and then the other party sends the information back. The proxy server is a server between the browser and the web server. With it, the browser does not directly go to the web server to retrieve the web page but sends a request to the proxy server. The access request will be sent to the proxy server first, and the proxy server will retrieve the information required by the browser and transmit it to your browser. Moreover, most proxy servers have the function of buffering, like a large Cache, which has a large storage space, and it continuously stores the newly obtained data to its local memory. If the data requested by the browser is in the Its local memory already exists and is up-to-date, so it does not fetch data from the Web server again, but directly transmits the data in the memory to the user's browser, which can significantly improve browsing speed and efficiency.
发明内容SUMMARY OF THE INVENTION
以下给出一个或多个方面的简要概述以提供对这些方面的基本理解。此概述不是所有构想到的方面的详尽综览,并且既非旨在指认出所有方面的关键性或决定性要素亦非试图界定任何或所有方面的范围。其唯一的目的是要以简化形式给出一个或多个方面的一些概念以为稍后给出的更加详细的描述之序。A brief summary of one or more aspects is presented below to provide a basic understanding of the aspects. This summary is not an exhaustive overview of all contemplated aspects and is neither intended to identify key or critical elements of all aspects nor attempt to delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.
根据本发明的一方面,提供了一种用于网络的代理方法,包括:According to an aspect of the present invention, there is provided a proxy method for a network, comprising:
对访问请求执行域名解析,将该访问请求解析至多个代理服务器中的第一代理服务器,该多个代理服务器部署于不同的地域;以及Performing domain name resolution on the access request, and resolving the access request to a first proxy server among multiple proxy servers, the multiple proxy servers being deployed in different regions; and
由该第一代理服务器基于自身的配置信息将该访问请求代理至首选地域内的服务器集群。The first proxy server proxies the access request to a server cluster in the preferred region based on its own configuration information.
在一实例中,该执行域名解析包括:基于该访问请求的发起位置将该访问请求解析至该第一代理服务器,该访问请求的发起位置落在该第一代理服务器所处的第一地域内。In an example, the performing domain name resolution includes: resolving the access request to the first proxy server based on the originating location of the access request, where the originating location of the access request falls within the first region where the first proxy server is located .
在一实例中,基于该配置信息,该首选地域内的服务器集群为该第一地域内的服务器集群。In one example, based on the configuration information, the server cluster in the preferred region is the server cluster in the first region.
在一实例中,该将该访问请求代理至首选地域内的服务器集群进一步包括:基于负载均衡策略将该访问请求代理至该首选地域内的服务器集群中的一服务器。In an example, the proxying the access request to a server cluster in the preferred region further includes: proxying the access request to a server in the server cluster in the preferred region based on a load balancing policy.
在一实例中,该将该访问请求代理至首选地域内的服务器集群进一步包括:若所代理到的该服务器响应异常,则再次基于负载均衡策略将该访问请求代理至该首选地域内的服务器集群中的其他服务器直至该访问请求得到正常响应。In an example, the proxying the access request to the server cluster in the preferred region further includes: if the proxyed server responds abnormally, proxying the access request to the server cluster in the preferred region based on the load balancing policy again other servers in the server until the access request gets a normal response.
在一实例中,该将该访问请求代理至首选地域内的服务器集群进一步包括:若该首选地域内的服务器集群中的所有服务器均响应异常,则由该第一代理服务器基于自身的配置信息将该访问请求代理至另一地域内的服务器集群。In an example, the proxying the access request to the server cluster in the preferred region further includes: if all the servers in the server cluster in the preferred region respond abnormally, the first proxy server will send the proxy server based on its own configuration information. The access request is proxied to a server cluster in another region.
在一实例中,该代理方法还包括:在将该访问请求代理至另一地域内的服务器集群并且该访问请求得到正常响应之后,修改该配置信息以将该另一地域配置为首选地域。In one example, the proxy method further includes: after proxying the access request to a server cluster in another region and the access request is normally responded, modifying the configuration information to configure the other region as a preferred region.
在一实例中,该负载均衡策略包括以下至少一者:轮循均衡、权重轮循均衡、随机均衡、响应速度均衡、最少连接数均衡、处理能力均衡、DNS响应均衡。In an example, the load balancing strategy includes at least one of the following: round-robin balancing, weighted round-robin balancing, random balancing, response speed balancing, least number of connections balancing, processing power balancing, and DNS response balancing.
在一实例中,该访问请求包括头部部分和主体部分,该代理方法还包括:由该第一代理服务器解析该访问请求的主体部分以获取用户ID,以用于该负载均衡策略的标识。In an example, the access request includes a header part and a body part, and the proxy method further includes: parsing, by the first proxy server, the body part of the access request to obtain a user ID, which is used for identification of the load balancing policy.
在一实例中,该第一代理服务器基于本地存储的关于该访问请求的请求格式对该访问请求的主体部分执行解析。In one example, the first proxy server performs parsing of the body portion of the access request based on a locally stored request format for the access request.
根据本发明的另一方面,提供了一种用于网络的代理系统,包括:According to another aspect of the present invention, there is provided a proxy system for a network, comprising:
域名解析服务器,用于对访问请求执行域名解析;Domain name resolution server, used to perform domain name resolution on access requests;
多个代理服务器,该多个代理服务器部署于不同的地域;Multiple proxy servers, the multiple proxy servers are deployed in different regions;
多个服务器集群,该多个服务器集群部署于不同的地域,Multiple server clusters, the multiple server clusters are deployed in different regions,
其中该域名解析服务器将该访问请求解析至该多个代理服务器中的第一代理服务器,该第一代理服务器用于基于自身的配置信息将该访问请求代理至首选地域内的服务器集群。The domain name resolution server resolves the access request to a first proxy server among the plurality of proxy servers, and the first proxy server is configured to proxy the access request to a server cluster in a preferred region based on its own configuration information.
在一实例中,该域名解析服务器基于该访问请求的发起位置将该访问请求解析至该第一代理服务器,该访问请求的发起位置落在该第一代理服务器所处的第一地域内。In an example, the domain name resolution server resolves the access request to the first proxy server based on the originating location of the access request, and the originating location of the access request falls within the first region where the first proxy server is located.
在一实例中,基于该配置信息,该首选地域内的服务器集群为该第一地域内的服务器集群。In one example, based on the configuration information, the server cluster in the preferred region is the server cluster in the first region.
在一实例中,该第一代理服务器进一步用于基于负载均衡策略将该访问请求代理至该首选地域内的服务器集群中的一服务器。In one example, the first proxy server is further configured to proxy the access request to a server in the server cluster in the preferred region based on a load balancing policy.
在一实例中,该第一代理服务器进一步用于若所代理到的该服务器响应异常,则再次基于负载均衡策略将该访问请求代理至该首选地域内的服务器集群中的其他服务器直至该访问请求得到正常响应。In an example, the first proxy server is further configured to proxy the access request to other servers in the server cluster in the preferred region based on the load balancing policy again if the proxy server responds abnormally until the access request get a normal response.
在一实例中,该第一代理服务器进一步用于若该首选地域内的服务器集群中的所有服务器均响应异常,则基于自身的配置信息将该访问请求代理至另一地域内的服务器集群。In an example, the first proxy server is further configured to proxy the access request to a server cluster in another region based on its own configuration information if all servers in the server cluster in the preferred region respond abnormally.
在一实例中,该第一代理服务器进一步用于在将该访问请求代理至另一地域内的服务器集群并且该访问请求得到正常响应之后,修改自身的配置信息以将该另一地域配置为首选地域。In an example, the first proxy server is further configured to modify its own configuration information to configure the other region as the first choice after the access request is proxied to a server cluster in another region and the access request is normally responded. area.
在一实例中,该负载均衡策略包括以下至少一者:轮循均衡、权重轮循均衡、随机均衡、响应速度均衡、最少连接数均衡、处理能力均衡、DNS响应均衡。In an example, the load balancing strategy includes at least one of the following: round-robin balancing, weighted round-robin balancing, random balancing, response speed balancing, least number of connections balancing, processing power balancing, and DNS response balancing.
在一实例中,该访问请求包括头部部分和主体部分,该第一代理服务器还包括:解析模块,用于解析该访问请求的主体部分以获取用户ID,以用于该负载均衡策略的标识。In an example, the access request includes a header part and a body part, and the first proxy server further includes: a parsing module for parsing the body part of the access request to obtain a user ID, which is used for the identification of the load balancing strategy .
在一实例中,该第一代理服务器包括数据库,该数据库中存储有多种请求类型的请求格式,该解析模块查找该数据库以根据该用户请求的请求格式来对该访问请求的主体部分执行解析。In one example, the first proxy server includes a database in which request formats of various request types are stored, and the parsing module searches the database to perform parsing of the body portion of the access request according to the request format requested by the user .
在本发明中,通过加入地域的概念,可以单独对某一个地域代理负载,也可以配置多个地域,对多个地域进行负载代理,多个地域进行切换,提供了代理的灵活性。In the present invention, by adding the concept of regions, it is possible to independently proxy the load to a certain region, or configure multiple regions, perform load proxying for multiple regions, and switch multiple regions, which provides flexibility of the proxy.
此外,相比nginx只能从请求头信息中获取负载策略相关内容,本发明通过解析请求体信息获取负载策略内容,从而加强了负载策略,解决了一般负载策略执行方式单一的问题,从而支持代理负载均衡多样性,例如可以支持微信和webservice等多种形式。In addition, compared to nginx that can only obtain the content related to the load policy from the request header information, the present invention obtains the content of the load policy by parsing the request body information, thereby strengthening the load policy, solving the problem of a single execution mode of the general load policy, and thus supporting the proxy Load balancing diversity, for example, it can support various forms such as WeChat and webservice.
附图说明Description of drawings
在结合以下附图阅读本公开的实施例的详细描述之后,能够更好地理解本发明的上述特征和优点。在附图中,各组件不一定是按比例绘制,并且具有类似的相关特性或特征的组件可能具有相同或相近的附图标记。The above-described features and advantages of the present invention can be better understood after reading the detailed description of the embodiments of the present disclosure in conjunction with the following drawings. In the drawings, components are not necessarily drawn to scale and components with similar related characteristics or features may have the same or similar reference numbers.
图1是示出了根据本发明的一方面的代理系统的框图;1 is a block diagram illustrating a proxy system according to an aspect of the present invention;
图2是示出了根据本发明的一方面的代理方法的流程图;Figure 2 is a flowchart illustrating a proxy method according to an aspect of the present invention;
图3是示出了根据本发明的另一方面的代理系统的框图;以及3 is a block diagram illustrating a proxy system according to another aspect of the present invention; and
图4是示出了根据本发明的另一方面的代理方法的流程图。FIG. 4 is a flowchart illustrating a proxy method according to another aspect of the present invention.
具体实施方式Detailed ways
以下结合附图和具体实施例对本发明作详细描述。注意,以下结合附图和具体实施例描述的诸方面仅是示例性的,而不应被理解为对本发明的保护范围进行任何限制。The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. Note that the aspects described below in conjunction with the accompanying drawings and specific embodiments are only exemplary, and should not be construed as any limitation to the protection scope of the present invention.
图1是示出了根据本发明的一方面的代理系统100的框图。如图1所示,代理系统100可包括域名解析服务器101、代理服务器121、122、以及服务器集群131、132。1 is a block diagram illustrating a proxy system 100 according to an aspect of the present invention. As shown in FIG. 1 , the proxy system 100 may include a domain name resolution server 101 , proxy servers 121 and 122 , and server clusters 131 and 132 .
用户经由客户端发起一访问请求。这里的客户端可以是网页浏览器、APP软件如微信等等。经由客户端发起的访问请求首先经由域名解析服务器101进行域名解析。域名解析服务器101负责将访问请求解析至代理服务器121、122中的一者。The user initiates an access request via the client. The client here can be a web browser, APP software such as WeChat and so on. The access request initiated by the client first performs domain name resolution through the domain name resolution server 101 . The domain name resolution server 101 is responsible for resolving the access request to one of the proxy servers 121 and 122 .
根据本发明的一方面,借助“地域”来执行代理功能。代理服务器121、122部署于不同地域,服务器集群131、132也部署于不同的地域。在图1所示的实例中,代理服务器121、和服务器集群131部署于相同的地域1中;代理服务器122和服务器集群132部署于相同的地域2。According to one aspect of the present invention, the proxy function is performed by means of a "territory". The proxy servers 121 and 122 are deployed in different regions, and the server clusters 131 and 132 are also deployed in different regions. In the example shown in FIG. 1 , the proxy server 121 and the server cluster 131 are deployed in the same region 1; the proxy server 122 and the server cluster 132 are deployed in the same region 2.
在图1所示的实例中仅仅示出了两个地域,地域1、地域2,也仅仅示出了这两个地域的代理服务器和服务器集群,然而,本领域技术人员可以理解,可存在两个以上的地域,并且每个地域中部署相应的代理服务器和服务器集群,例如存部署于地域n中的代理服务器12n和服务器集群13n(其中n>2)(未示出)。In the example shown in FIG. 1, only two regions are shown, region 1 and region 2, and only proxy servers and server clusters in these two regions are shown. However, those skilled in the art can understand that there may be two There are more than one region, and corresponding proxy servers and server clusters are deployed in each region, such as a proxy server 12n and a server cluster 13n (where n>2) deployed in region n (not shown).
在一实施例中,域名解析服务器101可基于访问请求的发起地址来决定将该访问请求解析至哪一个代理服务器。例如,域名解析服务器101可将访问请求解析至第一代理服务器,其中该访问请求的发起地址落在该第一代理服务器所处的地域。In one embodiment, the domain name resolution server 101 may decide which proxy server to resolve the access request to based on the originating address of the access request. For example, the domain name resolution server 101 may resolve the access request to a first proxy server, where the originating address of the access request falls in the region where the first proxy server is located.
作为示例,该第一代理服务器可以为代理服务器121,即域名解析服务器101将访问请求解析至地域1的代理服务器121。As an example, the first proxy server may be the proxy server 121, that is, the domain name resolution server 101 resolves the access request to the proxy server 121 in the domain 1.
代理服务器121例如通过监听80端口接收到该访问请求。代理服务器121可基于自身的配置信息确定将访问请求代理首选地域内的服务器集群。配置信息中可以存储有首选地域,所谓首选地域是指代理服务器121将访问请求优先代理至该首选地域的服务器集群。配置信息中还可以存储有按优先级排序的其他地域的排序列表。The proxy server 121 receives the access request by monitoring port 80, for example. The proxy server 121 may determine, based on its own configuration information, to access the server cluster in the request proxy's preferred region. A preferred region may be stored in the configuration information, and the so-called preferred region refers to a server cluster where the proxy server 121 preferentially proxies the access request to the preferred region. A sorted list of other regions sorted by priority may also be stored in the configuration information.
作为示例,正常情况下一个代理服务器的配置信息中的优选地域为该代理服务器自身所处的地域。例如对于代理服务器121而言,其首选地域为地域1,对于代理服务器122而言,首选地域为地域2。当然,配置信息中的首选地域是可以更改的,例如在首选地域的服务器集群出现宕机无法正常响应时,可以更改首选地域,这在下文详细描述。As an example, under normal circumstances, the preferred region in the configuration information of a proxy server is the region where the proxy server itself is located. For example, for the proxy server 121, its preferred region is region 1, and for the proxy server 122, its preferred region is region 2. Of course, the preferred region in the configuration information can be changed. For example, when the server cluster in the preferred region is down and cannot respond normally, the preferred region can be changed, which is described in detail below.
在图1所示的实例中,代理服务器121可基于自身配置信息将访问请求代理至地域1内的服务器集群131。In the example shown in FIG. 1 , the proxy server 121 can proxy the access request to the server cluster 131 in the domain 1 based on its own configuration information.
服务器集群131中含有多个服务器,例如服务器A、B、C、D,这里仅示出了4个服务器,然而可以理解可以存在更多个服务器。The server cluster 131 includes multiple servers, such as servers A, B, C, and D. Only four servers are shown here, but it is understood that there may be more servers.
代理服务器121可基于负载均衡策略将访问请求代理至首选地域内的服务器集群即地域1内的服务器集群131中的一服务器。The proxy server 121 can proxy the access request to a server in the server cluster in the preferred region, that is, a server in the server cluster 131 in the region 1 based on the load balancing policy.
常用的负载均衡策略包括以下几种类型:Commonly used load balancing strategies include the following types:
轮循均衡(Round Robin):每一次来自网络的请求轮流分配给内部中的服务器,从1至N然后重新开始。此种均衡算法适合于服务器组中的所有服务器都有相同的软硬件配置并且平均服务请求相对均衡的情况。Round Robin: Each time a request from the network is distributed to the internal servers in turn, from 1 to N and then restarts. This balancing algorithm is suitable for the situation that all servers in the server group have the same hardware and software configuration and the average service requests are relatively balanced.
权重轮循均衡(Weighted Round Robin):根据服务器的不同处理能力,给每个服务器分配不同的权值,使其能够接受相应权值数的服务请求。例如:服务器A的权值被设计成1,B的权值是3,C的权值是6,则服务器A、B、C将分别接受到10%、30%、60%的服务请求。此种均衡算法能确保高性能的服务器得到更多的使用率,避免低性能的服务器负载过重。Weighted Round Robin: According to the different processing capabilities of the servers, assign different weights to each server so that it can accept service requests with the corresponding weights. For example, the weight of server A is designed to be 1, the weight of B is 3, and the weight of C is 6, then servers A, B, and C will receive 10%, 30%, and 60% of service requests respectively. This balancing algorithm can ensure that high-performance servers get more utilization and avoid overloading low-performance servers.
随机均衡(Random):把来自网络的请求随机分配给内部中的多个服务器。Random Balance (Random): Randomly distribute requests from the network to multiple internal servers.
权重随机均衡(Weighted Random):此种均衡算法类似于权重轮循算法,不过在处理请求分担时是个随机选择的过程。Weighted Random: This equalization algorithm is similar to the weighted round-robin algorithm, but it is a process of random selection when processing request sharing.
响应速度均衡(Response Time):负载均衡设备对内部各服务器发出一个探测请求(例如Ping),然后根据内部中各服务器对探测请求的最快响应时间来决定哪一台服务器来响应客户端的服务请求。此种均衡算法能较好的反映服务器的当前运行状态,但这最快响应时间仅仅指的是负载均衡设备与服务器间的最快响应时间,而不是客户端与服务器间的最快响应时间。Response Time: The load balancing device sends a probe request (such as Ping) to each internal server, and then decides which server to respond to the client's service request according to the fastest response time of each internal server to the probe request . This balancing algorithm can better reflect the current running state of the server, but the fastest response time only refers to the fastest response time between the load balancing device and the server, not the fastest response time between the client and the server.
最少连接数均衡(Least Connection):客户端的每一次请求服务在服务器停留的时间可能会有较大的差异,随着工作时间加长,如果采用简单的轮循或随机均衡算法,每一台服务器上的连接进程可能会产生极大的不同,并没有达到真正的负载均衡。最少连接数均衡算法对内部中需负载的每一台服务器都有一个数据记录,记录当前该服务器正在处理的连接数量,当有新的服务连接请求时,将把当前请求分配给连接数最少的服务器,使均衡更加符合实际情况,负载更加均衡。此种均衡算法适合长时处理的请求服务,如FTP。Least Connection (Least Connection): There may be a large difference in the time that the client's service stays on the server for each request. As the working time increases, if a simple round-robin or random balancing algorithm is used, each server The connection process may vary greatly and is not truly load balanced. The least number of connections balancing algorithm has a data record for each server that needs to be loaded internally, recording the number of connections currently being processed by the server. When there is a new service connection request, the current request will be allocated to the server with the least number of connections. The server makes the balance more in line with the actual situation and the load is more balanced. This balancing algorithm is suitable for long-term processing request services, such as FTP.
处理能力均衡:此种均衡算法将把服务请求分配给内部中处理负荷(根据服务器CPU型号、CPU数量、内存大小及当前连接数等换算而成)最轻的服务器,由于考虑到了内部服务器的处理能力及当前网络运行状况,所以此种均衡算法相对来说更加精确,尤其适合运用到第七层(应用层)负载均衡的情况下。Processing capacity balancing: This balancing algorithm will allocate service requests to the server with the lightest processing load (converted according to the server CPU model, CPU number, memory size, and current number of connections, etc.), because the processing of the internal server is considered. capacity and current network operating conditions, so this balancing algorithm is relatively more accurate, and is especially suitable for use in Layer 7 (application layer) load balancing.
DNS响应均衡(Flash DNS):在Internet上,无论是HTTP、FTP或是其它的服务请求,客户端一般都是通过域名解析来找到服务器确切的IP地址的。在此均衡算法下,分处在不同地理位置的负载均衡设备收到同一个客户端的域名解析请求,并在同一时间内把此域名解析成各自相对应服务器的IP地址(即与此负载均衡设备在同一位地理位置的服务器的IP地址)并返回给客户端,则客户端将以最先收到的域名解析IP地址来继续请求服务,而忽略其它的IP地址响应。在种均衡策略适合应用在全局负载均衡的情况下,对本地负载均衡是没有意义的。DNS response balance (Flash DNS): On the Internet, whether it is HTTP, FTP or other service requests, the client generally finds the exact IP address of the server through domain name resolution. Under this balancing algorithm, the load balancing devices located in different geographical locations receive the domain name resolution request from the same client, and resolve the domain name to the IP address of their corresponding server at the same time (that is, the same as the load balancing device). The IP address of the server in the same geographic location) and return it to the client, the client will continue to request the service by resolving the IP address of the domain name received first, and ignore other IP address responses. In the case that this kind of balancing strategy is suitable for global load balancing, it is meaningless for local load balancing.
例如代理服务器121可基于负载均衡策略将访问请求代理至服务器集群131中的服务器A,若服务器A响应异常,则可再次基于负载均衡策略将访问请求代理至该服务器集群131中的其他服务器,若响应还是异常,则再次代理至该服务器集群131中的下一服务器,重复此操作直至访问请求得到正常响应。For example, the proxy server 121 can proxy the access request to the server A in the server cluster 131 based on the load balancing policy. If the server A responds abnormally, it can proxy the access request to other servers in the server cluster 131 based on the load balancing policy again. If the response is still abnormal, the server will be proxied to the next server in the server cluster 131 again, and this operation will be repeated until the access request receives a normal response.
在极端情况下,若首选地域内的服务器集群中的所有服务器都不能正常响应,则代理服务器121可基于配置信息将访问请求代理至另一地域内的服务器集群,例如配置信息中优先级仅次于首选地域的下一地域内的服务器集群。作为示例,例如可代理服务器121可将访问请求代理至地域2内的服务器集群132。In extreme cases, if all the servers in the server cluster in the preferred region cannot respond normally, the proxy server 121 may proxy the access request to the server cluster in another region based on the configuration information. For example, the priority in the configuration information is only the second Server clusters in the next region of the preferred region. As an example, proxy server 121 may proxy access requests to server cluster 132 within domain 2, for example.
若服务器集群132能够提供正常响应,则代理服务器121可修改配置信息以将首选地域改为地域2。较优地,当地域1内的服务器集群131恢复正常,代理服务器121的首选地域可以再改回地域1。If the server cluster 132 can provide a normal response, the proxy server 121 may modify the configuration information to change the preferred region to region 2. Preferably, when the server cluster 131 in the domain 1 returns to normal, the preferred domain of the proxy server 121 can be changed back to the domain 1 again.
访问请求一般包括头部部分和主体部分。如先前所述的,访问请求有可能是通过微信平台等网络平台发出的,此时,访问请求的头部部分的信息是一样的,不能作为一些普通负载策略的标示。An access request generally includes a header part and a body part. As mentioned earlier, the access request may be sent through a network platform such as WeChat platform. In this case, the information in the header of the access request is the same and cannot be used as an indicator of some common load policies.
在本发明,代理服务器可以包括数据库和解析模块(图中未示出)。数据库中可以预存有多种请求类型的请求格式。解析模块可以通过查找数据库以根据该用户请求的请求格式对访问请求的主体部分进行解析,以获取用户ID,由此可以作为负载均衡策略的标识。In the present invention, the proxy server may include a database and a parsing module (not shown in the figure). Request formats for various request types can be pre-stored in the database. The parsing module can parse the main part of the access request according to the request format of the user request by searching the database to obtain the user ID, which can be used as the identifier of the load balancing strategy.
图2是示出了根据本发明的一方面的代理方法200的流程图。如图2所示,代理方法200可包括以下步骤:FIG. 2 is a flow diagram illustrating a proxy method 200 according to an aspect of the present invention. As shown in FIG. 2, the proxy method 200 may include the following steps:
在步骤201:对访问请求执行域名解析,将访问请求解析至多个代理服务器中的第一代理服务器,该多个代理服务器部署于不同的地域。In step 201 , domain name resolution is performed on the access request, and the access request is resolved to a first proxy server among multiple proxy servers, and the multiple proxy servers are deployed in different regions.
该解析可以是基于访问请求的发起位置来进行的,例如该访问请求的发起位置落在第一代理服务器所处的第一地域内。The parsing may be performed based on the originating location of the access request, for example, the originating location of the access request falls within the first region where the first proxy server is located.
在步骤202:由第一代理服务器基于自身的配置信息将访问请求代理至首选地域内的服务器集群。In step 202 , the first proxy server proxies the access request to the server cluster in the preferred region based on its own configuration information.
配置信息中可以存储有首选地域,所谓首选地域是指代理服务器将访问请求优先代理至该首选地域的服务器集群。配置信息中还可以存储有按优先级排序的其他地域的排序列表。作为示例,正常情况下一个代理服务器的配置信息中的优选地域为该代理服务器自身所处的地域。A preferred region may be stored in the configuration information. The so-called preferred region refers to a server cluster where the proxy server preferentially proxies the access request to the preferred region. A sorted list of other regions sorted by priority may also be stored in the configuration information. As an example, under normal circumstances, the preferred region in the configuration information of a proxy server is the region where the proxy server itself is located.
进一步地,第一代理服务器可基于负载均衡策略将访问请求代理至首选地域内的服务器集群中的一服务器。如前所述,常有的负载均衡策略可包括轮循均衡、权重轮循均衡、随机均衡、响应速度均衡、最少连接数均衡、处理能力均衡、DNS响应均衡等等。Further, the first proxy server may proxy the access request to a server in the server cluster in the preferred region based on the load balancing policy. As mentioned above, common load balancing strategies may include round-robin balancing, weighted round-robin balancing, random balancing, response speed balancing, least number of connections balancing, processing power balancing, DNS response balancing, and the like.
若所代理到的服务器响应异常,则再次基于负载均衡策略将访问请求代理至首选地域内的服务器集群中的其他服务器直至访问请求得到正常响应。If the proxyed server responds abnormally, the access request is proxied to other servers in the server cluster in the preferred region based on the load balancing policy again until the access request receives a normal response.
若该首选地域内的服务器集群中的所有服务器均响应异常,则由第一代理服务器基于自身的配置信息将访问请求代理至另一地域内的服务器集群,例如配置信息中按照优先级排序位于首选地域的下一个地域内的服务器集群。If all the servers in the server cluster in the preferred region respond abnormally, the first proxy server will proxy the access request to the server cluster in another region based on its own configuration information. The server cluster in the next region of the region.
在将访问请求代理至另一地域内的服务器集群并且访问请求得到正常响应之后,修改该配置信息以将该另一地域配置为首选地域。优选地,可以在该第一地域内的服务器集群可以正常响应时,将第一地域改回为首选地域。After the access request is proxied to a server cluster in another region and the access request is normally responded to, the configuration information is modified to configure the other region as the preferred region. Preferably, when the server cluster in the first region can respond normally, the first region can be changed back to the preferred region.
在一实例中,可由第一代理服务器解析访问请求的主体部分以获取用户ID,以用于负载均衡策略的标识。例如,第一代理服务器可基于本地存储的关于访问请求的请求格式对访问请求的主体部分执行解析。In one example, the body portion of the access request may be parsed by the first proxy server to obtain the user ID for identification of the load balancing policy. For example, the first proxy server may perform parsing of the body portion of the access request based on a locally stored request format for the access request.
图3是示出了根据本发明的另一方面的代理系统300的框图。FIG. 3 is a block diagram illustrating a proxy system 300 according to another aspect of the present invention.
如图3所示,代理系统300可包括域名解析服务器301、代理服务器321、322、以及服务器集群331、332。图3中示出的两个代理服务器321、322以及两个服务器集群331、332仅仅是示例,实践中,可以存在一个代理服务器和一个服务器集群,也可以存在大于两个的代理服务器和大于两个的服务器集群。As shown in FIG. 3 , the proxy system 300 may include a domain name resolution server 301 , proxy servers 321 and 322 , and server clusters 331 and 332 . The two proxy servers 321 and 322 and the two server clusters 331 and 332 shown in FIG. 3 are only examples. In practice, there may be one proxy server and one server cluster, or there may be more than two proxy servers and more than two a cluster of servers.
根据本发明的一方面,每个服务器集群可包括两个服务器组,其中一个服务器组为提供访问服务的正式发布服务器组,另一组为用于服务器升级的预发布服务器组。这两组服务器组是完全一样的,区别仅在于两者的角色不同,即,每个服务器组的角色在“正式发布服务器组”和“预发布服务器组”之间进行切换。当一个服务器组为“正式发布服务器组”时,另一组则为“预发布服务器组”,而当原先为“正式发布服务器组”角色的服务器组切换为“预发布服务器组”时,原先为“预发布服务器组”角色的服务器组同时切换为“正式发布服务器组”。According to an aspect of the present invention, each server cluster may include two server groups, wherein one server group is a formal release server group providing access services, and the other is a pre-release server group used for server upgrade. These two sets of server groups are exactly the same, the only difference is that the roles of the two are different, that is, the role of each server group is switched between the "production server group" and the "pre-release server group". When one server group is the "release server group", the other group is the "prerelease server group", and when the server group that was originally the "release server group" is switched to the "prerelease server group", the original The server group with the role of "Pre-release server group" is also switched to "Production server group".
以图3中的实例为例,服务器集群331包括两个服务器组3311、3312。服务器组3311和服务器组3312原本为两个互为映射的服务器组,即两者完全相同。然而将服务器组3311用于向用户提供访问响应,另一服务器组3312不用于向用户提供访问响应,而是用于服务器升级。此时,服务器组3311即可称为正式发布服务器组,此时服务器组3312可称为预发布服务器组。Taking the example in FIG. 3 as an example, the server cluster 331 includes two server groups 3311 and 3312 . The server group 3311 and the server group 3312 are originally two server groups that are mapped to each other, that is, they are exactly the same. However, the server group 3311 is used for providing access responses to users, and the other server group 3312 is not used for providing access responses to users, but for server upgrades. In this case, the server group 3311 can be called the official release server group, and the server group 3312 can be called the pre-release server group at this time.
在一个例子中,在服务器组3312为承担预发布服务器组角色的时间内,如果需要对服务器作任何升级,则不对承担正式发布服务器组角色的服务器组3311做任何操作,而是仅对服务器组3312进行升级,这里的服务器升级可以是服务器内容的更新,或者服务器配置的修改。In one example, during the time that the server group 3312 assumes the role of the pre-release server group, if any upgrade of the server is required, the server group 3311 that assumes the role of the official release server group will not do anything, but only the server group 3312 to perform an upgrade, where the server upgrade may be an update of the server content or a modification of the server configuration.
当承担预发布服务器组角色的服务器组3312升级完毕后,服务器组3312可从预发布服务器组的角色切换为正式发布服务器组,相应地,服务器组3311则从正式发布服务器组的角色切换为预发布服务器组,两者实现角色互换。After the server group 3312 that assumes the role of the pre-release server group is upgraded, the server group 3312 can switch from the role of the pre-release server group to the official release server group, and correspondingly, the server group 3311 switches from the role of the official release server group to the pre-release server group. Publishing server group, the two realize role interchange.
在另一个例子中,在服务器组3312为承担预发布服务器组角色的时间内,如果需要对服务器作任何升级,可以先将服务器组3312切换为正式服务器组,同时将服务器组3311切换为预发布服务器组;然后,对服务器组3311进行升级。In another example, if the server group 3312 needs to be upgraded during the time that the server group 3312 assumes the role of the pre-release server group, the server group 3312 can be switched to the official server group first, and the server group 3311 can be switched to the pre-release server group at the same time. server group; then, the server group 3311 is upgraded.
当对服务器组3311进行升级完毕后,服务器组3312重新切换为预发布服务器组,升级后的服务器组3311切换为正式服务器组。After the server group 3311 is upgraded, the server group 3312 is switched to the pre-release server group again, and the upgraded server group 3311 is switched to the official server group.
需要说明的是,上述切换为服务器组之间的被动切换。但本发明中还可以在正式服务器组全部异常的情况下,将预发布服务器组切换为正式服务器组,而正式服务器组切换为预发布服务器组。后续还可以定时检测异常的预发布服务器组是否恢复正常,待预发布服务器组恢复正常之后,恢复正常的预发布服务器切换为正式服务器组,而正式服务器组重新切换回预发布服务器组。It should be noted that the above switching is passive switching between server groups. However, in the present invention, when all the formal server groups are abnormal, the pre-release server group can be switched to the formal server group, and the formal server group can be switched to the pre-release server group. In the future, it is also possible to regularly detect whether the abnormal pre-release server group has returned to normal. After the pre-release server group has returned to normal, the restored normal pre-release server is switched to the formal server group, and the formal server group is switched back to the pre-release server group.
用户经由客户端发起一访问请求。这里的客户端可以是网页浏览器、APP软件如微信等等。经由客户端发起的访问请求首先经由域名解析服务器301进行域名解析。域名解析服务器301负责将访问请求解析至代理服务器321、322中的一者,例如代理服务器321。代理服务器321可基于自身的配置信息将访问请求代理至一个服务器集群,例如服务器集群331的正式发布服务器组。The user initiates an access request via the client. The client here can be a web browser, APP software such as WeChat and so on. The access request initiated by the client first performs domain name resolution through the domain name resolution server 301 . The domain name resolution server 301 is responsible for resolving the access request to one of the proxy servers 321 and 322 , such as the proxy server 321 . The proxy server 321 can proxy the access request to a server cluster, such as the official publishing server group of the server cluster 331, based on its own configuration information.
由上可知,代理服务器总是将访问请求代理至服务器集群中的正式发布服务器组。由于正式发布服务器组总是经过升级且能提供正常访问响应的服务器组,因此,访问请求总能得到正常响应。此外,尽管正式发布服务器组在服务器集群的两个服务器组之间切换,但是该切换对于用户而言是不可见的,因此,服务器的升级可以无缝切换,不需要重新启动服务器。As can be seen from the above, the proxy server always proxies the access request to the official publishing server group in the server cluster. Access requests are always responded to normally because the official publishing server group is always the one that has been upgraded and can provide normal access responses. In addition, although the official release server group switches between the two server groups of the server cluster, the switch is invisible to the user, so the upgrade of the server can be switched seamlessly without restarting the server.
在存在多个代理服务器和多个服务器集群的情况下,可以借助“地域”来执行代理功能。例如,代理服务器321、322部署于不同地域,服务器集群331、332也部署于不同的地域。在图3所示的实例中,代理服务器321、和服务器集群331部署于相同的地域1中;代理服务器322和服务器集群332部署于相同的地域2。In the presence of multiple proxy servers and multiple server clusters, the proxy function can be performed by means of "regions". For example, the proxy servers 321 and 322 are deployed in different regions, and the server clusters 331 and 332 are also deployed in different regions. In the example shown in FIG. 3 , the proxy server 321 and the server cluster 331 are deployed in the same region 1; the proxy server 322 and the server cluster 332 are deployed in the same region 2.
在一实施例中,域名解析服务器301可基于访问请求的发起地址来决定将该访问请求解析至哪一个代理服务器。例如,域名解析服务器301可将访问请求解析至第一代理服务器,其中该访问请求的发起地址落在该第一代理服务器所处的地域。In one embodiment, the domain name resolution server 301 may decide which proxy server to resolve the access request to based on the originating address of the access request. For example, the domain name resolution server 301 may resolve the access request to a first proxy server, where the originating address of the access request falls in the region where the first proxy server is located.
代理服务器321例如通过监听80端口接收到该访问请求。在一实例中,代理服务器321可基于自身的配置信息确定将访问请求代理首选地域内的服务器集群。配置信息中可以存储有首选地域,所谓首选地域是指代理服务器321将访问请求优先代理至该首选地域的服务器集群。配置信息中还可以存储有按优先级排序的其他地域的排序列表。The proxy server 321 receives the access request by monitoring port 80, for example. In one example, the proxy server 321 may determine, based on its own configuration information, to access a server cluster in the request proxy's preferred region. A preferred region may be stored in the configuration information, and the so-called preferred region refers to a server cluster where the proxy server 321 preferentially proxies the access request to the preferred region. A sorted list of other regions sorted by priority may also be stored in the configuration information.
作为示例,正常情况下一个代理服务器的配置信息中的优选地域为该代理服务器自身所处的地域。例如对于代理服务器321而言,其首选地域为地域1,对于代理服务器322而言,首选地域为地域2。As an example, under normal circumstances, the preferred region in the configuration information of a proxy server is the region where the proxy server itself is located. For example, for the proxy server 321, its preferred region is region 1, and for the proxy server 322, its preferred region is region 2.
在图3所示的实例中,代理服务器321可基于自身配置信息将访问请求代理至地域1内的服务器集群331。In the example shown in FIG. 3 , the proxy server 321 can proxy the access request to the server cluster 331 in the domain 1 based on its own configuration information.
代理服务器321可基于负载均衡策略将访问请求代理至首选地域内的服务器集群即地域1内的服务器集群331中的正式发布服务器组例如服务器组3311中的服务器。The proxy server 321 can proxy the access request to the server cluster in the preferred region, that is, the server cluster 331 in the region 1 in the official release server group, such as the servers in the server group 3311 , based on the load balancing policy.
常用的负载均衡策略可包括轮循均衡、权重轮循均衡、随机均衡、响应速度均衡、最少连接数均衡、处理能力均衡、DNS响应均衡等等。Common load balancing strategies may include round-robin balancing, weighted round-robin balancing, random balancing, response speed balancing, least number of connections balancing, processing power balancing, DNS response balancing, and so on.
例如代理服务器321可基于负载均衡策略将访问请求代理至服务器集群331中正式发布服务器组3311中的服务器A,若服务器A响应异常,则可再次基于负载均衡策略将访问请求代理至该服务器组3311中的其他服务器,若响应还是异常,则再次代理至该服务器组3311中的下一服务器,重复此操作直至访问请求得到正常响应。For example, the proxy server 321 can proxy the access request to the server A in the official publishing server group 3311 in the server cluster 331 based on the load balancing policy. If the server A responds abnormally, it can proxy the access request to the server group 3311 based on the load balancing policy again. If the response of other servers in the server is still abnormal, it will proxy to the next server in the server group 3311 again, and repeat this operation until the access request gets a normal response.
在极端情况下,若服务器集群331的正式发布服务器组3311中的所有服务器都不能正常响应,则代理服务器321可基于配置信息将访问请求代理至下一地域内,例如配置信息中优先级仅次于首选地域的下一地域内的服务器集群中的正式发布服务器组。作为示例,例如代理服务器321可将访问请求代理至地域2内的服务器集群332内的正式发布服务器组。若此时服务器集群332中的正式发布服务器组为服务器组3321,则将访问请求代理至服务器组3321,否则代理至服务器组3322。In extreme cases, if all servers in the official release server group 3311 of the server cluster 331 cannot respond normally, the proxy server 321 can proxy the access request to the next region based on the configuration information, for example, the priority in the configuration information is only the second The production server group in the server cluster in the next region of the preferred region. As an example, proxy server 321 may proxy access requests to a production server group within server cluster 332 within domain 2, for example. If the official publishing server group in the server cluster 332 is the server group 3321 at this time, the access request is proxied to the server group 3321 , otherwise, the access request is proxied to the server group 3322 .
在更极端的情况下,若所有地域内的服务器集群的正式发布服务器组均响应异常,则代理服务器321可以将访问请求重新代理至首选地域内的服务器集群的预发布服务器组,例如地域1的服务器集群331中的预发布服务器组3312。In a more extreme case, if the official publishing server groups of the server clusters in all regions respond abnormally, the proxy server 321 may re-proxy the access request to the pre-publishing server groups of the server clusters in the preferred region, such as the one in region 1. Pre-published server group 3312 in server cluster 331.
若该地域1的服务器集群331中的预发布服务器组3312也无法正常响应,则可将访问请求代理至下一地域内,例如配置信息中优先级仅次于首选地域的下一地域内的服务器集群中的预发布服务器组,例如地域2的服务器集群332中的预发布服务器组3322直至访问请求得到正常响应为止。If the pre-published server group 3312 in the server cluster 331 of the region 1 cannot respond normally, the access request can be proxied to the next region, for example, the server in the next region whose priority is next to the preferred region in the configuration information The pre-published server group in the cluster, for example, the pre-published server group 3322 in the server cluster 332 of the region 2, until the access request is responded normally.
在所有服务器集群的正式发布服务器组皆宕机的情况下,后续可以间隔时间检测正式发布服务器组是否正常,如果正式恢复,就可以切换回正式发布服务器组。In the case that the official publishing server group of all server clusters is down, you can check whether the official publishing server group is normal at intervals in the future. If it is officially restored, you can switch back to the official publishing server group.
如先前所述的,访问请求一般包括头部部分和主体部分。访问请求有可能是通过微信平台、webservice等发出的,此时,访问请求的头部部分的信息是一样的,不能作为一些普通负载策略的标示。As mentioned earlier, an access request typically includes a header portion and a body portion. The access request may be sent through the WeChat platform, webservice, etc. In this case, the information in the header part of the access request is the same and cannot be used as an indicator of some common load policies.
在本发明,代理服务器可以包括数据库和解析模块(图中未示出)。数据库中可以预存有多种请求类型的请求格式。解析模块可以通过查找数据库以根据该用户请求的请求格式对访问请求的主体部分进行解析,以获取用户ID,由此可以作为负载均衡策略的标识。In the present invention, the proxy server may include a database and a parsing module (not shown in the figure). Request formats for various request types can be pre-stored in the database. The parsing module can parse the main part of the access request according to the request format of the user request by searching the database to obtain the user ID, which can be used as the identifier of the load balancing strategy.
图4是示出了根据本发明的一方面的代理方法400的流程图。如图4所示,代理方法400可包括以下步骤:FIG. 4 is a flow diagram illustrating a proxy method 400 according to an aspect of the present invention. As shown in FIG. 4, the proxy method 400 may include the following steps:
在步骤401:对访问请求执行域名解析,将访问请求解析至第一代理服务器。In step 401 , domain name resolution is performed on the access request, and the access request is resolved to the first proxy server.
在一实例中,基于访问请求的发起位置将所述访问请求解析至多个代理服务器中的该第一代理服务器,这多个代理服务器部署于不同的地域,每个地域内部署有相应的服务器集群。该访问请求的发起位置落在所述第一代理服务器所处的第一地域内In an example, the access request is parsed to the first proxy server among multiple proxy servers based on the originating location of the access request, the multiple proxy servers are deployed in different regions, and a corresponding server cluster is deployed in each region . The originating location of the access request falls within the first region where the first proxy server is located
在步骤402:由该第一代理服务器基于自身的配置信息将访问请求代理至第一服务器集群中的正式发布服务器组,该第一服务器集群包括用于提供访问服务的正式发布服务器组和用于服务器升级的预发布服务器组,该预发布服务器组在升级完毕后切换为正式发布服务器组以用于提供访问服务,而正式发布服务器组相应地切换为预发布服务器组以用于服务器升级。At step 402: the first proxy server proxies the access request to a formal publishing server group in a first server cluster based on its own configuration information, where the first server cluster includes a formal publishing server group for providing access services and The pre-release server group for server upgrade, the pre-release server group is switched to the official release server group for providing access services after the upgrade is completed, and the official release server group is correspondingly switched to the pre-release server group for server upgrade.
在每个地域配置一个服务器集群的实例中,该第一服务器集群可以为该第一代理服务器的配置信息中首选地域内的服务器集群。In the instance where one server cluster is configured in each region, the first server cluster may be the server cluster in the preferred region in the configuration information of the first proxy server.
进一步地,第一代理服务器可基于负载均衡策略将访问请求代理至该第一服务器集群中的正式发布服务器组中的服务器。常用的负载均衡策略可包括轮循均衡、权重轮循均衡、随机均衡、响应速度均衡、最少连接数均衡、处理能力均衡、DNS响应均衡等。Further, the first proxy server may proxy the access request to the servers in the official release server group in the first server cluster based on the load balancing policy. Common load balancing strategies may include round-robin balancing, weighted round-robin balancing, random balancing, response speed balancing, least number of connections balancing, processing power balancing, DNS response balancing, and the like.
若第一服务器集群的正式发布服务器组中的所有服务器均响应异常,则可由第一代理服务器基于自身的配置信息将访问请求代理至下一地域内的服务器集群中的正式发布服务器组直至访问请求得到正常响应。If all servers in the official release server group of the first server cluster respond abnormally, the first proxy server can proxy the access request to the official release server group in the server cluster in the next region based on its own configuration information until the access request is made get a normal response.
在极端的情况下,若所有地域内的服务器集群的正式发布服务器组均响应异常,则可由第一代理服务器基于自身的配置信息将访问请求代理至第一服务器集群中的预发布服务器组。In an extreme case, if the official publishing server group of the server cluster in all regions responds abnormally, the first proxy server can proxy the access request to the pre-publishing server group in the first server cluster based on its own configuration information.
在更极端的情况下,若第一服务器集群的预发布服务器组中的所有服务器均响应异常,则可由第一代理服务器基于自身的配置信息将访问请求代理至上述下一地域内的服务器集群中的预发布服务器组,重复此操作直至访问请求得到正常响应。In a more extreme case, if all servers in the pre-release server group of the first server cluster respond abnormally, the first proxy server can proxy the access request to the server cluster in the next region based on its own configuration information. , repeat this operation until the access request is responded normally.
在所有服务器集群的正式发布服务器组皆宕机的情况下,后续可以间隔时间检测正式发布服务器组是否正常,如果正式恢复,就可以切换回正式发布服务器组。In the case that the official publishing server group of all server clusters is down, you can check whether the official publishing server group is normal at intervals in the future. If it is officially restored, you can switch back to the official publishing server group.
在一实例中,可由第一代理服务器解析访问请求的主体部分以获取用户ID,以用于负载均衡策略的标识。例如,第一代理服务器可基于本地存储的关于访问请求的请求格式对访问请求的主体部分执行解析。In one example, the body portion of the access request may be parsed by the first proxy server to obtain the user ID for identification of the load balancing policy. For example, the first proxy server may perform parsing of the body portion of the access request based on a locally stored request format for the access request.
尽管为使解释简单化将上述方法图示并描述为一系列动作,但是应理解并领会,这些方法不受动作的次序所限,因为根据一个或多个实施例,一些动作可按不同次序发生和/或与来自本文中图示和描述或本文中未图示和描述但本领域技术人员可以理解的其他动作并发地发生。Although the above-described methods are illustrated and described as a series of acts for simplicity of explanation, it should be understood and appreciated that these methods are not limited by the order of the acts, as some acts may occur in a different order in accordance with one or more embodiments and/or occur concurrently with other actions from or not shown and described herein but understood by those skilled in the art.
在本发明中,通过加入地域的概念,可以单独对某一个地域代理负载,也可以配置多个地域,对多个地域进行负载代理,多个地域进行切换,提供了代理的灵活性。另一方面,通过提供正式发布和预发布环境的实时切换,解决了所有代理服务器修改配置后需要重启后生效的问题,该技术不需要重启服务器,修改任何配置即实时生效,实现了动态代理的效果。In the present invention, by adding the concept of regions, it is possible to independently proxy the load to a certain region, or configure multiple regions, perform load proxying for multiple regions, and switch multiple regions, which provides flexibility of the proxy. On the other hand, by providing real-time switching between the official release and pre-release environments, it solves the problem that all proxy servers need to be restarted to take effect after modifying the configuration. This technology does not need to restart the server, and any configuration modification will take effect in real time, realizing the dynamic proxy. Effect.
此外,相比nginx只能从请求头信息中获取负载策略相关内容,本发明通过解析请求体信息获取负载策略内容,从而加强了负载策略,解决了一般负载策略执行方式单一的问题,从而支持代理负载均衡多样性,例如可以支持微信和webservice等多种形式。In addition, compared to nginx that can only obtain the content related to the load policy from the request header information, the present invention obtains the content of the load policy by parsing the request body information, thereby strengthening the load policy, solving the problem of a single execution mode of the general load policy, and thus supporting the proxy Load balancing diversity, for example, it can support various forms such as WeChat and webservice.
本领域技术人员将领会,结合本文中所公开的实施例来描述的各种解说性逻辑板块、模块、电路、和算法步骤可实现为电子硬件、计算机软件、或这两者的组合。为清楚地解说硬件与软件的这一可互换性,各种解说性组件、框、模块、电路、和步骤在上面是以其功能性的形式作一般化描述的。此类功能性是被实现为硬件还是软件取决于具体应用和施加于整体系统的设计约束。技术人员对于每种特定应用可用不同的方式来实现所描述的功能性,但这样的实现决策不应被解读成导致脱离了本发明的范围。Those skilled in the art will appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
结合本文所公开的实施例描述的各种解说性逻辑模块、和电路可用通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或其它可编程逻辑器件、分立的门或晶体管逻辑、分立的硬件组件、或其设计成执行本文所描述功能的任何组合来实现或执行。通用处理器可以是微处理器,但在替换方案中,该处理器可以是任何常规的处理器、控制器、微控制器、或状态机。处理器还可以被实现为计算设备的组合,例如DSP与微处理器的组合、多个微处理器、与DSP核心协作的一个或多个微处理器、或任何其他此类配置。The various illustrative logic modules, and circuits described in connection with the embodiments disclosed herein may be implemented using general purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or other programmable Logic devices, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein are implemented or performed. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors cooperating with a DSP core, or any other such configuration.
结合本文中公开的实施例描述的方法或算法的步骤可直接在硬件中、在由处理器执行的软件模块中、或在这两者的组合中体现。软件模块可驻留在RAM存储器、闪存、ROM存储器、EPROM存储器、EEPROM存储器、寄存器、硬盘、可移动盘、CD-ROM、或本领域中所知的任何其他形式的存储介质中。示例性存储介质耦合到处理器以使得该处理器能从/向该存储介质读取和写入信息。在替换方案中,存储介质可以被整合到处理器。处理器和存储介质可驻留在ASIC中。ASIC可驻留在用户终端中。在替换方案中,处理器和存储介质可作为分立组件驻留在用户终端中。The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integrated into the processor. The processor and storage medium may reside in the ASIC. The ASIC may reside in the user terminal. In the alternative, the processor and storage medium may reside in the user terminal as discrete components.
在一个或多个示例性实施例中,所描述的功能可在硬件、软件、固件或其任何组合中实现。如果在软件中实现为计算机程序产品,则各功能可以作为一条或更多条指令或代码存储在计算机可读介质上或藉其进行传送。计算机可读介质包括计算机存储介质和通信介质两者,其包括促成计算机程序从一地向另一地转移的任何介质。存储介质可以是能被计算机访问的任何可用介质。作为示例而非限定,这样的计算机可读介质可包括RAM、ROM、EEPROM、CD-ROM或其它光盘存储、磁盘存储或其它磁存储设备、或能被用来携带或存储指令或数据结构形式的合意程序代码且能被计算机访问的任何其它介质。任何连接也被正当地称为计算机可读介质。例如,如果软件是使用同轴电缆、光纤电缆、双绞线、数字订户线(DSL)、或诸如红外、无线电、以及微波之类的无线技术从web网站、服务器、或其它远程源传送而来,则该同轴电缆、光纤电缆、双绞线、DSL、或诸如红外、无线电、以及微波之类的无线技术就被包括在介质的定义之中。如本文中所使用的盘(disk)和碟(disc)包括压缩碟(CD)、激光碟、光碟、数字多用碟(DVD)、软盘和蓝光碟,其中盘(disk)往往以磁的方式再现数据,而碟(disc)用激光以光学方式再现数据。上述的组合也应被包括在计算机可读介质的范围内。In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage medium can be any available medium that can be accessed by a computer. By way of example and not limitation, such computer-readable media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage, or other magnetic storage devices, or can be used to carry or store instructions or data structures in the form of Any other medium that conforms to program code and that can be accessed by a computer. Any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a web site, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave , then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc as used herein includes compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and blu-ray disc, where disks are often reproduced magnetically data, and discs reproduce the data optically with a laser. Combinations of the above should also be included within the scope of computer-readable media.
提供对本公开的先前描述是为使得本领域任何技术人员皆能够制作或使用本公开。对本公开的各种修改对本领域技术人员来说都将是显而易见的,且本文中所定义的普适原理可被应用到其他变体而不会脱离本公开的精神或范围。由此,本公开并非旨在被限定于本文中所描述的示例和设计,而是应被授予与本文中所公开的原理和新颖性特征相一致的最广范围。The previous description of the present disclosure is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to the present disclosure will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of the present disclosure. Thus, the present disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (18)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610510314.5A CN105959413B (en) | 2016-06-30 | Network proxy method and proxy system | |
| CN201910425062.XA CN110138872B (en) | 2016-06-30 | 2016-06-30 | Computer readable medium for network proxy |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610510314.5A CN105959413B (en) | 2016-06-30 | Network proxy method and proxy system |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910425062.XA Division CN110138872B (en) | 2016-06-30 | 2016-06-30 | Computer readable medium for network proxy |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN105959413A CN105959413A (en) | 2016-09-21 |
| CN105959413B true CN105959413B (en) | 2019-07-16 |
Family
ID=
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101431532A (en) * | 2008-12-15 | 2009-05-13 | 中国电信股份有限公司 | Content routing method, load balancing equipment and resource management equipment |
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101431532A (en) * | 2008-12-15 | 2009-05-13 | 中国电信股份有限公司 | Content routing method, load balancing equipment and resource management equipment |
Non-Patent Citations (1)
| Title |
|---|
| CDN关键技术的研究及其系统设计;蒋业文;《中国优秀硕士学位论文全文数据库(电子期刊)》;20150131;正文第2.2-2.3节、第3.2.2-3.2.3节、第3.3节、第4.4节 * |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10275232B1 (en) | Architecture for incremental deployment | |
| CN109981716B (en) | A microservice calling method and device | |
| CN108027805B (en) | Load distribution in a data network | |
| CN104823170B (en) | Distributed cache cluster management | |
| CN102771084B (en) | Systems and methods for managing static proximity in a multi-core GSLB appliance | |
| US9954948B2 (en) | Private content distribution network | |
| CN110149397A (en) | A kind of micro services integration method and device | |
| US12120590B2 (en) | Mobile application accelerator | |
| WO2014206118A1 (en) | Domain name resolution method based on tcp protocol in mobile internet and dns server | |
| JP2013507694A (en) | System and method for increasing data communication speed and efficiency | |
| US20090210513A1 (en) | Asynchronous automated routing of user to optimal host | |
| US9229740B1 (en) | Cache-assisted upload proxy | |
| CN108156267A (en) | Improve the method and system of website visiting time delay in a kind of mist computing architecture using caching | |
| JP2012509623A (en) | Updating routing information using request routing and client location information | |
| US8984162B1 (en) | Optimizing performance for routing operations | |
| EP4144072A1 (en) | Load-balancing establishment of connections among groups of connector servers | |
| US8996607B1 (en) | Identity-based casting of network addresses | |
| AU2020354382A1 (en) | Redirector based on resolver transparency | |
| IL268670A (en) | Automatic server cluster discovery | |
| CN105959413B (en) | Network proxy method and proxy system | |
| CN110138872B (en) | Computer readable medium for network proxy | |
| US9178771B2 (en) | Determining the type of a network tier | |
| US20250106302A1 (en) | Selecting managed proxy ip devices by geographical coordinates thereof | |
| WO2025008970A1 (en) | System and method of caching dns responses for application detection | |
| CN104618430A (en) | Method and system for achieving returning of internet cache system resource |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: Network proxy method and proxy system Effective date of registration: 20230223 Granted publication date: 20190716 Pledgee: China Construction Bank Corporation Shanghai No.5 Sub-branch Pledgor: SHANGHAI XIAOI ROBOT TECHNOLOGY Co.,Ltd. Registration number: Y2023980033272 |