SSE-based bidding method, system and equipment
By adopting SSE-based bidding method in the auction system, using single-channel association and broadcast synchronization between the gateway and the server, the stability and efficiency of the auction system in high concurrency are solved, and the efficient transmission of real-time bid information is achieved. .
Patent Information
- Application Number
- CN202411020538.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-12-20
AI Technical Summary
As the scale of the Internet platform and the number of members grows, the auction system needs to process more data and requests, resulting in the server's operation ability being challenged. The traditional polling method is inefficient and complex, which can easily lead to server crashes.
The SSE-based bidding method is adopted to receive association and bid requests from member clients through the gateway, and after filtering, a single-channel association is established with the server. The server pushes bid information through broadcast, and uses RabbitMQ for real-time synchronization to avoid information out of synchronization.
It significantly improves system stability, improves the efficiency of server processing requests, reduces the complexity of clients and servers, and realizes efficient, reliable and secure transmission of bid information, meeting members' needs for real-time bid information.
Smart Images

Figure CN119168756A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of data processing technology and related technical fields, and in particular, to a bidding method, system and device based on SSE. Background Art
[0002] With the rapid development of the Internet, auctions are no longer limited to offline methods. More auction processes will be conducted through smart devices or PCs in the form of applications. Therefore, many auctions are held at the same time, and more members make operation requests. As the scale of the Internet platform and the number of members continue to expand, the stability of the system has been unprecedentedly tested. With the increase in the number of members, the system needs to process more data and requests, which puts higher requirements on the operating capacity of the server. If the system design is unreasonable or the carrying capacity is insufficient, it is easy for the server to crash. In addition, the traditional polling method currently using websocket is inefficient and has high complexity on the client and server. Summary of the invention
[0003] The embodiments described herein provide a bidding method, system and device based on SSE to solve the problems existing in the prior art.
[0004] According to a first aspect of the present disclosure, a bidding method based on SSE is provided, which is applied to a bidding system, wherein the bidding system includes a gateway and at least two servers, and the method includes:
[0005] The gateway receives the association request sent by the member client and filters it. After the request passes the filtering, the gateway establishes an association between the member client and one of the servers through the SSE single channel.
[0006] receiving the bid request sent by the member client and filtering it, and after passing the filtering, forwarding the bid request to the server associated with the member client;
[0007] The server receives the bid request through the gateway and generates bid information, and pushes the bid information to other servers through broadcasting;
[0008] The other servers receive the latest bidding information and push the latest bidding information to the member clients associated therewith through the SSE single channel.
[0009] In some embodiments of the present disclosure, the step of associating the member client with one of the servers through a single SSE channel includes:
[0010] The gateway assigns one of the servers to the member client, including: the gateway sends a query message to each of the servers to obtain information about the maximum number of member clients that can be associated with each server and information about the number of associated member clients; according to the information about the maximum number of member clients that can be associated with each server and the information about the number of associated member clients, the full load rate of each server is calculated, and the server with the smallest full load rate value is determined by comparison, and the server is assigned to the member client;
[0011] The member client is associated with the server through the SSE single channel.
[0012] In some embodiments of the present disclosure, it further includes:
[0013] The server presets the maximum number of associated member clients according to its own software and hardware resources;
[0014] The server stores the number of associated member clients;
[0015] After receiving the association request and / or bid request, the gateway parses it, extracts the member unique number information, member IP information and member connection status information, groups and stores them, and stores the uniform resource locator and request time.
[0016] In some embodiments of the present disclosure, the step of forwarding the bid request to the server associated with the client includes:
[0017] Pushing the bid requests to a preset buffer pool, sorting the bid requests according to the receiving time of the bid requests, and each server pulling the bid requests that need to be processed by the server from the buffer pool;
[0018] The unprocessed bid request is suspended and waits in the buffer pool. When the waiting time exceeds a preset threshold, the unprocessed bid request is removed from the buffer pool.
[0019] In some embodiments of the present disclosure, the step of filtering the association request by the gateway includes:
[0020] The gateway filters the association request sent by the member client according to the preset unit time and message quantity threshold, specifically including:
[0021] Determine whether the number of the association requests sent by the member client within a unit time is greater than the message number threshold;
[0022] If the number of the association requests sent by the member client within a unit time is greater than the message quantity threshold, the association request is intercepted;
[0023] If the number of the association requests sent by the member client within a unit time is less than the message quantity threshold, the filtering is passed.
[0024] In some embodiments of the present disclosure, the step of filtering the bid request by the gateway includes:
[0025] The gateway filters the bid request according to a preset unit time and message quantity threshold, specifically including:
[0026] Determining whether the number of the bid requests sent by the member client within a unit time is greater than the message number threshold;
[0027] If the number of the bid requests sent by the member client within a unit time is greater than the message quantity threshold, the bid request is intercepted;
[0028] If the number of the bid requests sent by the member client within a unit time is less than the message quantity threshold, the filtering is passed.
[0029] According to a second aspect of the present disclosure, a bidding system based on SSE is provided, including:
[0030] A gateway and at least two servers, each of the servers is communicatively connected to the gateway, and the gateway is communicatively connected to a plurality of member clients;
[0031] The gateway is used to receive an association request and / or a bid request sent by a member client, filter the association request and / or the bid request, and establish an association between the member client and the corresponding server after the association request passes the filtering, and forward the bid request to the server associated with the client after the bid request passes the filtering;
[0032] The server is used to receive the bid request and generate bid information through the gateway, push the bid information to other servers by broadcasting, receive the latest bid information, and push the latest bid information to the member client associated with it through the SSE single channel.
[0033] In some embodiments of the present disclosure, the gateway is also used to establish an association between the member client and the server through an SSE single channel.
[0034] In some embodiments of the present disclosure, the server is further used to preset the maximum number of member clients that can be associated according to its own software and hardware resources;
[0035] In some embodiments of the present disclosure, the service is further used to store the number of associated member clients.
[0036] In some embodiments of the present disclosure, the gateway is also used to parse the association request upon receipt, extract the member unique number information, member IP information and member connection status information, group and store them, and store the uniform resource locator and request time.
[0037] In some embodiments of the present disclosure, the gateway is further used to push the bid requests to a preset buffer pool, sort the bid requests according to the reception time of the bid requests, and each server retrieves the bid requests that need to be processed by the server from the buffer pool;
[0038] The unprocessed bid request is suspended and waits in the buffer pool. When the waiting time exceeds a preset threshold, the unprocessed bid request is removed from the buffer pool.
[0039] In some embodiments of the present disclosure, the server is also used to update local bidding data in real time after receiving the bidding information, and check whether there are any member clients associated with it. If there are any member clients associated with it, the bidding information will be pushed to these member clients in real time through the SSE single channel.
[0040] According to a third aspect of the present disclosure, a bidding method based on SSE is provided, which is applied to a gateway, and the method includes:
[0041] Receive association requests sent by member clients;
[0042] Filtering the association request;
[0043] After the filtering is passed, the member client is associated with a server through a single SSE channel;
[0044] Receiving a bid request sent by the member client;
[0045] Filtering the bid request;
[0046] After passing the filtering, the bid request is forwarded to the server that has established an association with the member client.
[0047] According to a fourth aspect of the present disclosure, a gateway is provided, including:
[0048] A first receiving module, used to receive an association request and / or a bid request sent by a member client;
[0049] A filtering module, used for filtering the association request and / or the bid request;
[0050] An association establishment module, used to establish an association between the member client and a server through an SSE single channel after the association request is filtered and passed;
[0051] The first sending module is used to forward the bidding request to the server associated with the member client after filtering the bidding request.
[0052] According to a fifth aspect of the present disclosure, a bidding method based on SSE is provided, which is applied to a server, and the method includes:
[0053] Applied to a server, the method comprises:
[0054] receiving a bid request through a gateway and generating bid information;
[0055] Pushing the bidding information to other servers by broadcasting;
[0056] The other servers receive the latest bidding information;
[0057] The latest bidding information is pushed to the member client associated with it through the SSE single channel.
[0058] According to a sixth aspect of the present disclosure, a server is provided, including:
[0059] A second receiving module, configured to receive a bid request through the gateway and generate bid information;
[0060] A second sending module, used for pushing the bidding information to other servers by broadcasting;
[0061] A third receiving module, used for receiving the latest bidding information;
[0062] The third sending module is used to push the latest bidding information to the member client associated with it through the SSE single channel.
[0063] The bidding method, system and device based on SSE provided by the embodiment of the present disclosure first receive the association request sent by the member client and filter it. After filtering, the member client is associated with a server through the SSE single channel; then the bid request sent by the member client is received and filtered. After filtering, the bid request is forwarded to the server with which the member client has established an association; then the server receives the bid request through the gateway and generates bid information, and pushes the bid information to other servers by broadcasting; finally, other servers receive the latest bid information and push the latest bid information to the member client associated with it through the SSE single channel. Filtering through the gateway significantly improves the stability of the system, enabling the server to efficiently process more business requests. In terms of auction page message transmission, Server-sent events are used as a single communication channel, and the server directly pushes information to the client. This method avoids the waste of resources caused by traditional polling. Compared with websocket, it not only improves efficiency, but also reduces the complexity of using the client and server. In order to synchronize the bidding information to each relevant server in real time, RabbitMQ is used for broadcast notification to ensure that it does not exist only in one server, thus avoiding program anomalies caused by information asynchrony. The concurrent processing capacity of the server is pre-set to ensure that the number of request processing can be executed stably, thereby achieving efficient, reliable and secure transmission of bidding information, fully meeting the members' needs for real-time bidding information.
[0064] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein:
[0066] Figure 1 is a flowchart of a bidding method based on SSE provided in an embodiment of the present disclosure;
[0067] Figure 2 is a schematic diagram of a process of filtering the bid request by the gateway provided in an embodiment of the present disclosure;
[0068] Figure 3 It is a schematic diagram of a structure for caching bid requests provided by an embodiment of the present disclosure;
[0069] Figure 4 It is a structural diagram of a bidding system based on SSE provided in an embodiment of the present disclosure;
[0070] Figure 5 is a flowchart of a bidding method based on SSE provided in an embodiment of the present disclosure;
[0071] Figure 6 is a schematic diagram of the structure of a gateway provided by an embodiment of the present disclosure;
[0072] Figure 7 is a flowchart of a bidding method based on SSE provided in an embodiment of the present disclosure;
[0073] Figure 8 is a structural diagram of a server provided by an embodiment of the present disclosure;
[0074] Fig. 9 It is a flowchart of a specific example of SSE-based bidding provided by an embodiment of the present disclosure;
[0075] Fig.10 It is a structural diagram of a computer device provided in an embodiment of the present disclosure.
[0076] In the drawings, reference numerals with the same last two digits correspond to the same elements. It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0077] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.
[0078] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0079] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0080] Furthermore, in all embodiments of the present disclosure, terms such as “first” and “second” are used only to distinguish one component (or a part of a component) from another component (or another part of a component).
[0081] In the description of the present application, unless otherwise specified, "plurality" means more than two (including two), and similarly, "multiple groups" means more than two groups (including two).
[0082] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0083] Some technical terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0084] SSE (Server-Sent Events): is a technology based on HTTP that continuously sends data from the server to the client in the form of a stream. It can establish a single-channel persistent connection between the member client and the server, allowing the server to push real-time updated data to the member client.
[0085] MQ (Message Queue), or message queue, is an application-to-application communication method. Applications communicate by reading and writing messages (data for the applications) to and from queues, without the need for dedicated connections to link them. Messaging refers to programs communicating by sending data in messages, rather than by calling each other directly, which is usually used for technologies such as remote procedure calls. Queuing refers to applications communicating through queues. The use of queues removes the requirement for the receiving and sending applications to execute at the same time.
[0086] RabbitMQ is a message queue implemented based on AMQP (Advanced Message Queue). It is a communication method between applications and is widely used in distributed systems.
[0087] As the number of members grows, the system needs to process more data and requests sent by member clients, which puts higher requirements on the server's operating capacity. If the system design is unreasonable or the carrying capacity is insufficient, it is easy for the server to crash. In addition, the traditional polling method using websocket is inefficient and has high complexity on each end. Therefore, how to provide an efficient and reliable bidding system based on SSE is an urgent problem to be solved.
[0088] In view of this, in order to solve the above technical problems, the present application provides a bidding method based on SSE, which is applied to a bidding system, wherein the bidding system includes a gateway and multiple servers, and the method includes: the gateway receives the association request sent by the member client and filters it, and after filtering, the member client is associated with a server through an SSE single channel; the bid request sent by the member client is received and filtered, and after filtering, the bid request is forwarded to the server with which the member client has been associated; the server receives the bid request through the gateway and generates bid information, and pushes the bid information to other servers by broadcasting; other servers receive the latest bid information, and push the latest bid information to the member client associated with it through the SSE single channel. Through the above method, the stability of the system is significantly improved, so that the server can efficiently process more business requests. Not only the efficiency is improved, but also the complexity of use of the client and the server is reduced. Program exceptions caused by information asynchrony are avoided. Ensure that the number of request processing can be stably executed, thereby achieving efficient, reliable and secure transmission of bid information, and fully meeting the members' needs for real-time bidding information.
[0089] It should be noted that the preferred embodiments of the present application are described below in conjunction with the drawings in the specification. The preferred embodiments described herein are only used to illustrate and explain the present application and are not used to limit the present application. In the absence of conflict,
[0090] The embodiments of the present application and the features in the embodiments may be combined with each other.
[0091] Embodiment 1
[0092] An SSE-based bidding method provided in an embodiment of the present disclosure is applied to a bidding system, wherein the bidding system includes a gateway and at least two distributed servers, each of which is communicatively connected to the gateway, and the gateway is communicatively connected to multiple member clients; through multiple distributed servers, it is ensured that more member client requests can be processed in parallel, thereby improving data processing efficiency.
[0093] Figure 1 is a flowchart of a bidding method based on SSE provided in an embodiment of the present disclosure, such as Figure 1 As shown, the method specifically includes:
[0094] Step S110: The gateway receives the association request sent by the member client and filters it. After the request passes the filtering, the gateway establishes an association between the member client and one of the servers through the SSE single channel.
[0095] In a specific implementation, there are multiple member clients, and the member client sends an association request to the gateway, and the association request includes member unique number information, member IP information, member connection status information and possible other parameters or data. The request will be encoded into a network protocol format (such as HTTP, HTTPS, Websocket, etc.) and sent to the gateway through the network.
[0096] In this implementation, the gateway parses the association request after receiving it, extracts the member unique number information, member IP information and member connection status information, groups and stores them, and stores the uniform resource locator and request time.
[0097] The gateway is used to process and filter association requests from member clients and establish associations with corresponding servers.
[0098] In a specific implementation manner, as another example, Figure 2 As shown, the step of filtering the association request by the gateway includes:
[0099] The gateway filters the association request sent by the member client according to a preset unit time period and message quantity threshold, specifically including:
[0100] Determining whether the number of the association requests sent by the member client within a unit time period is greater than the message number threshold;
[0101] If the number of the association requests sent by the member client within a unit time period is greater than the message quantity threshold, the association request is intercepted;
[0102] If the number of the association requests sent by the member client within a unit time period is less than the message quantity threshold, the filtering is passed.
[0103] The embodiments of the present disclosure implement a request forwarding and current limiting protection mechanism by setting a gateway. An appropriate unit time period and request threshold are set. When a single member client reaches the request threshold within a unit time period, the gateway will intercept subsequent requests to prevent them from being further forwarded to the server, so as to avoid excessive server load due to too many requests, thereby effectively avoiding server crashes due to various adverse factors. This mechanism ensures the stability and reliability of the server. The request forwarding and current limiting protection process is implemented through the gateway, and the requests of a single client are monitored and limited within a unit time period, thereby significantly improving the stability of the system and enabling the server to efficiently process more business requests.
[0104] In a specific implementation, as another embodiment, the step of establishing a single channel association between the member client and the server to be associated includes:
[0105] Step 1, the gateway assigns a server to the member client, specifically including:
[0106] The gateway obtains information about the maximum number of member clients that can be associated with each server and information about the number of associated member clients by sending a query message to each server; calculates the full load rate of each server according to the information about the maximum number of member clients that can be associated with each server and the information about the number of associated member clients, determines the server with the smallest full load rate value by comparison, and allocates the server to the member client, wherein the full load rate is the ratio of the number of member clients that have been associated with the server to the maximum number of member clients that can be associated;
[0107] Step 2: Establish an association between the member client and the server through the SSE single channel.
[0108] In some embodiments, the server may establish an association with one or more of the member clients via a single SSE channel.
[0109] Specifically, the SSE single channel is implemented by Server-sent events technology to complete the downlink connection from the server to the member, which is used for the server to push messages to the member client.
[0110] In this implementation, the server stores the number of associated member clients.
[0111] SSE is used as a single communication channel, and the server directly pushes the bidding information to the client. This method avoids the waste of resources caused by traditional polling. Compared with websocket, it not only improves efficiency, but also reduces the complexity of using the client and server. By pushing information from the server to the member client through the SSE single channel, members can obtain the latest bidding information in real time without frequently polling the server, fully meeting the members' needs for real-time bidding information. This method can effectively reduce resource consumption and improve efficiency compared to the WebSocket polling server method. In addition, SSE is a general protocol based on the HTTP protocol and does not require additional development, while WebSocket requires each end to implement its own WebSocket protocol, which reduces the complexity of using each end compared to WebSocket.
[0112] In addition, before implementing step 1, the server may also preset the maximum number of associated member clients according to its own software and hardware resources.
[0113] Step S120: The gateway receives the bid request sent by the member client and filters it. After the bid request passes the filtering, the gateway forwards the bid request to the server associated with the member client.
[0114] When the auction starts, members bid according to their preferences, budgets, and market conditions. The member client sends a bid request to the gateway, which is used to provide the system with bid information corresponding to the item being auctioned. The bid information may include one or more of the following parameters: item information, bid price, bid time, member ID, and possible other parameters or data. The request will be encoded into a network protocol format (such as HTTP, HTTPS, Websocket, etc.) and sent to the gateway via the network.
[0115] In a specific implementation manner, as another example, Figure 3 As shown, the step of filtering the bid request by the gateway includes:
[0116] The gateway filters the bid request according to a preset unit time period and message quantity threshold, specifically including:
[0117] Determining whether the number of the bid requests sent by the member client within a unit time period is greater than the message number threshold;
[0118] If the number of the bid requests sent by the member client within a unit time period is greater than the message quantity threshold, the bid request is intercepted;
[0119] If the number of the bid requests sent by the member client within a unit time period is less than the message quantity threshold, the filtering is passed.
[0120] In a distributed service architecture, in order to effectively manage a large number of requests and optimize the processing flow, a buffer pool is usually used to sort and distribute requests. The buffer pool can not only sort the requests according to the time they are received to ensure that the requests can be processed in a first-in-first-out order, but also help the server to balance the load between different servers.
[0121] In a specific implementation manner, as another embodiment, the step of forwarding the bid request to the server associated with the client includes: caching the bid request, such as Figure 3 As shown,
[0122] Pushing the bid requests to a preset buffer pool, sorting the bid requests according to the receiving time of the bid requests, and each server pulling the bid requests that need to be processed by the server from the buffer pool;
[0123] Specifically, the bid request is pushed to a preset buffer pool, and the bid request is sorted according to the receiving time of the bid request. This sorting is performed according to the first-in-first-out principle, that is, the first request is placed in the front of the queue, and the later request is placed in the back of the queue. In a distributed system, there may be multiple servers available to process requests. In order to balance the load and ensure that each server is fully utilized, the system will use a unified load balancing mechanism to flush the buffer pool to pick up the requests that need to be processed.
[0124] Among them, if the number of requests far exceeds the processing capacity of the application server, the unprocessed bid requests will be suspended and wait in the buffer pool. When the waiting time exceeds a preset threshold, the unprocessed bid requests will be removed from the buffer pool and will no longer be queued. This can ensure that the server runs efficiently and stably within the processing capacity range, avoiding server operation crashes due to a large number of requests coming in.
[0125] Step S130: The server receives the bid request through the gateway and generates bid information, and pushes the bid information to other servers by broadcasting.
[0126] Specifically, the server receives the bid request sent by the member client through the gateway. The gateway, as a communication hub, is responsible for forwarding the bid request to the corresponding server. After receiving the bid request, the server generates bid information, and the bid information includes one or more of the following parameters: product information, bid price, bid time and member ID;
[0127] In some embodiments, after obtaining the bidding information, the server stores the bidding information in a local buffer or a distributed cache to improve the efficiency and response speed of subsequent processing.
[0128] Based on distributed applications, each business service application is independent of each other, and the SSE single channel established by each member may be distributed on different servers. The bidding message is broadcasted through the message queue, triggering the server to push the bidding message to the SSE single channel of the member who should receive the bidding message.
[0129] In a specific implementation, as another embodiment, a mechanism such as RabbitMQ message queue or event bus can be used to broadcast the bidding information to push the bidding information to other related servers to achieve real-time synchronization of each related server and rapid transmission and distribution of information. This can avoid the situation where the information only exists in one server, resulting in information asynchrony and thus causing program abnormalities. The concurrent processing capacity of the server is pre-set to ensure that the number of request processing can be executed stably. If there is no corresponding protection mechanism, the server may fall into a crash state due to the inability to handle a large number of requests and cannot operate normally.
[0130] Step S140, the other servers receive the latest bidding information, and push the latest bidding information to the member clients associated therewith through the SSE single channel;
[0131] In some embodiments, optionally, after receiving the bid information, any other server will update the local bidding data in real time, and check whether there is a member client associated with it. If there is a member client associated with it, the bid information will be pushed to the member client associated with it in real time through the SSE single channel. In terms of auction page message transmission, SSE is used as a single communication channel, and the server directly pushes the bid information to the client. This method avoids the waste of resources caused by traditional polling. Compared with websocket, it not only improves efficiency, but also reduces the complexity of use of the client and server. By pushing information from the server to the member client through the SSE single channel, members can obtain the latest bidding information in real time without frequently polling the server, fully meeting the members' needs for real-time bidding information. This method can effectively reduce resource consumption, and at the same time improve efficiency relative to the WebSocket polling server method. In addition, SSE is a general protocol based on the HTTP protocol, without the need for additional development, while WebSocket requires each end to implement its own WebSocket protocol, which reduces the complexity of use of each end relative to WebSocket. Efficient, reliable and secure transmission of bidding information is achieved to meet the members' needs for real-time bidding information.
[0132] Embodiment 2
[0133] Based on the above embodiments, the present disclosure also provides a bidding system 400 based on SSE. Figure 4 The system comprises: a gateway 410 and at least two server groups 420, each of the servers is connected in communication with the gateway 410, and the gateway 410 is connected in communication with a plurality of member clients.
[0134] The gateway 410 is used to receive the association request and / or the bid request sent by the member client, filter the association request and / or the bid request, and establish an association between the member client and the corresponding server 420 after the association request passes the filtering, and forward the bid request to the server 420 associated with the client after the bid request passes the filtering;
[0135] The server 420 is used to receive the bid request and generate bid information through the gateway 410, push the bid information to other servers 420 by broadcasting, receive the latest bid information, and push the latest bid information to the member client associated with it through the SSE single channel.
[0136] In some embodiments, optionally, among the multiple servers 420, one server 420 may establish an association with one or more member clients.
[0137] In some embodiments, optionally, the gateway 410 is further configured to filter the association request sent by the member client according to a preset unit time period and message quantity threshold, and determine whether the number of the association request sent by the member client in the unit time period is greater than the message quantity threshold;
[0138] If the number of the association requests sent by the member client within a unit time period is greater than the message quantity threshold, the association request is intercepted;
[0139] If the number of the association requests sent by the member client within a unit time period is less than the message quantity threshold, the filtering is passed.
[0140] In some embodiments, optionally, the step of filtering the bid request by the gateway 410 includes:
[0141] The gateway 410 determines whether the number of the bid requests sent by the member client within the unit time period is greater than the message number threshold through the preset unit time period and message number threshold;
[0142] If the number of the bid requests sent by the member client within a unit time period is greater than the message quantity threshold, the bid request is intercepted;
[0143] If the number of the bid requests sent by the member client within a unit time period is less than the message quantity threshold, the filtering is passed.
[0144] In some embodiments, optionally, the gateway 410 is specifically used to assign the member client to one of the servers 420, including: by sending a query message to each of the servers 420, obtaining information about the maximum number of member clients that can be associated with each of the servers 420, and information about the number of associated member clients; according to the information about the maximum number of member clients that can be associated with each of the servers 420 and the information about the number of associated member clients, calculating the full load rate of each of the servers 420, determining the server 420 with the smallest full load rate value by comparison, and assigning the member client to the server 420;
[0145] The gateway 410 is also used to establish an association between the member client and the server 420 via a single SSE channel.
[0146] In some embodiments, optionally, the server 420 is further configured to preset the maximum number of associated member clients according to its own software and hardware resources;
[0147] In some embodiments, optionally, the server 420 is also used to store the number of associated member clients.
[0148] In some embodiments, optionally, the gateway 410 is also used to parse the association request upon receipt, extract member unique number information, member IP information and member connection status information, group and store them, and store the uniform resource locator and request time.
[0149] In some embodiments, optionally, the gateway 410 is further configured to push the bid requests to a preset buffer pool, sort the bid requests according to the receiving time of the bid requests, and each server 420 retrieves the bid requests that need to be processed by the server 420 from the buffer pool;
[0150] The unprocessed bid request is suspended and waits in the buffer pool. When the waiting time exceeds a preset threshold, the unprocessed bid request is removed from the buffer pool.
[0151] In some embodiments, optionally, the server 420 is also used to update the local bidding data in real time after receiving the bidding information, and check whether there are any member clients associated with it. If there are any member clients associated with it, the bidding information will be pushed to these member clients in real time through the SSE single channel.
[0152] The system provided by the embodiment of the present disclosure significantly improves the stability of the system, enabling the server to efficiently process more business requests. This not only improves efficiency, but also reduces the complexity of using the client and server. Program exceptions caused by information asynchrony are avoided. This ensures that the number of request processing can be executed stably, thereby achieving efficient, reliable and secure transmission of bidding information, and fully meeting the members' needs for real-time bidding information.
[0153] Embodiment 3
[0154] The present disclosure also provides a bidding method based on SSE. Figure 5 As shown, applied to a gateway, the method includes:
[0155] Step S510, receiving an association request sent by a member client;
[0156] Step S520, filtering the association request;
[0157] Step S530, after the filtering is passed, the member client is associated with a server through a single SSE channel;
[0158] Step S540, receiving a bid request sent by the member client;
[0159] Step S550, filtering the bid request;
[0160] Step S560: after the filtering is passed, the bid request is forwarded to the server associated with the member client.
[0161] In some embodiments, the step of associating the member client with one of the servers via a single SSE channel includes:
[0162] The gateway assigns the member client to one of the servers, including: the gateway sends a query message to each of the servers to obtain information about the maximum number of member clients that can be associated with each server and information about the number of associated member clients; according to the information about the maximum number of member clients that can be associated with each server and the information about the number of associated member clients, the full load rate of each server is calculated, and the server with the smallest full load rate value is determined by comparison, and the server is assigned to the member client;
[0163] The member client is associated with the server through the SSE single channel.
[0164] In some embodiments, after receiving the association request and / or bid request, the gateway parses it, extracts the member unique number information, member IP information and member connection status information, groups and stores them, and stores the uniform resource locator and request time.
[0165] In some embodiments, the step of forwarding the bid request to the server associated with the client includes:
[0166] Pushing the bid requests to a preset buffer pool, sorting the bid requests according to the receiving time of the bid requests, and each server pulling the bid requests that need to be processed by the server from the buffer pool;
[0167] The unprocessed bid request is suspended and waits in the buffer pool. When the waiting time exceeds a preset threshold, the unprocessed bid request is removed from the buffer pool.
[0168] In some embodiments, the step of filtering the association request by the gateway includes:
[0169] The gateway filters the association request sent by the member client according to the preset unit time and message quantity threshold, specifically including:
[0170] Determine whether the number of the association requests sent by the member client within a unit time is greater than the message number threshold;
[0171] If the number of the association requests sent by the member client within a unit time is greater than the message quantity threshold, the association request is intercepted;
[0172] If the number of the association requests sent by the member client within a unit time is less than the message quantity threshold, the filtering is passed.
[0173] In some embodiments, the step of filtering the bid request by the gateway includes:
[0174] The gateway filters the bid request according to a preset unit time and message quantity threshold, specifically including:
[0175] Determining whether the number of the bid requests sent by the member client within a unit time is greater than the message number threshold;
[0176] If the number of the bid requests sent by the member client within a unit time is greater than the message quantity threshold, the bid request is intercepted;
[0177] If the number of the bid requests sent by the member client within a unit time is less than the message quantity threshold, the filtering is passed.
[0178] Embodiment 4
[0179] The present application embodiment also provides a gateway, such as Figure 6 As shown, the gateway includes:
[0180] The first receiving module 610 is used to receive an association request and / or a bid request sent by a member client;
[0181] A filtering module 620, configured to filter the association request and / or the bid request;
[0182] The association establishment module 630 is used to establish an association between the member client and a server through an SSE single channel after the association request is filtered and passed;
[0183] The first sending module 640 is used to forward the bidding request to the server associated with the member client after filtering the bidding request.
[0184] In some embodiments, optionally, the filtering module 620 is used to filter the association request sent by the member client according to a preset unit time period and message quantity threshold, and determine whether the number of the association request sent by the member client in the unit time period is greater than the message quantity threshold;
[0185] If the number of the association requests sent by the member client within a unit time period is greater than the message quantity threshold, the association request is intercepted;
[0186] If the number of the association requests sent by the member client within a unit time period is less than the message quantity threshold, the filtering is passed.
[0187] In some embodiments, optionally, the filtering module 620 is used to determine whether the number of the bid requests sent by the member client within the unit time period is greater than the message number threshold according to a preset unit time period and message number threshold;
[0188] If the number of the bid requests sent by the member client within a unit time period is greater than the message quantity threshold, the bid request is intercepted;
[0189] If the number of the bid requests sent by the member client within a unit time period is less than the message quantity threshold, the filtering is passed.
[0190] In some embodiments, optionally, the association establishment module 630 is used to assign the member client to one of the servers, including: obtaining information about the maximum number of member clients that can be associated with each server and information about the number of associated member clients by sending a query message to each server; calculating the full load rate of each server according to the preset information about the maximum number of member clients that can be associated with each server and the information about the number of associated member clients, that is, the number of member clients that have been associated with the server divided by the maximum number of member clients that can be associated, and assigning the member client to the server with the smallest full load rate value obtained by comparison;
[0191] The association establishing module 630 is also used to establish an association between the member client and the server via the SSE single channel.
[0192] In some embodiments, optionally, the first receiving module 610 is also used to parse the association request upon receipt, extract member unique number information, member IP information and member connection status information, group and store them, and store the uniform resource locator and request time.
[0193] In some embodiments, a buffer module 650 is further included, which is used to push the bid requests to a preset buffer pool, sort the bid requests according to the receiving time of the bid requests, and each server retrieves the bid requests that need to be processed by the server from the buffer pool;
[0194] The unprocessed bid request is suspended and waits in the buffer pool. When the waiting time exceeds a preset threshold, the unprocessed bid request is removed from the buffer pool.
[0195] Embodiment 5
[0196] The disclosed embodiment also provides a bidding method based on SSE, which is applied to a server, such as Figure 7 As shown, the method includes:
[0197] Step S710, receiving a bid request through a gateway and generating bid information;
[0198] Step S720, pushing the bidding information to other servers by broadcasting;
[0199] Step S730, the other servers receive the latest bidding information;
[0200] Step S740: Push the latest bidding information to the member client associated with it through the SSE single channel.
[0201] In some embodiments, the maximum number of member clients that can be associated is preset according to the software and hardware resources of the client;
[0202] In some embodiments, the number of associated member clients is stored;
[0203] In some embodiments, after receiving the bid information, the local bidding data will be updated in real time, and a check will be made to see if there are any member clients associated with it. If there are any member clients associated with it, the bid information will be pushed to these member clients in real time through the SSE single channel.
[0204] Embodiment 6
[0205] The present application also provides a server, such as Figure 8 As shown, the server includes:
[0206] A second receiving module 810, configured to receive a bid request through the gateway and generate bid information;
[0207] A second sending module 820, configured to push the bidding information to other servers by broadcasting;
[0208] A third receiving module 830 is used to receive the latest bidding information;
[0209] The third sending module 840 is used to push the latest bidding information to the member client associated with it through the SSE single channel.
[0210] In some embodiments, a preset module 850 is also included for presetting the maximum number of associated member clients according to its own software and hardware resources;
[0211] In some embodiments, a storage module 860 is further included to store the number of associated member clients.
[0212] In some embodiments, the third sending module 840 is also used to update the local bidding data in real time after receiving the bidding information, and check whether there are any member clients associated with it. If there are any member clients associated with it, the bidding information will be pushed to these member clients in real time through the SSE single channel.
[0213] Embodiment 7
[0214] The following is an example of a specific bidding process based on SSE.
[0215] The process is applied to a bidding system based on SSE, wherein the bidding system based on SSE includes an end gateway and three servers: a first server, a second server and a third server; Fig. 9 As shown, the process includes the following steps:
[0216] Step 1: The gateway receives a first association request sent by member client A;
[0217] Step 2: The gateway filters the first association request, and after the request passes the filtering, establishes an association between the member client A and the second server through the SSE single channel;
[0218] Step 3: The gateway receives a second association request sent by member client B;
[0219] Step 4: The gateway filters the second association request, and after the second association request passes the filtering, the gateway establishes an association between the member client B and the third server through the SSE single channel;
[0220] Step 5: The gateway receives the first bid request sent by member client A;
[0221] Step 6: The gateway filters the bid request, and after the bid request passes the filtering, forwards the first bid request to the second server that has established an association with the member client A;
[0222] Step 7: The second server receives the first bidding request sent by the member client A through the gateway, generates bidding information, and sends the bidding information to the RabbitMQ queue;
[0223] Step 8: The RabbitMQ queue broadcasts the bid information to the first server and the third server respectively;
[0224] Step 9: The third server receives the bid information, updates the local bidding data in real time, checks and confirms that there is a member client B associated with the third server, and pushes the bidding information to the member client B associated with the third server in real time through the SSE single channel.
[0225] Thus, member client B can receive the bidding information sent by member client A in real time through the SSE single channel.
[0226] The present application also provides a computer device. Fig.10 , Fig.10 This is a basic structural block diagram of the computer device in this embodiment.
[0227] The computer device includes a memory 1010 and a processor 1020 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with components 1010-1020, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0228] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.
[0229] The memory 1010 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 1010 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 1010 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, or a flash card (Flash Card) equipped on the computer device. Of course, the memory 1010 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 1010 is generally used to store an operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 1010 may also be used to temporarily store various data that have been output or are to be output.
[0230] The processor 1020 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 1010 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 1020 is used to execute the program codes or instructions stored in the memory 1010 or process data, such as running the program code of the above method.
[0231] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0232] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.
[0233] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.
[0234] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.
[0235] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0236] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0237] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0238] Unless the context clearly indicates otherwise, the singular form of the words used herein and in the appended claims includes the plural and vice versa. Thus, when referring to the singular, the plural form of the corresponding term is generally included. Similarly, the words "comprise" and "include" are to be interpreted as inclusive rather than exclusive. Likewise, the terms "include" and "or" should be interpreted as inclusive unless such interpretation is expressly prohibited herein. Where the term "example" is used herein, particularly when it is located after a group of terms, the "example" is merely exemplary and illustrative and should not be considered exclusive or comprehensive.
[0239] Further aspects and scopes of adaptability become apparent from the description provided herein. It should be understood that various aspects of the present application can be implemented individually or in combination with one or more other aspects. It should also be understood that the description and specific embodiments herein are intended for purposes of illustration only and are not intended to limit the scope of the present application.
[0240] Several embodiments of the present disclosure are described in detail above, but it is obvious that those skilled in the art can make various modifications and variations to the embodiments of the present disclosure without departing from the spirit and scope of the present disclosure. The protection scope of the present disclosure is defined by the attached claims.
Claims
1. A bidding method based on SSE, characterized in that: Applied to a bidding system, the bidding system includes a gateway and at least two servers, and the method includes: The gateway receives the association request sent by the member client and filters it. After the request passes the filtering, the gateway establishes an association between the member client and one of the servers through the SSE single channel. receiving the bid request sent by the member client and filtering it, and after passing the filtering, forwarding the bid request to the server associated with the member client; The server receives the bid request through the gateway and generates bid information, and pushes the bid information to other servers through broadcasting; The other servers receive the latest bidding information and push the latest bidding information to the member clients associated therewith through the SSE single channel.
2. The method according to claim 1, characterized in that The step of establishing association between the member client and the server through the SSE single channel includes: The gateway assigns one of the servers to the member client, including: the gateway sends a query message to each of the servers to obtain information about the maximum number of member clients that can be associated with each server and information about the number of associated member clients; according to the information about the maximum number of member clients that can be associated with each server and the information about the number of associated member clients, the full load rate of each server is calculated, and the server with the smallest full load rate value is determined by comparison, and the server is assigned to the member client; The member client is associated with the server through the SSE single channel.
3. The method according to claim 2, characterized in that Also includes: The server presets the maximum number of associated member clients according to its own software and hardware resources; The server stores the number of associated member clients; After receiving the association request and / or bid request, the gateway parses it, extracts the member unique number information, member IP information and member connection status information, groups and stores them, and stores the uniform resource locator and request time.
4. The method according to claim 1, characterized in that: The step of forwarding the bid request to the server associated with the client comprises: Pushing the bid requests to a preset buffer pool, sorting the bid requests according to the receiving time of the bid requests, and each server pulling the bid requests that need to be processed by the server from the buffer pool; The unprocessed bid request is suspended and waited in the buffer pool. When the waiting time exceeds a preset threshold, the unprocessed bid request is removed from the buffer pool.
5. The method according to claim 1, characterized in that The step of filtering the association request by the gateway comprises: The gateway filters the association request sent by the member client according to the preset unit time and message quantity threshold, specifically including: Determine whether the number of the association requests sent by the member client within a unit time is greater than the message number threshold; If the number of the association requests sent by the member client within a unit time is greater than the message quantity threshold, the association request is intercepted; If the number of the association requests sent by the member client within a unit time is less than the message quantity threshold, the filtering is passed. The step of filtering the bid request by the gateway comprises: The gateway filters the bid request according to a preset unit time and message quantity threshold, specifically including: Determining whether the number of the bid requests sent by the member client within a unit time is greater than the message number threshold; If the number of the bid requests sent by the member client within a unit time is greater than the message quantity threshold, the bid request is intercepted; If the number of the bid requests sent by the member client within a unit time is less than the message quantity threshold, the filtering is passed.
6. A bidding system based on SSE, characterized in that: include: A gateway and at least two servers, each of the servers is communicatively connected to the gateway, and the gateway is communicatively connected to a plurality of member clients; The gateway is used to receive an association request and / or a bid request sent by a member client, filter the association request and / or the bid request, and establish an association between the member client and the corresponding server after the association request passes the filtering, and forward the bid request to the server associated with the client after the bid request passes the filtering; The server is used to receive the bid request and generate bid information through the gateway, push the bid information to other servers by broadcasting, receive the latest bid information, and push the latest bid information to the member client associated with it through the SSE single channel.
7. A bidding method based on SSE, characterized in that: Applied to a gateway, the method comprises: Receive association requests sent by member clients; Filtering the association request; After the filtering is passed, the member client is associated with a server through a single SSE channel; Receiving a bid request sent by the member client; Filtering the bid request; After passing the filtering, the bid request is forwarded to the server that has established an association with the member client.
8. A gateway, characterized in that: include: A first receiving module, used to receive an association request and / or a bid request sent by a member client; A filtering module, used for filtering the association request and / or the bid request; An association establishment module, used to establish an association between the member client and a server through an SSE single channel after the association request is filtered and passed; The first sending module is used to forward the bidding request to the server associated with the member client after filtering the bidding request.
9. A bidding method based on SSE, applied to a server, characterized in that: The method comprises: receiving a bid request through a gateway and generating bid information; Pushing the bidding information to other servers by broadcasting; The other servers receive the latest bidding information; The latest bidding information is pushed to the member client associated with it through the SSE single channel.
10. A server, characterized in that: include: A second receiving module, configured to receive a bid request through the gateway and generate bid information; A second sending module, used for pushing the bidding information to other servers by broadcasting; A third receiving module, used for receiving the latest bidding information; The third sending module is used to push the latest bidding information to the member client associated with it through the SSE single channel.
