Movatterモバイル変換


[0]ホーム

URL:


CN113553074B - Small program distribution control method, device, electronic device and storage medium - Google Patents

Small program distribution control method, device, electronic device and storage medium
Download PDF

Info

Publication number
CN113553074B
CN113553074BCN202110841089.4ACN202110841089ACN113553074BCN 113553074 BCN113553074 BCN 113553074BCN 202110841089 ACN202110841089 ACN 202110841089ACN 113553074 BCN113553074 BCN 113553074B
Authority
CN
China
Prior art keywords
target
applet
open source
source host
identification information
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
Application number
CN202110841089.4A
Other languages
Chinese (zh)
Other versions
CN113553074A (en
Inventor
陈汉川
戴领
姜玉东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co LtdfiledCriticalBeijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110841089.4ApriorityCriticalpatent/CN113553074B/en
Publication of CN113553074ApublicationCriticalpatent/CN113553074A/en
Application grantedgrantedCritical
Publication of CN113553074BpublicationCriticalpatent/CN113553074B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本公开提供了小程序分发控制方法、装置、电子设备以及存储介质,涉及计算机技术领域,尤其涉及信息流领域。具体实现方案为:确定针对开源宿主配置的配额信息,其中,配额信息用于表征所述开源宿主在预设时长内访问小程序的访问阈值;响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序;以及根据配额信息确定目标小程序的分发方式,其中,分发方式包括将目标小程序分发至目标开源宿主或者中断目标小程序向目标开源宿主的分发过程。

The disclosure provides a small program distribution control method, device, electronic equipment, and storage medium, and relates to the field of computer technology, especially to the field of information flow. The specific implementation scheme is: determining quota information configured for the open source host, wherein the quota information is used to characterize the access threshold of the open source host for accessing the applet within a preset period of time; in response to an access request from the target open source host, determining the target applet for access; and determining a distribution method of the target applet according to the quota information, wherein the distribution method includes distributing the target applet to the target open source host or interrupting the distribution process of the target applet to the target open source host.

Description

Translated fromChinese
小程序分发控制方法、装置、电子设备以及存储介质Small program distribution control method, device, electronic device, and storage medium

技术领域technical field

本公开涉及计算机技术领域,尤其涉及信息流领域。The present disclosure relates to the field of computer technology, in particular to the field of information flow.

背景技术Background technique

小程序(Mini Program)是一种不需要下载安装即可使用的应用,通常依赖于客户端存在。客户端给小程序所提供的环境称为宿主环境。小程序借助宿主环境提供的能力,可以完成许多普通网页无法完成的功能。A Mini Program (Mini Program) is an application that can be used without downloading and installing, and usually depends on the existence of a client. The environment provided by the client to the applet is called the host environment. With the help of the capabilities provided by the host environment, applets can accomplish many functions that ordinary web pages cannot.

发明内容Contents of the invention

本公开提供了一种小程序分发控制方法、装置、电子设备以及存储介质。The disclosure provides a small program distribution control method, device, electronic equipment and storage medium.

根据本公开的一方面,提供了一种小程序分发控制方法,包括:确定针对开源宿主配置的配额信息,其中,所述配额信息用于表征所述开源宿主在预设时长内访问小程序的访问阈值;响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序;以及根据所述配额信息确定所述目标小程序的分发方式,其中,所述分发方式包括将所述目标小程序分发至所述目标开源宿主或者中断所述目标小程序向所述目标开源宿主的分发过程。According to an aspect of the present disclosure, there is provided a method for controlling distribution of applets, including: determining quota information configured for an open source host, wherein the quota information is used to characterize the access threshold of the open source host for accessing applets within a preset period of time; in response to an access request from a target open source host, determining a target applet to be accessed; and determining a distribution method of the target applet according to the quota information, wherein the distribution method includes distributing the target applet to the target open source host or interrupting the distribution process of the target applet to the target open source host.

根据本公开的另一方面,提供了一种小程序分发控制装置,包括:第一确定模块,用于确定针对开源宿主配置的配额信息,其中,所述配额信息用于表征所述开源宿主在预设时长内访问小程序的访问阈值;第二确定模块,用于响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序;以及第三确定模块,用于根据所述配额信息确定所述目标小程序的分发方式,其中,所述分发方式包括将所述目标小程序分发至所述目标开源宿主或者中断所述目标小程序向所述目标开源宿主的分发过程。According to another aspect of the present disclosure, a small program distribution control device is provided, including: a first determination module configured to determine quota information configured for an open source host, wherein the quota information is used to characterize the access threshold of the open source host to access a small program within a preset time period; a second determination module is used to respond to an access request from a target open source host to determine a target small program that requests access; and a third determination module is used to determine a distribution method of the target small program according to the quota information, wherein the distribution method includes distributing the target small program to the target open source host or interrupting the target small program The distribution process to the target open source host.

根据本公开的另一方面,提供了一种电子设备,包括:至少一个处理器;以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如上所述的小程序分发控制方法。According to another aspect of the present disclosure, an electronic device is provided, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the applet distribution control method as described above.

根据本公开的另一方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行如上所述的小程序分发控制方法。According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the applet distribution control method as described above.

根据本公开的另一方面,提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现如上所述的小程序分发控制方法。According to another aspect of the present disclosure, a computer program product is provided, including a computer program, the computer program implements the applet distribution control method as described above when executed by a processor.

应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will be readily understood through the following description.

附图说明Description of drawings

附图用于更好地理解本方案,不构成对本公开的限定。其中:The accompanying drawings are used to better understand the present solution, and do not constitute a limitation to the present disclosure. in:

图1示意性示出了根据本公开实施例的可以应用小程序分发控制方法及装置的示例性系统架构;FIG. 1 schematically shows an exemplary system architecture to which a method and device for controlling applet distribution can be applied according to an embodiment of the present disclosure;

图2示意性示出了根据本公开实施例的小程序分发控制方法的流程图;FIG. 2 schematically shows a flow chart of a method for controlling distribution of applets according to an embodiment of the present disclosure;

图3示意性示出了根据本公开实施例的控制小程序分发的示意图;Fig. 3 schematically shows a schematic diagram of controlling applet distribution according to an embodiment of the present disclosure;

图4示意性示出了根据本公开实施例的配额服务的工作流程图;Fig. 4 schematically shows a working flowchart of a quota service according to an embodiment of the present disclosure;

图5示意性示出了根据本公开实施例的内存判断的流程图;FIG. 5 schematically shows a flow chart of memory judgment according to an embodiment of the present disclosure;

图6示意性示出了根据本公开实施例的小程序分发控制装置的框图;以及FIG. 6 schematically shows a block diagram of an apparatus for controlling applet distribution according to an embodiment of the present disclosure; and

图7示出了可以用来实施本公开的实施例的示例电子设备的示意性框图。FIG. 7 shows a schematic block diagram of an example electronic device that may be used to implement embodiments of the present disclosure.

具体实施方式Detailed ways

以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and they should be regarded as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

在本公开的技术方案中,所涉及的用户个人信息的获取,存储和应用等,均符合相关法律法规的规定,采取了必要保密措施,且不违背公序良俗。In the technical solution of the present disclosure, the acquisition, storage and application of the user's personal information involved are in compliance with relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good customs.

发明人在实现本公开构思的过程中发现,对于开源小程序,由于其开源的特性,无法限制宿主的大批量拉取行为,容易影响小程序信息的安全性以及小程序分发服务的稳定性。针对该问题,目前还没有一种有效的线上解决方案。In the process of realizing the concept of the present disclosure, the inventor found that for open source applets, due to their open source characteristics, it is impossible to limit the host’s mass pulling behavior, which may easily affect the security of the applet information and the stability of the applet distribution service. For this problem, there is no effective online solution yet.

为了应对开源多宿主面临的潜在风险,本公开提供了一种针对小程序分发的宿主配额机制。在宿主需要获取小程序的情况下,为宿主增加分发阈值和干预,防止开源宿主有意伪造用户行为拉取小程序包信息,造成小程序包信息全量泄露等问题。In order to deal with potential risks faced by open source multi-homing, the present disclosure provides a hosting quota mechanism for small program distribution. When the host needs to obtain small programs, increase the distribution threshold and intervention for the host to prevent open source hosts from intentionally forging user behaviors to pull small program package information, resulting in full disclosure of small program package information and other issues.

图1示意性示出了根据本公开实施例的可以应用小程序分发控制方法及装置的示例性系统架构。Fig. 1 schematically shows an exemplary system architecture to which the applet distribution control method and device according to an embodiment of the present disclosure can be applied.

需要注意的是,图1所示仅为可以应用本公开实施例的系统架构的示例,以帮助本领域技术人员理解本公开的技术内容,但并不意味着本公开实施例不可以用于其他设备、系统、环境或场景。例如,在另一实施例中,可以应用小程序分发控制方法及装置的示例性系统架构可以包括终端设备,但终端设备可以无需与服务器进行交互,即可实现本公开实施例提供的小程序分发控制方法及装置。It should be noted that Figure 1 is only an example of the system architecture to which the embodiments of the present disclosure can be applied, so as to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios. For example, in another embodiment, the exemplary system architecture to which the applet distribution control method and apparatus may be applied may include a terminal device, but the terminal equipment may implement the applet distribution control method and apparatus provided in the embodiments of the present disclosure without interacting with the server.

如图1所示,根据该实施例的系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线和/或无线通信链路等等。As shown in FIG. 1 , a system architecture 100 according to this embodiment may include terminal devices 101 , 102 , 103 , a network 104 and a server 105 . The network 104 is used as a medium for providing communication links between the terminal devices 101 , 102 , 103 and the server 105 . Network 104 may include various connection types, such as wired and/or wireless communication links, among others.

用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种通讯客户端应用,例如知识阅读类应用、网页浏览器应用、搜索类应用、即时通信工具、邮箱客户端和/或社交平台软件等(仅为示例)。Users can use terminal devices 101 , 102 , 103 to interact with server 105 via network 104 to receive or send messages and the like. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients and/or social platform software, etc. (just for example).

终端设备101、102、103可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。The terminal devices 101, 102, 103 may be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers and the like.

服务器105可以是提供各种服务的服务器,例如对用户利用终端设备101、102、103所浏览的内容提供支持的后台管理服务器(仅为示例)。后台管理服务器可以对接收到的用户请求等数据进行分析等处理,并将处理结果(例如根据用户请求获取或生成的网页、信息、或数据等)反馈给终端设备。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务(″Virtual PrivateServer″,或简称″VPS″)中,存在的管理难度大,业务扩展性弱的缺陷。服务器也可以为分布式系统的服务器,或者是结合了区块链的服务器。The server 105 may be a server that provides various services, such as a background management server that supports content browsed by users using the terminal devices 101 , 102 , 103 (just an example). The background management server can analyze and process received data such as user requests, and feed back processing results (such as webpages, information, or data obtained or generated according to user requests) to the terminal device. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the traditional physical host and VPS service ("Virtual Private Server", or "VPS" for short), which is difficult to manage and weak in business scalability. The server can also be a server of a distributed system, or a server combined with a blockchain.

需要说明的是,本公开实施例所提供的小程序分发控制方法一般可以由终端设备101、102、或103执行。相应地,本公开实施例所提供的小程序分发控制装置也可以设置于终端设备101、102、或103中。It should be noted that, generally, the mini-program distribution control method provided by the embodiment of the present disclosure may be executed by the terminal device 101 , 102 , or 103 . Correspondingly, the applet distribution control apparatus provided in the embodiment of the present disclosure may also be set in the terminal device 101 , 102 , or 103 .

或者,本公开实施例所提供的小程序分发控制方法一般也可以由服务器105执行。相应地,本公开实施例所提供的小程序分发控制装置一般可以设置于服务器105中。本公开实施例所提供的小程序分发控制方法也可以由不同于服务器105且能够与终端设备101、102、103和/或服务器105通信的服务器或服务器集群执行。相应地,本公开实施例所提供的小程序分发控制装置也可以设置于不同于服务器105且能够与终端设备101、102、103和/或服务器105通信的服务器或服务器集群中。Alternatively, the applet distribution control method provided by the embodiment of the present disclosure may also generally be executed by the server 105 . Correspondingly, the applet distribution control apparatus provided by the embodiments of the present disclosure can generally be set in the server 105 . The applet distribution control method provided by the embodiments of the present disclosure may also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101 , 102 , 103 and/or the server 105 . Correspondingly, the applet distribution control apparatus provided by the embodiments of the present disclosure may also be set in a server or a server cluster that is different from the server 105 and can communicate with the terminal devices 101 , 102 , 103 and/or the server 105 .

例如,在开源宿主请求访问小程序时,终端设备101、102、103可以首先确定针对开源宿主配置的配额信息。其中,配额信息用于表征开源宿主在预设时长内访问小程序的访问阈值。然后响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序。根据配额信息确定目标小程序的分发方式。其中,分发方式包括将目标小程序分发至目标开源宿主或者中断目标小程序向目标开源宿主的分发过程。或者由能够与终端设备101、102、103和/或服务器105通信的服务器或服务器集群根据配额信息确定目标小程序的分发方式,并根据该确定的分发方式将目标小程序分发至目标开源宿主或者中断目标小程序向目标开源宿主的分发过程。For example, when the open source host requests to access the applet, the terminal devices 101, 102, and 103 may first determine the quota information configured for the open source host. Among them, the quota information is used to represent the access threshold of the open source host to access the applet within a preset period of time. Then, in response to the access request from the target open source host, the target applet requesting access is determined. Determine the distribution method of the target applet according to the quota information. Wherein, the distribution method includes distributing the target applet to the target open source host or interrupting the distribution process of the target applet to the target open source host. Alternatively, a server or server cluster that can communicate with the terminal devices 101, 102, 103 and/or server 105 determines the distribution method of the target applet according to the quota information, and distributes the target applet to the target open source host or interrupts the distribution process of the target applet to the target open source host according to the determined distribution method.

应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in Fig. 1 are only illustrative. According to the implementation needs, there can be any number of terminal devices, networks and servers.

图2示意性示出了根据本公开实施例的小程序分发控制方法的流程图。Fig. 2 schematically shows a flowchart of a method for controlling distribution of applets according to an embodiment of the present disclosure.

如图2所示,该方法200包括操作S210~S230。As shown in FIG. 2, the method 200 includes operations S210-S230.

在操作S210,确定针对开源宿主配置的配额信息。其中,配额信息用于表征开源宿主在预设时长内访问小程序的访问阈值。In operation S210, quota information configured for the open source host is determined. Among them, the quota information is used to represent the access threshold of the open source host to access the applet within a preset period of time.

在操作S220,响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序。In operation S220, in response to the access request from the target open source host, a target applet requesting access is determined.

在操作S230,根据配额信息确定目标小程序的分发方式。其中,分发方式包括将目标小程序分发至目标开源宿主或者中断目标小程序向目标开源宿主的分发过程。In operation S230, a distribution method of the target applet is determined according to the quota information. Wherein, the distribution method includes distributing the target applet to the target open source host or interrupting the distribution process of the target applet to the target open source host.

根据本公开的实施例,开源宿主例如包括能够访问开源小程序并实现小程序相应功能的各种应用软件、开源网站等。配额信息可以为基于宿主维度、多时间粒度配置的用于限制开源宿主在预设时长的时间段内访问小程序的最大额度的信息。访问阈值,即该最大额度,可以根据宿主维度的不同、时间粒度的不同等其中至少之一进行适应性调整访问阈值。According to the embodiment of the present disclosure, the open source host includes, for example, various application software, open source websites, etc. that can access the open source applet and realize the corresponding functions of the applet. Quota information can be configured based on the host dimension and multi-time granularity to limit the maximum quota of open source hosts to access applets within a preset period of time. The access threshold, that is, the maximum amount, can be adaptively adjusted according to at least one of different host dimensions, different time granularities, and the like.

需要说明的是,对于同一开源宿主,在同一时间粒度下配置的最大额度也可以自适应调整,在此不做限定。It should be noted that for the same open source host, the maximum amount configured at the same time granularity can also be adjusted adaptively, which is not limited here.

根据本公开的实施例,配额信息可以在智能小程序宿主平台的前端页面上配置完成,由智能小程序宿主平台管理开源宿主的相关配置信息。例如,可以在智能小程序宿主平台的前端页面上针对软件A配置软件A在一个小时内可以访问的小程序的访问阈值为10,软件A在一天内可以访问的小程序的访问阈值为50,针对软件B配置软件B在一个小时内可以访问的小程序的访问阈值为8等配置信息。该些配置信息可以被配置为在每次服务启动时进行预读取,并可基于在线追踪实现信息的实时变更,以保证服务端读取到的配额信息的实时有效性。例如,可以在软件A每次请求访问小程序的情况下,读取软件A的相关配额信息,以便根据配额信息确定是否要将软件A当前请求访问的小程序分发至该软件A。According to the embodiment of the present disclosure, the quota information can be configured on the front-end page of the smart applet host platform, and the smart applet host platform manages related configuration information of the open source host. For example, on the front-end page of the smart applet hosting platform, software A can be configured with an access threshold of 10 for the applets that software A can access within one hour, a threshold of 50 for software A’s applets that can be accessed within one day, and a configuration information such as 8 for software B that software B can access within one hour. The configuration information can be configured to be pre-read each time the service is started, and real-time information can be changed based on online tracking to ensure the real-time validity of the quota information read by the server. For example, when software A requests access to an applet each time, the relevant quota information of software A may be read, so as to determine whether to distribute the applet currently requested by software A to software A according to the quota information.

根据本公开的实施例,在根据配额信息确定需要将软件A当前请求访问的小程序分发至该软件A的情况下,可直接执行分发操作。在根据配额信息确定不能将软件A当前请求访问的小程序分发至该软件A的情况下,中断将小程序分发至软件A的分发过程。According to an embodiment of the present disclosure, when it is determined according to the quota information that the applet currently requested by software A needs to be distributed to the software A, the distribution operation may be directly performed. When it is determined according to the quota information that the applet that software A currently requests to access cannot be distributed to software A, the distribution process of distributing the applet to software A is interrupted.

图3示意性示出了根据本公开实施例的控制小程序分发的示意图。Fig. 3 schematically shows a schematic diagram of controlling applet distribution according to an embodiment of the present disclosure.

如图3所示,宿主平台310用于配置不同开源宿主对应于不同时间粒度时的配额信息,该配额信息可存储在数据库320中。数据库320可与配额服务330相交互。在客户端340响应于用户的访问请求而请求目标小程序的情况下,需要从包下发服务中350中拉取小程序包。包下发服务350可以包括PMS(PackageManagerService,包管理服务)351和META(安装包)352,PMS 351可以为小程序包的下发提供控制服务,META 352可以为小程序包的下发提供数据服务。由PMS 351和META 352构成的包下发服务350可以与配额服务330进行交互。从而,配额服务330可以基于数据库320中存储的配额信息确定是否将当前从包下发服务350中请求的目标小程序的小程序包下发至客户端340。As shown in FIG. 3 , the host platform 310 is used to configure quota information corresponding to different time granularities for different open source hosts, and the quota information can be stored in the database 320 . Database 320 may interact with quota service 330 . When the client 340 requests the target applet in response to the user's access request, it needs to pull the applet package from the package delivery service 350 . Package distribution service 350 may include PMS (Package Manager Service, package management service) 351 and META (installation package) 352, PMS 351 may provide control services for distribution of small program packages, and META 352 may provide data services for distribution of small program packages. The package distribution service 350 composed of PMS 351 and META 352 can interact with the quota service 330 . Therefore, the quota service 330 can determine whether to send the applet package of the target applet currently requested from the package delivery service 350 to the client 340 based on the quota information stored in the database 320 .

根据本公开的实施例,数据库320与配额服务330的交互可以包括:基于watt协议实现数据库320与配额服务330之间的数据同步。数据同步包括:数据库320中的配额信息可以同步至配额服务330中。配额服务330可以将下发至客户端340的小程序包的相关信息同步记录至数据库320中。According to an embodiment of the present disclosure, the interaction between the database 320 and the quota service 330 may include: implementing data synchronization between the database 320 and the quota service 330 based on the watt protocol. Data synchronization includes: the quota information in the database 320 can be synchronized to the quota service 330 . The quota service 330 can record the relevant information of the mini-program packages delivered to the client 340 into the database 320 synchronously.

通过本公开的上述实施例,引入配额信息,基于宿主维度、多时间粒度的分发配额方法,构造了从0到1完成小程序分发的宿主配额机制。通过配额信息控制小程序的分发或中断,可有效预防异常流量恶意拉取小程序包信息的行为,解决开源宿主的包分发服务可能存在的小程序包信息泄露等风险问题。Through the above-mentioned embodiments of the present disclosure, quota information is introduced, and based on the distribution quota method of host dimension and multi-time granularity, a host quota mechanism for completing mini-program distribution from 0 to 1 is constructed. Controlling the distribution or interruption of small programs through quota information can effectively prevent abnormal traffic from maliciously pulling small program package information, and solve risk problems such as small program package information leakage that may exist in the package distribution service of open source hosts.

下面结合具体实施例,对图2所示的方法做进一步说明。The method shown in FIG. 2 will be further described below in conjunction with specific embodiments.

根据本公开的实施例,预设时长包括至少一个预设时长,访问阈值是根据所述预设时长确定的。根据配额信息确定所述目标小程序的分发方式包括:针对每个预设时长,确定目标开源宿主在与该预设时长相对应的时间段内已访问的小程序的访问数目。在每个访问数目均小于与该访问数目相对应的访问阈值的情况下,将目标小程序分发至目标开源宿主。According to an embodiment of the present disclosure, the preset duration includes at least one preset duration, and the access threshold is determined according to the preset duration. Determining the distribution method of the target applet according to the quota information includes: for each preset duration, determining the number of applets accessed by the target open source host within a time period corresponding to the preset duration. When each access number is smaller than the access threshold corresponding to the access number, the target applet is distributed to the target open source host.

根据本公开的实施例,至少一个预设时长例如包括一个小时、十二个小时、一天等。访问阈值可以根据预设时长的不同而适应性设置。例如,目标开源宿主为软件A,可设置其在一个小时内访问小程序的访问阈值为10,在一天内访问小程序的访问阈值为50。与一个小时相对应的时间段例如包括一天中的12时-13时、13时-14时等,也可以包括以当前时刻为终止时间点的时长等于一个小时的时间段,在此不做限定。相应地,与一天相对应的时间段例如包括从0时-24时,也可以包括以当前时刻为终止时间点的时长等于一天的时间段等,在此也不进行限定。对应于软件A,与时长等于一个小时的时间段内已访问的小程序的访问数目相对应的访问阈值可以为10;与时长等于一天的时间段内已访问的小程序的访问数目相对应的访问阈值可以为50。According to an embodiment of the present disclosure, the at least one preset duration includes, for example, one hour, twelve hours, one day, and the like. The access threshold can be adaptively set according to different preset durations. For example, if the target open source host is software A, the access threshold for accessing applets within one hour can be set to 10, and the access threshold for accessing applets within one day can be set to 50. The time period corresponding to one hour includes, for example, 12:00-13:00 and 13:00-14:00 in a day, and may also include a time period equal to one hour with the current time as the end time point, which is not limited here. Correspondingly, the time period corresponding to one day includes, for example, from 0 o'clock to 24 o'clock, and may also include a time period equal to one day with the current time as the end time point, which is not limited here. Corresponding to software A, the access threshold corresponding to the number of visits of applets accessed within a time period equal to one hour may be 10; the access threshold corresponding to the number of visits of applets accessed within a time period of one day may be 50.

根据本公开的实施例,在预设时长例如只包括一个小时这一时长的情况下,可以直接判断,在目标开源宿主在一个小时内访问小程序的访问数目小于预设的访问阈值的情况下,将目标小程序分发至该目标开源宿主。According to the embodiments of the present disclosure, when the preset duration includes only one hour, for example, it can be directly determined that the target applet is distributed to the target open source host when the number of accesses to the applet by the target open source host within one hour is less than the preset access threshold.

根据本公开的实施例,在预设时长例如包括一个小时、一天等多个的情况下,需要在当前时刻下对应的每个预设时长的时间窗口内的访问数目均小于相应预设时长对应的访问阈值的情况下,方能确定对目标开源宿主请求访问的目标小程序进行分发。例如,可以针对预设时长配置固定的整时到整时的时间窗口,则在请求访问目标小程序的当前时刻为13时45分的情况下,对应一个小时时长的时间窗口可以为13时-14时,对应一天时长的时间窗口可以为0时-24时。对于软件A,可以判断软件A在13时-13时45分访问的小程序的数目是否小于10,以及在0时-13时45分访问的小程序的数目是否小于50,并且只有在两者判断结果均为是的情况下,才向软件A分发其在13时45分请求访问的该目标小程序。According to an embodiment of the present disclosure, when the preset duration includes multiple times such as one hour, one day, etc., the distribution of the target applet that the target open source host requests to access can only be determined when the number of visits in the time window corresponding to each preset duration at the current moment is less than the access threshold corresponding to the corresponding preset duration. For example, a fixed hour-to-hour time window can be configured for the preset duration. If the current time of requesting access to the target applet is 13:45, the time window corresponding to one hour can be 13:00-14:00, and the time window corresponding to one day can be 0:00-24:00. For software A, it can be judged whether the number of applets accessed by software A at 13:00-13:45 is less than 10, and whether the number of applets accessed at 00:00-13:45 is less than 50, and only when the judgment results of both are yes, the target applet that it requested to access at 13:45 is distributed to software A.

通过本公开的上述实施例,提供了一种目标小程序能够分发的可行性基础条件,在该条件的基础上分发目标小程序,能够有效保证小程序包分发的稳定性,规避智能小程序开源联盟潜在的安全风险问题。Through the above-mentioned embodiments of the present disclosure, a basic condition for the feasibility of distributing the target applet is provided. Distributing the target applet on the basis of this condition can effectively ensure the stability of the distribution of the applet package, and avoid potential security risks of the Smart Applet Open Source Alliance.

根据本公开的实施例,配额信息中还包括已访问的小程序的标识信息。小程序分发控制方法还包括:在每个访问数目均小于与该访问数目相对应的访问阈值的情况下,针对每个预设时长,首先确定目标开源宿主在与该预设时长相对应的时间段内已访问的小程序的第一标识信息。然后,在根据第一标识信息未能识别到目标小程序的目标标识信息的情况下,在与目标开源宿主相关的配额信息中记录目标标识信息。According to an embodiment of the present disclosure, the quota information further includes identification information of the accessed applet. The applet distribution control method further includes: in the case that each number of visits is less than the visit threshold corresponding to the number of visits, for each preset time length, first determining the first identification information of the applets that the target open source host has accessed within the time period corresponding to the preset time length. Then, if the target identification information of the target applet cannot be identified according to the first identification information, the target identification information is recorded in the quota information related to the target open source host.

根据本公开的实施例,配额信息可以表现为开源宿主、时间窗口、已使用配额的形式,完成对每个宿主在每个时间窗口内已使用配额的记录。遵循同一个宿主在请求同一个小程序的情况下仅占用一个配额计数的原则,配额信息中的已使用配额可以记录为已访问的小程序的访问数目的形式,也可以以开源宿主已访问的小程序的ID(标识)进行标记。第一标识信息例如为在每个访问数目均小于与该访问数目相对应的访问阈值的情况下,与该访问数目相对应的预设时长对应的时间段内目标开源宿主已访问的小程序的ID信息。包含有已访问的小程序的ID信息的目标配额信息例如可存储在redis(一种日志型数据库)中。According to an embodiment of the present disclosure, the quota information may be in the form of an open source host, a time window, and a used quota, and records the used quota of each host within each time window. Following the principle that the same host only occupies one quota when requesting the same applet, the used quota in the quota information can be recorded in the form of the number of visited applets, or can be marked with the ID (identification) of the visited applets of the open source host. The first identification information is, for example, the ID information of the applets that the target open source host has accessed within the time period corresponding to the preset duration corresponding to the number of visits when each number of visits is less than the access threshold corresponding to the number of visits. The target quota information including the ID information of the accessed applet can be stored in redis (a log type database), for example.

根据本公开的实施例,只有在某个开源宿主在某个时间粒度下的配额未满,且该开源宿主请求的小程序为初次请求的情况下,才可以对与该开源宿主相对应的配额信息中的已使用配额的计数加一。进一步的,在针对已使用配额的计数加一的同时,还可以在已使用配额中记录该初次请求的小程序的ID信息,基于此,可构建上述第一标识信息。According to the embodiment of the present disclosure, only when the quota of an open source host is not full at a certain time granularity, and the applet requested by the open source host is the first request, the count of the used quota in the quota information corresponding to the open source host can be increased by one. Further, while adding one to the count of the used quota, the ID information of the first requested applet may also be recorded in the used quota, and based on this, the above-mentioned first identification information may be constructed.

根据本公开的实施例,在与目标开源宿主相关的目标配额信息的目标已使用配额中已包括第一标识信息的情况下,当该目标开源宿主需要请求获取目标小程序包的信息时,可以首先识别宿主身份以定位至该目标配额信息,然后基于该目标配额信息对多时间粒度的配额现状并行在线校验。在某个时间粒度下,若该目标开源宿主的配额未满,且请求该目标小程序的信息为初次请求,即根据目标已使用配额中中的第一标识信息不能识别到目标小程序的目标标识信息,则可以对当前目标开源宿主在当前时间粒度的目标已使用配额的计数加一。并且,更进一步的,还可以在该目标已使用配额中记录该目标小程序的目标标识信息。According to an embodiment of the present disclosure, in the case that the target used quota of the target quota information related to the target open source host already includes the first identification information, when the target open source host needs to request information on the target applet package, it can first identify the identity of the host to locate the target quota information, and then check the status of the quota at multiple time granularities in parallel online based on the target quota information. At a certain time granularity, if the quota of the target open source host is not full, and the request for the information of the target applet is the first request, that is, the target identifier information of the target applet cannot be identified according to the first identification information in the target used quota, then one can be added to the count of the target used quota of the current target open source host at the current time granularity. And, further, the target identification information of the target applet can also be recorded in the target used quota.

需要说明的是,在根据第一标识信息不能识别到目标标识信息的情况下,当且仅当目标开源宿主在全部时间粒度下已访问的小程序的访问数目均未超出目标配额信息中的相应时间粒度对应的访问阈值时,才允许将目标小程序分发至该目标开源宿主。针对目标小程序的分发完成后,可以异步的将目标标识信息记录入redis中相应的目标配额信息中。It should be noted that if the target identification information cannot be identified according to the first identification information, the target applet is allowed to be distributed to the target open source host if and only if the number of applets accessed by the target open source host at all time granularities does not exceed the access threshold corresponding to the corresponding time granularity in the target quota information. After the distribution of the target applet is completed, the target identification information can be asynchronously recorded in the corresponding target quota information in redis.

根据本公开的实施例,在根据第一标识信息能够识别到目标标识信息的情况下,可以直接确定目标小程序通过配额校验,并可以将该目标小程序分发至该目标开源宿主。According to the embodiments of the present disclosure, if the target identification information can be identified according to the first identification information, it can be directly determined that the target applet has passed the quota check, and the target applet can be distributed to the target open source host.

根据本公开的实施例,小程序分发控制方法在实现时可以与宿主的拉包请求并行处理,通过上游服务统一判断处理,可以不影响宿主拉包的耗时。According to the embodiments of the present disclosure, the applet distribution control method can be implemented in parallel with the host's request to pull the package, and the upstream service can make unified judgment and processing without affecting the time-consuming of the host's package pull.

通过本公开的上述实施例,在配额信息中配置已访问的小程序的标识信息,可以详细记录各小程序的访问情况。基于标识信息进行小程序分发控制的判断,可有效提高判断速率,减少小程序分发时的耗时。Through the above embodiments of the present disclosure, the quota information is configured with the identification information of the applets that have been accessed, so that the access situation of each applet can be recorded in detail. Judging the distribution control of small programs based on identification information can effectively improve the speed of judgment and reduce the time consumption of small program distribution.

根据本公开的实施例,访问请求的数目为多个,每个访问请求请求访问的小程序均为上述目标小程序。在根据第一标识信息未能识别到目标小程序的目标标识信息的情况下,在与目标开源宿主相关的配额信息中记录目标标识信息包括:记录来自多个访问请求中的任意一个访问请求请求访问的目标小程序的目标标识信息。According to an embodiment of the present disclosure, there are multiple access requests, and the applet requested by each access request is the above-mentioned target applet. In the case that the target identification information of the target applet cannot be identified according to the first identification information, recording the target identification information in the quota information related to the target open source host includes: recording the target identification information of the target applet requested by any one of the multiple access requests.

根据本公开的实施例,例如,存在多个用户同时在同一个开源宿主上发出针对同一个目标小程序的访问请求,则在同一个进程内,可能存在多个线程同时回源同一个资源。在该种情况下,可能会有较多流量。为了减少源头redis的瞬时存储压力,可以基于pendingcache(挂起缓存),对于同一资源,在短时间内只放一条流量回源,即只记录众多访问请求的其中一个访问请求请求访问的目标小程序的目标标识信息,剩余的流量可以在记录一条流量的同时被pending cache阻塞,阻塞的流量可直接读取记录一条流量后的缓存。According to the embodiments of the present disclosure, for example, if multiple users simultaneously issue access requests for the same target applet on the same open source host, there may be multiple threads returning to the source of the same resource at the same time in the same process. In this case, there may be more traffic. In order to reduce the instantaneous storage pressure of the source redis, based on the pending cache (suspended cache), for the same resource, only one flow is sent back to the source in a short period of time, that is, only one of the many access requests is recorded.

通过本公开的上述实施例,只针对一个访问请求进行记录,可有效缓解配额信息更新时的压力,提高服务性能。Through the above-mentioned embodiments of the present disclosure, only one access request is recorded, which can effectively relieve the pressure of quota information update and improve service performance.

根据本公开的实施例,在每个访问数目均小于与该访问数目相对应的访问阈值的情况下,针对每个预设时长,还包括:在满足更新条件的情况下,根据目标标识信息和第一标识信息更新目标开源宿主在与预设时长相对应的时间段内已访问的小程序的访问数目。According to an embodiment of the present disclosure, when each number of visits is less than the access threshold corresponding to the number of visits, for each preset time duration, further includes: updating the number of visits of applets that the target open source host has accessed within the time period corresponding to the preset time length according to the target identification information and the first identification information when the update condition is met.

根据本公开的实施例,在将目标标识信息添加至目标已使用配额之后,当前的目标配额信息可以表征目标开源宿主在相应的时间粒度下已访问的小程序包括与第一标识信息所包括的ID信息相对应的小程序,以及与目标标识信息所表征的ID信息相对应的小程序。在增加了目标标识信息之后,可以确定,此时目标开源宿主已访问的小程序的访问数目会相较于未增加目标标识信息之前的访问数目多1。According to an embodiment of the present disclosure, after the target identification information is added to the used quota of the target, the current target quota information can represent the applets that the target open source host has accessed at the corresponding time granularity, including the applets corresponding to the ID information included in the first identification information and the applets corresponding to the ID information represented by the target identification information. After the target identification information is added, it can be determined that the number of visits of the applets that the target open source host has visited will be 1 more than the number of visits before the target identification information is not added.

通过本公开的上述实施例,可以自动更新下一次小程序分发控制时的配额信息,为下一次小程序分发控制提供数据基础的同时,也减少了整个流程的耗时。Through the above-mentioned embodiments of the present disclosure, the quota information for the next mini-program distribution control can be automatically updated, providing a data basis for the next mini-program distribution control, and reducing the time consumption of the entire process.

根据本公开的实施例,根据配额信息确定目标小程序的分发方式还包括:响应于目标访问数目,确定与目标访问数目相对应的目标预设时长。其中,目标访问数目等于与目标访问数目相对应的访问阈值。确定在与目标预设时长相对应的时间段内已访问的小程序的第二标识信息。根据第二标识信息和目标小程序的目标标识信息确定目标小程序的分发方式。According to an embodiment of the present disclosure, determining the distribution method of the target applet according to the quota information further includes: in response to the target number of visits, determining a target preset duration corresponding to the target number of visits. Wherein, the target access number is equal to the access threshold corresponding to the target access number. The second identification information of the applets that have been accessed within the time period corresponding to the preset target duration is determined. The distribution mode of the target applet is determined according to the second identification information and the target identification information of the target applet.

根据本公开的实施例,例如,软件A在一个小时内可以访问的小程序的访问阈值为10,则可以确定,目标访问数目例如为10,目标预设时长例如为一个小时。在此基础上,第二标识信息例如为软件A在一个小时内访问的10个小程序的ID信息。本实施例中,软件A在一个小时内已访问的小程序的目标访问数目等于软件A在一个小时时长下的访问阈值,在该种情况下,可以进一步根据已访问的小程序的ID信息与待访问的目标小程序的目标标识信息进行目标小程序是否继续分发的判断。According to an embodiment of the present disclosure, for example, if the access threshold of applets that software A can access within one hour is 10, it can be determined that the target access number is, for example, 10, and the target preset duration is, for example, one hour. On this basis, the second identification information is, for example, ID information of 10 applets accessed by software A within one hour. In this embodiment, the target access number of applets that software A has accessed within one hour is equal to the access threshold of software A within one hour. In this case, it can be further judged whether the target applet should continue to be distributed according to the ID information of the accessed applet and the target identification information of the target applet to be accessed.

根据本公开的实施例,当小程序集成到某个目标开源宿主中时,在不同时间窗口下,目标开源宿主获取不同小程序信息的数量不应超过预设的访问阈值,这个访问阈值可以是目标开源宿主的一个经验值,能够保障目标开源宿主正常使用小程序服务。超过访问阈值则认为存在恶意拉取小程序的行为。低于访问阈值可以直接对后续想要访问的目标小程序进行分发。对于等于访问阈值的情况,可以进一步结合已访问的小程序的ID信息来判断是否对目标小程序继续分发。According to the embodiment of the present disclosure, when the applet is integrated into a certain target open source host, under different time windows, the number of different applet information obtained by the target open source host should not exceed the preset access threshold, which can be an experience value of the target open source host, which can ensure the normal use of the applet service by the target open source host. If the access threshold is exceeded, it is considered that there is a behavior of maliciously pulling applets. If it is lower than the access threshold, the target applets that you want to access later can be directly distributed. For the case of being equal to the access threshold, it may be further combined with the ID information of the accessed applet to determine whether to continue distributing the target applet.

根据本公开的实施例,根据第二标识信息和目标小程序的目标标识信息确定目标小程序的分发方式包括:在根据第二标识信息识别到目标标识信息的情况下,将目标小程序分发至目标开源宿主。在根据第二标识信息未能识别到目标标识信息的情况下,中断目标小程序向目标开源宿主的分发过程。According to an embodiment of the present disclosure, determining the distribution method of the target applet according to the second identification information and the target identification information of the target applet includes: distributing the target applet to the target open source host when the target identification information is identified according to the second identification information. If the target identification information is not recognized according to the second identification information, the process of distributing the target applet to the target open source host is interrupted.

根据本公开的实施例,对于单个时间窗口下,目标开源宿主已访问的小程序的访问数目等于该时间窗口对应的访问阈值的情况,只有在目标开源宿主将要访问的目标小程序属于已访问的小程序的情况下,才会对目标小程序进行分发。否则,不对目标小程序进行分发。目标小程序是否属于已访问的小程序可以通过判断根据第二标识信息是否能识别到目标标识信息来确定。According to the embodiments of the present disclosure, in a single time window, when the number of applets visited by the target open source host is equal to the access threshold corresponding to the time window, the target applet will be distributed only when the target applet to be accessed by the target open source host belongs to the visited applet. Otherwise, the target applet is not distributed. Whether the target applet is an accessed applet may be determined by judging whether the target identification information can be identified according to the second identification information.

根据本公开的实施例,目标小程序是否分发的判断过程例如基于内存判断完成。要进行内存判断,例如需要首先将redis中的相关信息转移至内存中,该过程可以通过设置定时拉取任务周期性拉取实现。定时拉取的相关信息可以经由缓存存入内存中。由于拉取过程为周期性拉取,因此可能存在内存已满、缓存未满的情况,即redis中的信息尚未完全转移至内存中。例如,周期为5秒,在上一个周期已完成对redis中信息的拉取,在下一个周期到来之前,存在新的信息同步至redis中,而由于下一个周期尚未到来,因此新的信息尚无法被拉取到内存中。在该种情况下,若内存中不包括目标标识信息,可以进一步根据redis的存储信息进行判断,并在redis中包含目标标识信息的情况下,对目标小程序进行分发。在redis中不包含目标标识信息的情况下,不对目标小程序进行分发。对于缓存和内存均满的情况,若内存中也不包括目标标识信息,可以直接确定不对目标小程序进行分发。According to the embodiment of the present disclosure, the process of judging whether to distribute the target applet is completed based on memory judgment, for example. To make a memory judgment, for example, it is necessary to first transfer the relevant information in redis to the memory. This process can be realized by setting a scheduled pull task to pull periodically. Relevant information pulled periodically can be stored in memory via cache. Since the pull process is a periodic pull, there may be a situation where the memory is full and the cache is not full, that is, the information in redis has not been completely transferred to the memory. For example, if the cycle is 5 seconds, the pull of information from redis has been completed in the previous cycle, and before the arrival of the next cycle, there is new information synchronized to redis, and because the next cycle has not yet arrived, the new information cannot be pulled into the memory yet. In this case, if the target identification information is not included in the internal memory, further judgment can be made based on the storage information of redis, and the target applet can be distributed if the target identification information is included in redis. If the target identification information is not included in redis, the target applet will not be distributed. For the case where both the cache and the memory are full, if the target identification information is not included in the memory, it can be directly determined not to distribute the target applet.

根据本公开的实施例,配额服务允许开源宿主的批量请求,可以采用半同步方式校验同一宿主的批量请求。多数情况下,内存判断可以直接决定最终结果,基于内存判断,可以保证在很短的时间内(<1ms)完成配额判断,从而完成目标小程序的分发或中断目标小程序的分发。According to the embodiments of the present disclosure, the quota service allows batch requests of open source hosts, and can verify batch requests of the same host in a semi-synchronous manner. In most cases, the memory judgment can directly determine the final result. Based on the memory judgment, the quota judgment can be completed in a very short time (<1ms), so as to complete the distribution of the target applet or interrupt the distribution of the target applet.

通过本公开的上述实施例,构建了业内第一个针对智能小程序开源联盟的宿主配额技术方案,填补了空白,也保障了智能小程序开源宿主接入的安全性以及小程序包分发服务的高性能,是智能小程序开源建设的重要一环。Through the above-mentioned embodiments of the present disclosure, the industry's first host quota technical solution for the open source alliance of smart applets is constructed, which fills in the gaps, and also ensures the security of open source host access of smart applets and the high performance of small program package distribution services, which is an important part of the open source construction of smart applets.

根据本公开的实施例,小程序分发控制方法还包括:在监听到配额信息发生更新的情况下,根据更新后的配额信息确定针对开源宿主配置的配额信息。According to an embodiment of the present disclosure, the applet distribution control method further includes: determining the quota information configured for the open source host according to the updated quota information in a case that the quota information is monitored to be updated.

根据本公开的实施例,配额服务还可以提供配置信息实时更新的能力,允许小程序开源联盟进行宿主配额的在线变更。可以利用mysql数据库存储配额信息,并采用已有服务(watt+bp订阅)实时追踪数据库变更情况,可实现配置秒级生效。According to the embodiments of the present disclosure, the quota service can also provide the ability to update configuration information in real time, allowing the Mini Program Open Source Alliance to change host quotas online. You can use the mysql database to store quota information, and use existing services (watt+bp subscription) to track database changes in real time, enabling configurations to take effect in seconds.

通过本公开的上述实施例,基于更新操作,可提供配额信息在线变更能力,并可实现秒级生效。Through the above-mentioned embodiments of the present disclosure, based on the update operation, the ability to change quota information online can be provided, and second-level validation can be realized.

根据本公开的实施例,小程序分发控制方法还包括:在确定访问分布式存储空间成功的情况下,将针对各开源宿主配置的配额信息存储至分布式存储空间中。在确定访问分布式存储空间失败的情况下,将针对各开源宿主配置的配额信息存储至与各开源宿主相关的内存空间中。According to an embodiment of the present disclosure, the applet distribution control method further includes: if it is determined that the access to the distributed storage space is successful, storing the quota information configured for each open source host in the distributed storage space. When it is determined that the access to the distributed storage space fails, the quota information configured for each open source host is stored in a memory space related to each open source host.

根据本公开的实施例,可以在单实例中维护配额信息的内存存储结构,包括存储每个宿主、每个时间窗口内已使用配额等信息。采用分布式redis结合单实例内存存储的方式,可进一步保证服务性能并实现多地域数据同步。According to the embodiments of the present disclosure, the memory storage structure of the quota information can be maintained in a single instance, including storing information such as each host and the used quota in each time window. Using distributed redis combined with single-instance memory storage can further guarantee service performance and realize multi-regional data synchronization.

根据本公开的实施例,考虑到线上服务强依赖redis存储,提供一种请求redis服务失败情况下的降级解决方案。通过建立全局配置开关,可以控制服务是否降级。在降级情况下,配额信息可依赖单实例缓存,区别于正常情况和降级环境下的内存存储结构,存储当前宿主、当前时间窗口对应的已使用配额的情况。对于上游请求,可正常判断是否命中缓存,待降级开关关闭后可执行redis同步。According to the embodiments of the present disclosure, considering that online services strongly rely on redis storage, a downgrade solution in the case of failure to request redis services is provided. By establishing a global configuration switch, you can control whether the service is degraded. In the downgraded situation, the quota information can rely on the single instance cache, which is different from the memory storage structure in the normal situation and the degraded environment, and stores the used quota corresponding to the current host and the current time window. For upstream requests, it can be judged normally whether the cache is hit, and redis synchronization can be performed after the downgrade switch is turned off.

通过本公开的上述实施例,实现了多维度配额现状信息的分布式在线存储与实时更新,并提供了一种容灾能力,可进一步保证服务性能。Through the above-mentioned embodiments of the present disclosure, distributed online storage and real-time update of multi-dimensional quota status information are realized, and a disaster recovery capability is provided to further ensure service performance.

图4示意性示出了根据本公开实施例的配额服务的工作流程图。Fig. 4 schematically shows a working flowchart of a quota service according to an embodiment of the present disclosure.

如图4所示,该流程包括操作S410~S470。As shown in FIG. 4, the process includes operations S410-S470.

在操作S410,数据内存加载。In operation S410, the data memory is loaded.

在操作S420,redis数据定时拉取。In operation S420, redis data is periodically pulled.

在操作S430,配额时间窗口定时切换。In operation S430, the quota time window is switched periodically.

在操作S440,配额信息查询。In operation S440, quota information is queried.

在操作S450,内存判断。In operation S450, the memory is judged.

在操作S460,redis查询&存储。In operation S460, redis query & store.

在操作S470,结果合并。In operation S470, the results are merged.

根据本公开的实施例,操作S410~S430可离线执行。数据内存加载可以将存储至redis中的信息加载至内存。redis数据定时拉取可以基于预定的时间,主动拉取redis中的信息,以对内存中数据进行实时更新。配额时间窗口定时切换可以针对不同时间粒度定义相应的时间窗口,以便于在每个时间窗口内控制目标小程序的分发。According to an embodiment of the present disclosure, operations S410˜S430 may be performed offline. Data memory loading can load information stored in redis to memory. Redis data timing pull can actively pull the information in redis based on the scheduled time to update the data in memory in real time. Quota time window timing switching can define corresponding time windows for different time granularities, so as to control the distribution of target applets in each time window.

根据本公开的实施例,操作S440~S470一般在线执行。配额信息查询可以着重于查询redis中存储的针对不同开源宿主设置的访问阈值。内存判断可以基于redis中的信息和查询到的访问阈值等信息对相应时间窗口下的小程序是否分发分发进行判断。redis查询&存储可以对完成分发的小程序的ID信息进行进一步记录。According to an embodiment of the present disclosure, operations S440-S470 are generally performed online. Quota information query can focus on querying the access thresholds stored in redis for different open source hosts. The memory judgment can be based on the information in redis and the queried access threshold and other information to judge whether the applets in the corresponding time window are distributed or not. Redis query & storage can further record the ID information of the distributed applets.

需要说明的是,配额服务允许开源宿主的批量请求。在存在多个访问请求的情况下,可以对该多个访问请求进行并行回源处理。由于针对一个开源宿主可能配置多个时间粒度,在存在多个时间粒度的情况下,可以通过并发等待的方式确定所有时间粒度下针对小程序分发的判断结果,即分发或者中断分发。It should be noted that the quota service allows batch requests of open source hosts. In the case that there are multiple access requests, the multiple access requests can be processed back to the origin in parallel. Since multiple time granularities may be configured for an open source host, in the case of multiple time granularities, the judging results for small program distribution at all time granularities can be determined by means of concurrent waiting, that is, distribution or interrupt distribution.

图5示意性示出了根据本公开实施例的内存判断的流程图。Fig. 5 schematically shows a flow chart of memory judgment according to an embodiment of the present disclosure.

如图5所示,该流程包括操作S501~S510。As shown in FIG. 5, the process includes operations S501-S510.

在操作S501,内存缓存数据查询。In operation S501, data query is cached in memory.

在操作S502,判断元素是否存在。若是,则执行操作S503;若否,则执行操作S504。In operation S502, it is determined whether an element exists. If yes, perform operation S503; if not, perform operation S504.

在操作S503,小程序分发。In operation S503, the applet is distributed.

在操作S504,判断存储是否未满,若是,则执行操作S505~S506;若否,则执行操作S507。In operation S504, it is judged whether the storage is not full, if yes, perform operations S505-S506; if not, perform operation S507.

在操作S505,小程序分发。In operation S505, the applet is distributed.

在操作S506,redis存储。In operation S506, redis stores.

在操作S507,判断缓存是否未满。若是,则执行操作S509,若否,则执行操作S508。In operation S507, it is determined whether the cache is not full. If yes, perform operation S509, and if not, perform operation S508.

在操作S508,终端小程序分发。In operation S508, the terminal applet is distributed.

在操作S509,判断元素是否存在redis中。若是,则执行操作S510;若否,则执行操作S508。In operation S509, it is determined whether the element exists in redis. If yes, perform operation S510; if not, perform operation S508.

在操作S510,小程序分发。In operation S510, the applet is distributed.

根据本公开的实施例,元素可以用于表示要访问的目标小程序的目标标识信息。内存判断过程可以包括内存是否已满的判断、缓存是否已满的判断、redis数据的判断、以及目标标识信息是否已存在的判断。在目标标识信息已存在的情况下,可以直接对目标小程序进行分发。在目标标识信息不存在的情况下,可以进一步判断存储数据是否未达到访问阈值。在存储数据未达到访问阈值的情况下,可以直接对目标小程序进行分发。并可在分发后记录目标标识信息。在存储数据未达到访问阈值的情况下,可以进一步判断缓存是否未满。在缓存已满的情况下,可以中断小程序的分发。在缓存未满的情况下,可以进一步判断目标标识信息是否存在redis中。在目标标识信息存在redis中的情况下,可以直接对目标小程序进行分发。在目标标识信息未存在redis中的情况下,可以中断小程序的分发。According to an embodiment of the present disclosure, an element may be used to represent target identification information of a target applet to be accessed. The memory judging process may include judging whether the memory is full, judging whether the cache is full, judging redis data, and judging whether the target identification information already exists. In the case that the target identification information already exists, the target applet can be distributed directly. In the case that the target identification information does not exist, it may be further determined whether the stored data has not reached the access threshold. When the stored data does not reach the access threshold, the target applet can be distributed directly. And can record target identification information after distribution. When the stored data does not reach the access threshold, it may be further determined whether the cache is not full. In case the cache is full, the distribution of applets can be interrupted. When the cache is not full, it can be further judged whether the target identification information exists in redis. When the target identification information exists in redis, the target applet can be distributed directly. In the case that the target identification information does not exist in redis, the distribution of the applet can be interrupted.

通过本公开的上述实施例,为智能小程序开源解决方案提供了风险控制能力。在多宿主接入的环境背景下,维护小程序信息的安全性和小程序包分发服务的稳定性是开源联盟必需的核心能力。本公开能够有效识别并阻绝异常流量,隔离恶意拉取行为,进行有效风险控制。同时,服务响应时间短,配置生效快。本公开的小程序分发控制方法与正常业务逻辑并行发生,不影响业务响应耗时,支持配置秒级生效。在为业务设置安全防线的基础上,确保业务的高性能。并且,本服务本身响应时间短,整体平均耗时在1ms内。Through the above-mentioned embodiments of the present disclosure, the risk control capability is provided for the smart applet open source solution. In the environment of multi-homed access, maintaining the security of mini-program information and the stability of mini-program package distribution services is the core capability required by the open source alliance. The disclosure can effectively identify and block abnormal traffic, isolate malicious pulling behaviors, and perform effective risk control. At the same time, the service response time is short, and the configuration takes effect quickly. The applet distribution control method of the present disclosure occurs in parallel with normal business logic, does not affect the time-consuming business response, and supports configuration to take effect at the second level. On the basis of setting a security defense line for the business, ensure the high performance of the business. Moreover, the response time of this service itself is short, and the overall average time-consuming is within 1ms.

图6示意性示出了根据本公开实施例的小程序分发控制装置的框图。Fig. 6 schematically shows a block diagram of an apparatus for controlling distribution of applets according to an embodiment of the present disclosure.

如图6所示,小程序分发控制装置600包括第一确定模块610、第二确定模块620和第三确定模块630。As shown in FIG. 6 , the applet distribution control apparatus 600 includes a first determining module 610 , a second determining module 620 and a third determining module 630 .

第一确定模块610,用于确定针对开源宿主配置的配额信息。其中,配额信息用于表征开源宿主在预设时长内访问小程序的访问阈值。The first determination module 610 is configured to determine the quota information configured for the open source host. Among them, the quota information is used to represent the access threshold of the open source host to access the applet within a preset period of time.

第二确定模块620,用于响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序。The second determining module 620 is configured to determine the target applet requesting access in response to the access request from the target open source host.

第三确定模块630,用于根据配额信息确定目标小程序的分发方式。其中,分发方式包括将目标小程序分发至目标开源宿主或者中断目标小程序向目标开源宿主的分发过程。The third determining module 630 is configured to determine the distribution mode of the target applet according to the quota information. Wherein, the distribution method includes distributing the target applet to the target open source host or interrupting the distribution process of the target applet to the target open source host.

根据本公开的实施例,预设时长包括至少一个预设时长,访问阈值是根据预设时长确定的。第三确定模块包括第一确定单元和分发单元。According to an embodiment of the present disclosure, the preset duration includes at least one preset duration, and the access threshold is determined according to the preset duration. The third determination module includes a first determination unit and a distribution unit.

第一确定单元,用于针对每个预设时长,确定目标开源宿主在与预设时长相对应的时间段内已访问的小程序的访问数目。The first determination unit is configured to determine, for each preset duration, the number of applets accessed by the target open source host within a time period corresponding to the preset duration.

分发单元,用于在每个访问数目均小于与访问数目相对应的访问阈值的情况下,将目标小程序分发至目标开源宿主。The distribution unit is configured to distribute the target applet to the target open source host when each access number is less than the access threshold corresponding to the access number.

根据本公开的实施例,配额信息中还包括已访问的小程序的标识信息。小程序分发控制装置还包括记录模块。According to an embodiment of the present disclosure, the quota information further includes identification information of the accessed applet. The applet distribution control device also includes a recording module.

记录模块,用于在每个访问数目均小于与访问数目相对应的访问阈值的情况下,针对每个预设时长:确定目标开源宿主在与预设时长相对应的时间段内已访问的小程序的第一标识信息。在根据第一标识信息未能识别到目标小程序的目标标识信息的情况下,在与目标开源宿主相关的配额信息中记录目标标识信息。A recording module, configured to: determine the first identification information of the applets that the target open source host has visited within the time period corresponding to the preset time period for each preset time period when each number of visits is less than the visit threshold corresponding to the number of visits. If the target identification information of the target applet cannot be identified according to the first identification information, the target identification information is recorded in the quota information related to the target open source host.

根据本公开的实施例,访问请求的数目为多个,每个访问请求请求访问的小程序均为目标小程序。在根据第一标识信息未能识别到目标小程序的目标标识信息的情况下,在与目标开源宿主相关的配额信息中记录目标标识信息包括:记录来自多个访问请求中的任意一个访问请求请求访问的目标小程序的目标标识信息。According to the embodiment of the present disclosure, there are multiple access requests, and the applet requested by each access request is a target applet. In the case that the target identification information of the target applet cannot be identified according to the first identification information, recording the target identification information in the quota information related to the target open source host includes: recording the target identification information of the target applet requested by any one of the multiple access requests.

根据本公开的实施例,记录模块还包括更新单元。According to an embodiment of the present disclosure, the recording module further includes an update unit.

更新单元,用于在满足更新条件的情况下,根据目标标识信息和第一标识信息更新目标开源宿主在与预设时长相对应的时间段内已访问的小程序的访问数目。The update unit is configured to update the number of applets accessed by the target open source host within the time period corresponding to the preset duration according to the target identification information and the first identification information when the update condition is met.

根据本公开的实施例,第三确定模块还包括第二确定单元、第三确定单元和第四确定单元。According to an embodiment of the present disclosure, the third determination module further includes a second determination unit, a third determination unit and a fourth determination unit.

第二确定单元,用于响应于目标访问数目,确定与目标访问数目相对应的目标预设时长。其中,目标访问数目等于与目标访问数目相对应的访问阈值。The second determining unit is configured to determine a target preset duration corresponding to the target number of visits in response to the target number of visits. Wherein, the target access number is equal to the access threshold corresponding to the target access number.

第三确定单元,用于确定在与目标预设时长相对应的时间段内已访问的小程序的第二标识信息。The third determining unit is configured to determine the second identification information of the applets that have been accessed within the time period corresponding to the preset target duration.

第四确定单元,用于根据第二标识信息和目标小程序的目标标识信息确定目标小程序的分发方式。The fourth determining unit is configured to determine the distribution mode of the target applet according to the second identification information and the target identification information of the target applet.

根据本公开的实施例,第四确定单元包括分发子单元和中断子单元。According to an embodiment of the present disclosure, the fourth determination unit includes a distribution subunit and an interruption subunit.

分发子单元,用于在根据第二标识信息识别到目标标识信息的情况下,将目标小程序分发至目标开源宿主。The distribution subunit is configured to distribute the target applet to the target open source host when the target identification information is identified according to the second identification information.

中断子单元,用于在根据第二标识信息未能识别到目标标识信息的情况下,中断目标小程序向目标开源宿主的分发过程。The interrupt subunit is configured to interrupt the distribution process of the target applet to the target open source host when the target identification information is not identified according to the second identification information.

根据本公开的实施例,小程序分发控制装置还包括第四确定模块。According to an embodiment of the present disclosure, the applet distribution control device further includes a fourth determining module.

第四确定模块,用于在监听到配额信息发生更新的情况下,根据更新后的配额信息确定针对开源宿主配置的配额信息。The fourth determination module is configured to determine the quota information configured for the open source host according to the updated quota information when it is monitored that the quota information is updated.

根据本公开的实施例,小程序分发控制装置还包括第一存储模块和第二存储模块。According to an embodiment of the present disclosure, the applet distribution control device further includes a first storage module and a second storage module.

第一存储模块,用于在确定访问分布式存储空间成功的情况下,将针对各开源宿主配置的配额信息存储至分布式存储空间中。The first storage module is configured to store the quota information configured for each open source host in the distributed storage space when it is determined that the access to the distributed storage space is successful.

第二存储模块,用于在确定访问分布式存储空间失败的情况下,将针对各开源宿主配置的配额信息存储至与各开源宿主相关的内存空间中。The second storage module is configured to store the quota information configured for each open source host in a memory space related to each open source host when it is determined that the access to the distributed storage space fails.

根据本公开的实施例,本公开还提供了一种电子设备、一种可读存储介质和一种计算机程序产品。According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

根据本公开的实施例,一种电子设备,包括:至少一个处理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行如上所述的方法。According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the method as described above.

根据本公开的实施例,一种存储有计算机指令的非瞬时计算机可读存储介质,其中,计算机指令用于使计算机执行如上所述的方法。According to an embodiment of the present disclosure, there is a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method as described above.

根据本公开的实施例,一种计算机程序产品,包括计算机程序,计算机程序在被处理器执行时实现如上所述的方法。According to an embodiment of the present disclosure, a computer program product includes a computer program, and the computer program implements the method as described above when executed by a processor.

图7示出了可以用来实施本公开的实施例的示例电子设备700的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。FIG. 7 shows a schematic block diagram of an example electronic device 700 that may be used to implement embodiments of the present disclosure. Electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are by way of example only, and are not intended to limit implementations of the disclosure described and/or claimed herein.

如图7所示,设备700包括计算单元701,其可以根据存储在只读存储器(ROM)702中的计算机程序或者从存储单元708加载到随机访问存储器(RAM)703中的计算机程序,来执行各种适当的动作和处理。在RAM 703中,还可存储设备700操作所需的各种程序和数据。计算单元701、ROM 702以及RAM 703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。As shown in FIG. 7, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to computer programs stored in a read-only memory (ROM) 702 or loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the device 700 can also be stored. The computing unit 701 , ROM 702 , and RAM 703 are connected to each other through a bus 704 . An input/output (I/O) interface 705 is also connected to the bus 704 .

设备700中的多个部件连接至I/O接口705,包括:输入单元706,例如键盘、鼠标等;输出单元707,例如各种类型的显示器、扬声器等;存储单元708,例如磁盘、光盘等;以及通信单元709,例如网卡、调制解调器、无线通信收发机等。通信单元709允许设备700通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the device 700 are connected to the I/O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, an optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information/data with other devices over a computer network such as the Internet and/or various telecommunication networks.

计算单元701可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元70l的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元701执行上文所描述的各个方法和处理,例如小程序分发控制方法。例如,在一些实施例中,小程序分发控制方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元708。在一些实施例中,计算机程序的部分或者全部可以经由ROM 702和/或通信单元709而被载入和/或安装到设备700上。当计算机程序加载到RAM 703并由计算单元701执行时,可以执行上文描述的小程序分发控制方法的一个或多个步骤。备选地,在其他实施例中,计算单元701可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行小程序分发控制方法。The computing unit 701 may be various general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of computing units 701 include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any suitable processors, controllers, microcontrollers, and the like. The computing unit 701 executes the various methods and processes described above, such as the applet distribution control method. For example, in some embodiments, the applet distribution control method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 708 . In some embodiments, part or all of the computer program may be loaded and/or installed on the device 700 via the ROM 702 and/or the communication unit 709 . When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the applet distribution control method described above can be executed. Alternatively, in other embodiments, the computing unit 701 may be configured in any other appropriate way (for example, by means of firmware) to execute the applet distribution control method.

本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described above herein may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpreted on a programmable system comprising at least one programmable processor, which may be a special purpose or general purpose programmable processor, capable of receiving data and instructions from and transmitting data and instructions to a storage system, at least one input device, and at least one output device.

用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to processors or controllers of general-purpose computers, special purpose computers, or other programmable data processing devices, so that the program codes cause the functions/operations specified in the flowcharts and/or block diagrams to be implemented when executed by the processors or controllers. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include one or more wire-based electrical connections, a portable computer disk, a hard disk, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, voice input, or tactile input.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication, eg, a communication network. Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN) and the Internet.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,也可以是分布式系统的服务器,或者是结合了区块链的服务器。A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发公开中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, each step described in the present disclosure may be executed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in the present disclosure can be achieved, no limitation is imposed herein.

上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。The specific implementation manners described above do not limit the protection scope of the present disclosure. It should be apparent to those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.

Claims (18)

Translated fromChinese
1.一种小程序分发控制方法,包括:1. A small program distribution control method, comprising:确定针对开源宿主配置的配额信息,其中,所述配额信息用于表征所述开源宿主在预设时长内访问小程序的访问阈值;Determine the quota information configured for the open source host, wherein the quota information is used to represent the access threshold for the open source host to access the applet within a preset period of time;响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序;以及In response to an access request from a target open source host, determine the target applet for which access is requested; and根据所述配额信息确定所述目标小程序的分发方式,其中,所述分发方式包括将所述目标小程序分发至所述目标开源宿主或者中断所述目标小程序向所述目标开源宿主的分发过程;Determine the distribution method of the target applet according to the quota information, wherein the distribution method includes distributing the target applet to the target open source host or interrupting the distribution process of the target applet to the target open source host;其中,所述预设时长包括至少一个预设时长,所述访问阈值是根据所述预设时长确定的;根据所述配额信息确定所述目标小程序的分发方式包括:Wherein, the preset duration includes at least one preset duration, and the access threshold is determined according to the preset duration; determining the distribution method of the target applet according to the quota information includes:针对每个所述预设时长,确定所述目标开源宿主在与所述预设时长相对应的时间段内已访问的小程序的访问数目;以及For each preset duration, determine the number of applets accessed by the target open source host within the time period corresponding to the preset duration; and在每个所述访问数目均小于与所述访问数目相对应的访问阈值的情况下,将所述目标小程序分发至所述目标开源宿主。In the case that each of the access numbers is smaller than the access threshold corresponding to the access numbers, the target applet is distributed to the target open source host.2.根据权利要求1所述的方法,其中,所述配额信息中还包括已访问的小程序的标识信息;所述方法还包括:2. The method according to claim 1, wherein the quota information further includes identification information of the accessed applet; the method further comprises:在每个所述访问数目均小于与所述访问数目相对应的访问阈值的情况下,针对每个所述预设时长:In the case that each of the access numbers is less than the access threshold corresponding to the access numbers, for each of the preset durations:确定所述目标开源宿主在与所述预设时长相对应的时间段内已访问的小程序的第一标识信息;以及determining first identification information of applets that the target open source host has accessed within a time period corresponding to the preset duration; and在根据所述第一标识信息未能识别到所述目标小程序的目标标识信息的情况下,在与所述目标开源宿主相关的配额信息中记录所述目标标识信息。If the target identification information of the target applet cannot be identified according to the first identification information, record the target identification information in the quota information related to the target open source host.3.根据权利要求2所述的方法,其中,所述访问请求的数目为多个,每个所述访问请求请求访问的小程序均为所述目标小程序;在根据所述第一标识信息未能识别到所述目标小程序的目标标识信息的情况下,在与所述目标开源宿主相关的配额信息中记录所述目标标识信息包括:3. The method according to claim 2, wherein the number of the access requests is multiple, and each of the applets requested by the access request is the target applet; in the case of failing to recognize the target ID information of the target applet according to the first ID information, recording the target ID information in the quota information related to the target open source host comprises:记录来自多个所述访问请求中的任意一个访问请求请求访问的目标小程序的目标标识信息。Recording the target identification information of the target applet that is requested to be accessed by any one of the multiple access requests.4.根据权利要求2所述的方法,其中,在每个所述访问数目均小于与所述访问数目相对应的访问阈值的情况下,针对每个所述预设时长,还包括:4. The method according to claim 2, wherein, when each of the access numbers is less than the access threshold corresponding to the access numbers, for each of the preset durations, further comprising:在满足更新条件的情况下,根据所述目标标识信息和所述第一标识信息更新所述目标开源宿主在与所述预设时长相对应的时间段内已访问的小程序的访问数目。If the update condition is met, the number of applets visited by the target open source host within the time period corresponding to the preset time length is updated according to the target identification information and the first identification information.5.根据权利要求1至4中任一所述的方法,其中,根据所述配额信息确定所述目标小程序的分发方式还包括:5. The method according to any one of claims 1 to 4, wherein determining the distribution method of the target applet according to the quota information further comprises:响应于目标访问数目,确定与所述目标访问数目相对应的目标预设时长,其中,所述目标访问数目等于与所述目标访问数目相对应的访问阈值;Responding to the target number of visits, determining a target preset duration corresponding to the target number of visits, wherein the target number of visits is equal to a visit threshold corresponding to the target number of visits;确定在与所述目标预设时长相对应的时间段内已访问的小程序的第二标识信息;以及determining second identification information of applets that have been accessed within a time period corresponding to the target preset duration; and根据所述第二标识信息和所述目标小程序的目标标识信息确定所述目标小程序的分发方式。Determine the distribution mode of the target applet according to the second identification information and the target identification information of the target applet.6. 根据权利要求5所述的方法,其中,根据所述第二标识信息和所述目标小程序的目标标识信息确定所述目标小程序的分发方式包括:6. The method according to claim 5, wherein determining the distribution method of the target applet according to the second identification information and the target identification information of the target applet comprises:在根据所述第二标识信息识别到所述目标标识信息的情况下,将所述目标小程序分发至所述目标开源宿主;以及Distributing the target applet to the target open source host if the target identification information is identified according to the second identification information; and在根据所述第二标识信息未能识别到所述目标标识信息的情况下,中断所述目标小程序向所述目标开源宿主的分发过程。If the target identification information is not identified according to the second identification information, the process of distributing the target applet to the target open source host is interrupted.7.根据权利要求1所述的方法,还包括:7. The method of claim 1, further comprising:在监听到所述配额信息发生更新的情况下,根据更新后的配额信息确定针对所述开源宿主配置的配额信息。If it is detected that the quota information is updated, the quota information configured for the open source host is determined according to the updated quota information.8. 根据权利要求1所述的方法,还包括:8. The method of claim 1, further comprising:在确定访问分布式存储空间成功的情况下,将针对各开源宿主配置的配额信息存储至所述分布式存储空间中;以及When it is determined that the access to the distributed storage space is successful, the quota information configured for each open source host is stored in the distributed storage space; and在确定访问所述分布式存储空间失败的情况下,将针对所述各开源宿主配置的配额信息存储至与各所述开源宿主相关的内存空间中。If it is determined that the access to the distributed storage space fails, the quota information configured for each of the open source hosts is stored in a memory space related to each of the open source hosts.9.一种小程序分发控制装置,包括:9. A small program distribution control device, comprising:第一确定模块,用于确定针对开源宿主配置的配额信息,其中,所述配额信息用于表征所述开源宿主在预设时长内访问小程序的访问阈值;The first determination module is configured to determine the quota information configured for the open source host, wherein the quota information is used to characterize the access threshold of the open source host to access the applet within a preset period of time;第二确定模块,用于响应于来自目标开源宿主的访问请求,确定请求访问的目标小程序;以及The second determination module is used to determine the target applet requesting access in response to the access request from the target open source host; and第三确定模块,用于根据所述配额信息确定所述目标小程序的分发方式,其中,所述分发方式包括将所述目标小程序分发至所述目标开源宿主或者中断所述目标小程序向所述目标开源宿主的分发过程;A third determining module, configured to determine a distribution method of the target applet according to the quota information, wherein the distribution method includes distributing the target applet to the target open source host or interrupting the distribution process of the target applet to the target open source host;其中,所述预设时长包括至少一个预设时长,所述访问阈值是根据所述预设时长确定的;所述第三确定模块包括:Wherein, the preset duration includes at least one preset duration, and the access threshold is determined according to the preset duration; the third determination module includes:第一确定单元,用于针对每个所述预设时长,确定所述目标开源宿主在与所述预设时长相对应的时间段内已访问的小程序的访问数目;以及The first determining unit is configured to, for each preset duration, determine the number of applets accessed by the target open source host within a time period corresponding to the preset duration; and分发单元,用于在每个所述访问数目均小于与所述访问数目相对应的访问阈值的情况下,将所述目标小程序分发至所述目标开源宿主。A distributing unit, configured to distribute the target applet to the target open source host when each of the access numbers is less than an access threshold corresponding to the access numbers.10.根据权利要求9所述的装置,其中,所述配额信息中还包括已访问的小程序的标识信息;所述装置还包括:10. The device according to claim 9, wherein the quota information further includes identification information of the accessed applet; the device further comprises:记录模块,用于在每个所述访问数目均小于与所述访问数目相对应的访问阈值的情况下,针对每个所述预设时长:A recording module, configured to, for each of the preset durations:确定所述目标开源宿主在与所述预设时长相对应的时间段内已访问的小程序的第一标识信息;以及determining first identification information of applets that the target open source host has accessed within a time period corresponding to the preset duration; and在根据所述第一标识信息未能识别到所述目标小程序的目标标识信息的情况下,在与所述目标开源宿主相关的配额信息中记录所述目标标识信息。If the target identification information of the target applet cannot be identified according to the first identification information, record the target identification information in the quota information related to the target open source host.11.根据权利要求10所述的装置,其中,所述访问请求的数目为多个,每个所述访问请求请求访问的小程序均为所述目标小程序;在根据所述第一标识信息未能识别到所述目标小程序的目标标识信息的情况下,在与所述目标开源宿主相关的配额信息中记录所述目标标识信息包括:11. The device according to claim 10, wherein the number of the access requests is multiple, and each of the applets requested by the access request is the target applet; when the target ID information of the target applet cannot be identified according to the first ID information, recording the target ID information in the quota information related to the target open source host includes:记录来自多个所述访问请求中的任意一个访问请求请求访问的目标小程序的目标标识信息。Recording the target identification information of the target applet that is requested to be accessed by any one of the multiple access requests.12.根据权利要求10所述的装置,其中,所述记录模块还包括:12. The device according to claim 10, wherein the recording module further comprises:更新单元,用于在满足更新条件的情况下,根据所述目标标识信息和所述第一标识信息更新所述目标开源宿主在与所述预设时长相对应的时间段内已访问的小程序的访问数目。An updating unit, configured to update the number of applets visited by the target open source host within a time period corresponding to the preset duration according to the target identification information and the first identification information when an update condition is met.13.根据权利要求9至12中任一所述的装置,其中,所述第三确定模块还包括:13. The device according to any one of claims 9 to 12, wherein the third determination module further comprises:第二确定单元,用于响应于目标访问数目,确定与所述目标访问数目相对应的目标预设时长,其中,所述目标访问数目等于与所述目标访问数目相对应的访问阈值;The second determining unit is configured to determine a target preset duration corresponding to the target number of visits in response to the target number of visits, wherein the target number of visits is equal to a visit threshold corresponding to the target number of visits;第三确定单元,用于确定在与所述目标预设时长相对应的时间段内已访问的小程序的第二标识信息;以及A third determining unit, configured to determine second identification information of applets that have been accessed within a time period corresponding to the target preset duration; and第四确定单元,用于根据所述第二标识信息和所述目标小程序的目标标识信息确定所述目标小程序的分发方式。A fourth determining unit, configured to determine the distribution mode of the target applet according to the second identification information and the target identification information of the target applet.14. 根据权利要求13所述的装置,其中,所述第四确定单元包括:14. The device according to claim 13, wherein the fourth determining unit comprises:分发子单元,用于在根据所述第二标识信息识别到所述目标标识信息的情况下,将所述目标小程序分发至所述目标开源宿主;以及A distribution subunit, configured to distribute the target applet to the target open source host when the target identification information is identified according to the second identification information; and中断子单元,用于在根据所述第二标识信息未能识别到所述目标标识信息的情况下,中断所述目标小程序向所述目标开源宿主的分发过程。The interruption subunit is configured to interrupt the distribution process of the target applet to the target open source host when the target identification information is not identified according to the second identification information.15.根据权利要求9所述的装置,还包括:15. The apparatus of claim 9, further comprising:第四确定模块,用于在监听到所述配额信息发生更新的情况下,根据更新后的配额信息确定针对所述开源宿主配置的配额信息。The fourth determination module is configured to determine the quota information configured for the open source host according to the updated quota information when it is detected that the quota information is updated.16. 根据权利要求9所述的装置,还包括:16. The apparatus of claim 9, further comprising:第一存储模块,用于在确定访问分布式存储空间成功的情况下,将针对各开源宿主配置的配额信息存储至所述分布式存储空间中;以及The first storage module is configured to store the quota information configured for each open source host in the distributed storage space when it is determined that the access to the distributed storage space is successful; and第二存储模块,用于在确定访问所述分布式存储空间失败的情况下,将针对所述各开源宿主配置的配额信息存储至与各所述开源宿主相关的内存空间中。The second storage module is configured to store the quota information configured for each open source host in a memory space related to each open source host when it is determined that the access to the distributed storage space fails.17. 一种电子设备,包括:17. An electronic device comprising:至少一个处理器;以及at least one processor; and与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-8中任一项所述的方法。The memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can perform the method of any one of claims 1-8.18.一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行根据权利要求1-8中任一项所述的方法。18. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
CN202110841089.4A2021-07-232021-07-23 Small program distribution control method, device, electronic device and storage mediumActiveCN113553074B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202110841089.4ACN113553074B (en)2021-07-232021-07-23 Small program distribution control method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202110841089.4ACN113553074B (en)2021-07-232021-07-23 Small program distribution control method, device, electronic device and storage medium

Publications (2)

Publication NumberPublication Date
CN113553074A CN113553074A (en)2021-10-26
CN113553074Btrue CN113553074B (en)2023-07-25

Family

ID=78132860

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202110841089.4AActiveCN113553074B (en)2021-07-232021-07-23 Small program distribution control method, device, electronic device and storage medium

Country Status (1)

CountryLink
CN (1)CN113553074B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114637568B (en)*2022-03-222024-06-04支付宝(杭州)信息技术有限公司Split-screen adaptive processing method and device for equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111475259A (en)*2020-04-022020-07-31北京百度网讯科技有限公司Applet loading method and device and electronic equipment
CN112000394A (en)*2020-08-272020-11-27北京百度网讯科技有限公司Method, apparatus, device and storage medium for accessing an applet
CN112579096A (en)*2020-12-182021-03-30北京百度网讯科技有限公司Method, device, equipment and medium for compiling and loading small program starting file

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8488476B2 (en)*2004-04-052013-07-16Verizon Business Global LlcProviding applets to remote devices in a communications network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111475259A (en)*2020-04-022020-07-31北京百度网讯科技有限公司Applet loading method and device and electronic equipment
CN112000394A (en)*2020-08-272020-11-27北京百度网讯科技有限公司Method, apparatus, device and storage medium for accessing an applet
CN112579096A (en)*2020-12-182021-03-30北京百度网讯科技有限公司Method, device, equipment and medium for compiling and loading small program starting file

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
面向核电分析软件耦合计算的实时数据库服务平台的设计与实现;刘硕;莫文涛;刘陆光;张蕊峰;肖爽;;计算机应用与软件(08);全文*

Also Published As

Publication numberPublication date
CN113553074A (en)2021-10-26

Similar Documents

PublicationPublication DateTitle
CN109684358B (en)Data query method and device
CN112000394B (en)Method, apparatus, device and storage medium for accessing applet
US12105735B2 (en)Asynchronous accounting method and apparatus for blockchain, medium and electronic device
CN111090691B (en) A data processing method, device, electronic device and storage medium
US10454855B2 (en)System and method for predicting availability status changes of instant messenger users
WO2020133995A1 (en)Copy deployment method, cloud server, and storage medium
CN114595481A (en) A method, apparatus, device and storage medium for processing response data
CN115168440A (en) Data reading and writing method, distributed storage system, device, equipment and storage medium
CN113014608A (en)Flow distribution control method and device, electronic equipment and storage medium
US10936192B2 (en)System and method for event driven storage management
CN113553074B (en) Small program distribution control method, device, electronic device and storage medium
US11243979B1 (en)Asynchronous propagation of database events
CN113986936B (en)Data processing method and device, electronic equipment and storage medium
Ravindra et al.Latency aware elastic switching-based stream processing over compressed data streams
CN114327918A (en)Method and device for adjusting resource amount, electronic equipment and storage medium
CN111078418B (en)Operation synchronization method, device, electronic equipment and computer readable storage medium
CN113360689A (en)Image retrieval system, method, related device and computer program product
CN114546705B (en) Operation response method, operation response device, electronic device, and storage medium
CN117667879A (en)Data access method and device, storage medium and electronic equipment
CN113676531B (en)E-commerce flow peak clipping method and device, electronic equipment and readable storage medium
CN114579265B (en) A task query method, device and storage medium
JP2023022843A (en) Failure information positioning method, device, equipment and storage medium
CN115495455A (en)Data processing method and device
CN115658290A (en) Message processing method, device, device and storage medium
CN114500443A (en) Message push method, apparatus, system, electronic device and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp