CN113762857A - Inventory deduction method, device, equipment and storage medium - Google Patents

Inventory deduction method, device, equipment and storage medium Download PDF

Info

Publication number
CN113762857A
CN113762857A CN202011330954.0A CN202011330954A CN113762857A CN 113762857 A CN113762857 A CN 113762857A CN 202011330954 A CN202011330954 A CN 202011330954A CN 113762857 A CN113762857 A CN 113762857A
Authority
CN
China
Prior art keywords
deduction
target
request
user request
server
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.)
Pending
Application number
CN202011330954.0A
Other languages
Chinese (zh)
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 Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011330954.0A priority Critical patent/CN113762857A/en
Publication of CN113762857A publication Critical patent/CN113762857A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/08Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
    • G06Q10/087Inventory or stock management, e.g. order filling, procurement or balancing against orders
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06MCOUNTING MECHANISMS; COUNTING OF OBJECTS NOT OTHERWISE PROVIDED FOR
    • G06M1/00Design features of general application
    • G06M1/27Design features of general application for representing the result of count in the form of electric signals, e.g. by sensing markings on the counter drum
    • G06M1/272Design features of general application for representing the result of count in the form of electric signals, e.g. by sensing markings on the counter drum using photoelectric means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for reducing inventory deduction, wherein the method comprises the following steps: acquiring a target article identifier associated with a user request, and determining a deduction server cluster associated with the target article identifier; according to the user identification, distributing the user request to a target deduction server in the deduction server cluster based on a preset non-encrypted Hash algorithm, so that the target deduction server deducts the stock information of the target deduction server according to the user request; and generating request feedback information according to the deduction response information of the target deduction server to respond. The method provided by the embodiment of the invention distributes the user request to the target deduction server in the deduction server cluster to respond the user request based on the non-encryption Hash algorithm, thereby improving the processing efficiency of the user request.

Description

Inventory deduction method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a stock deduction method, a device, equipment and a storage medium.
Background
With the rapid development of the internet, the life style of people also changes, and online shopping, online ticket booking, online games, online videos, online social contacts and the like have penetrated into the daily life of people. The rapid exponential growth of internet users brings a severe challenge to operators, and the rapid growth of high concurrent transaction requests causes system breakdown of applications due to the inability of applications to support high concurrent transaction capabilities. Taking hot spot goods in the e-commerce field as an example, the number of the hot spot goods is limited, so that the traffic at the moment of starting the activity is very large, and the same resource is requested, so that serious database concurrent read-write conflict and resource lock request conflict can be caused when inventory is reduced.
In the process of implementing the invention, the inventor finds that at least the following technical problems exist in the prior art: the existing inventory hot spot carrying quantity has three main modes: firstly, shifting peaks of flood peaks through an upstream peak clipping and valley filling measure, so that the number of requests for inventory deduction reaches a range which can be borne by a system; secondly, scattering inventory hot spots through a hashtag topic tag technology of the redis, and performing deduction operation on a plurality of redis clusters in a dispersing mode. However, upstream peak and valley clipping measures need to be supported by upstream software and hardware, and the cost performance is not high. The label technology of redis is because stock deduction key has taken the hashtag, and is more troublesome when leading to the dilatation, simultaneously owing to opened the hashtag function, holistic deduction performance will receive the influence.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for reducing inventory deduction, so that the dispersed carrying capacity of inventory hotspots can be optimized without additional software and hardware investment, and the processing efficiency of user requests is improved.
In a first aspect, an embodiment of the present invention provides an inventory deduction method, including:
acquiring a target article identifier associated with a user request, and determining a deduction server cluster associated with the target article identifier;
according to the user identification, distributing the user request to a target deduction server in a deduction server cluster based on a preset non-encrypted Hash algorithm, so that the target deduction server deducts the stock information of the target deduction server according to the user request;
and generating request feedback information according to the deduction response information of the target deduction server to respond.
In a second aspect, an embodiment of the present invention further provides an inventory deduction device, including:
the server cluster determining module is used for acquiring the target article identifier associated with the user request and determining a deduction server cluster associated with the target article identifier;
the user request distribution module is used for distributing the user request to a target deduction server in the deduction server cluster based on a preset non-encrypted Hash algorithm according to the user identification so that the target deduction server deducts the stock information of the target deduction server according to the user request;
and the feedback information response module is used for generating request feedback information according to the deduction response information of the target deduction server and responding.
In a third aspect, an embodiment of the present invention further provides a computer device, where the computer device includes:
one or more processors;
storage means for storing one or more programs;
when executed by one or more processors, cause the one or more processors to implement a method of inventory deduction as provided by any of the embodiments of the present invention.
In a fourth aspect, embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the inventory deduction method as provided in any of the embodiments of the present invention.
The embodiment of the invention determines a deduction server cluster associated with the target object identifier by acquiring the target object identifier associated with the user request; according to the user identification, distributing the user request to a target deduction server in a deduction server cluster based on a preset non-encrypted Hash algorithm, so that the target deduction server deducts the stock information of the target deduction server according to the user request; and request feedback information is generated according to the deduction response information of the target deduction server for responding, and the user request is distributed to the target deduction server in the deduction server cluster for responding to the user request based on the non-encrypted Hash algorithm, so that the processing efficiency of the user request is improved.
Drawings
Fig. 1 is a flowchart of an inventory deduction method according to an embodiment of the present invention;
FIG. 2 is a flowchart of an inventory deduction method according to a second embodiment of the present invention;
fig. 3a is a flowchart of an inventory deduction method according to a third embodiment of the present invention;
fig. 3b is a schematic flowchart of reducing components of a cluster and expanding the volume according to a third embodiment of the present invention;
fig. 3c is a schematic flow chart of a request for current limiting according to a third embodiment of the present invention;
fig. 3d is a schematic flowchart of a user request allocation according to a third embodiment of the present invention;
fig. 3e is a schematic flowchart of a user request response based on a verification keyword according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an inventory deduction device according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an inventory deduction method according to an embodiment of the present invention. The present embodiment may be applicable to situations when inventory deductions are made based on received user requests. The method may be performed by an inventory reduction apparatus, which may be implemented in software and/or hardware, for example, which may be configured in a computer device. As shown in fig. 1, the method includes:
s110, obtaining the target object identification associated with the user request, and determining a deduction server cluster associated with the target object identification.
In this embodiment, the user request may be a request initiated by the user through the client to purchase the target item. Illustratively, a user initiates a purchase operation by operating a terminal to which a client belongs, the client generates a user request corresponding to the purchase operation and sends the user request to a server after detecting an operation triggered by the user, and the server analyzes the user request after monitoring the user request sent by the client, obtains a target article identifier contained in the user request, and determines a deduction server cluster corresponding to the target article identifier.
The deduction server cluster is configured in advance according to the heat degree of the target object and comprises a plurality of deduction servers. Each deduction server corresponds to a virtual cache of the target object. By dispersing the cache of the target object to each deduction server in the deduction server cluster, when the user request is responded, the load of the user request is dispersed to each deduction server in the deduction server cluster, the problem that the concurrency capacity of the independent servers is limited is solved, the effect of dispersing the second killing requests is achieved, and the response capacity of the system is improved.
In an embodiment of the present invention, obtaining a target item identifier associated with a user request includes: acquiring the accumulated request number of a request counter in a set time period; and when the request quantity is within the set quantity threshold value, acquiring the target item identification associated with the user request. And when the request number is not within the set number threshold, generating request failure information as response information of the user request. Optionally, in order to implement current limiting on the user request, the user request may be screened in a counting manner, and compared with a peak clipping and valley filling measure, the method has a very high cost performance in requesting current limiting, and does not require additional software and hardware investment. Specifically, when a user request is monitored, firstly, the request quantity in a set time period is accumulated through a counter, whether the user request is processed or not is judged according to the relation between the request quantity and a quantity threshold value, when the accumulated request quantity does not reach the set quantity threshold value, the user request is processed, and when the accumulated request quantity reaches the set quantity threshold value, request failure information is directly returned. For example, a counter may be set in the guava cache, when a user request is monitored, the user request first passes through the counter in the guava cache, the counter will increment to accumulate the request number, when the request number reaches a set number threshold, such as 4000QPS, the counter will not increment, and all subsequent requests will be directly rejected. And after the set time period is reached, the counter is cleared, the number of user requests is recalculated to determine whether to release the service, and the process is repeated. The counter realizes excellent current limiting with extremely low cost, and compared with a peak clipping and valley filling mode, software and hardware do not need excessive investment, so that the cost performance is quite high.
And S120, distributing the user request to a target deduction server in the deduction server cluster based on a preset non-encryption Hash algorithm according to the user identification, so that the target deduction server deducts the inventory information of the target deduction server according to the user request.
In this embodiment, after determining the deduction server cluster associated with the target item identifier, a target deduction server is selected from the deduction server cluster to process the user request, and inventory deduction is performed. Wherein the selection of the target deduction server may be determined based on a preset non-encrypted hash algorithm. Preferably, the non-cryptographic hash algorithm is a murmur algorithm. The good discreteness and explosiveness of the murmur algorithm are utilized to ensure the distribution balance of the user request, and further ensure the balance of the whole inventory deduction.
In an embodiment of the present invention, allocating a user request to a target deduction server in a deduction server cluster based on a preset non-encrypted hash algorithm according to a user identifier further includes: generating a random number according to the inventory keyword associated with the target article identifier; generating a reference value according to the random number and the inventory keyword, and determining a hash value corresponding to the reference value according to a non-encryption hash algorithm; and determining a target deduction server according to the hash value, and distributing the user request to the target deduction server. Optionally, the identifier of the target deduction server is determined by a random number generation algorithm in combination with a non-encrypted hash algorithm, so as to distribute the user request to the target deduction server. Specifically, when different user requests are all associated to the same target item, the inventory keywords of the target item are the same, and therefore a random number is generated by using a random number generation algorithm (such as random algorithm) on the basis of the inventory keywords, the random number is added to the inventory keywords to obtain a reference value, then a hash value of the reference value is calculated by using a non-encrypted hash algorithm (such as murmurmurur algorithm), and the target deduction server is determined by positioning in the deduction server cluster based on the hash value. Illustratively, the deduction server numbered as the hash value may be taken as the target deduction server. The user requests related to the same target article are distinguished through random numbers and inventory keywords, and a murmurr algorithm is combined to calculate a hash value to determine a target deduction server, so that the user requests are distributed more evenly, and further the inventory deduction is guaranteed to be more evenly.
And S130, generating request feedback information according to the deduction response information of the target deduction server and responding.
After the user request is distributed to the target deduction server, the target deduction server carries out inventory deduction according to the user request, returns deduction response information, and generates request feedback information according to the deduction response information returned by the target deduction server to carry out response of the user request. Optionally, the deduction response information returned by the target deduction server may be deduction success information or deduction failure information.
In one embodiment of the present invention, generating request feedback information for responding according to deduction response information of a target deduction server includes: when the deduction response information is deduction success, generating request success information as request feedback information; and when the deduction response information is deduction failure, calling a post worker to perform retry deduction, and generating request feedback information according to a retry deduction result. Specifically, when the deduction response information is deduction success, the user request response is indicated to be successful, and request success information is generated and serves as request feedback information to be sent to the client; when the deduction response information is deduction failure, the two conditions of insufficient inventory failure or successful deduction but overtime response are possible, in order to distinguish the two conditions, a user request can be sent to a post-worker retry deduction, when the post-worker retry deduction is successful, deduction success is shown but response overtime is achieved, namely the user successfully purchases a target article actually, request success information is generated and sent to the client as request feedback information, and when the post-worker retry deduction is failed, the inventory shortage is shown, the request failure information is generated and sent to the client as the request feedback information.
The embodiment of the invention determines a deduction server cluster associated with the target object identifier by acquiring the target object identifier associated with the user request; according to the user identification, distributing the user request to a target deduction server in a deduction server cluster based on a preset non-encrypted Hash algorithm, so that the target deduction server deducts the stock information of the target deduction server according to the user request; and request feedback information is generated according to the deduction response information of the target deduction server for responding, and the user request is distributed to the target deduction server in the deduction server cluster for responding to the user request based on the non-encrypted Hash algorithm, so that the processing efficiency of the user request is improved.
Example two
Fig. 2 is a flowchart of an inventory deduction method according to a second embodiment of the present invention. The embodiment is further optimized on the basis of the scheme. As shown in fig. 2, the method includes:
s210, obtaining reservation information of the hot spot article, and determining the number of deduction servers related to the hot spot article according to the reservation information and inventory information of the hot spot article.
In the present embodiment, the configuration of the deduction server cluster is embodied. Optionally, the deduction server cluster may be configured according to reservation information and inventory information of the hot spot item. For example, a reservation interface can be displayed to a user before the hot spot article is placed on the shelf, the user can trigger a reservation operation on the hot spot article through the reservation interface, count the reservation times of the hot spot article as reservation information of the hot spot article, use the inventory quantity of the hot spot article as inventory information, and determine the quantity of deduction servers with dispersed inventory of the hot spot article by combining the reservation information, the inventory information and the performance of the deduction servers of the hot spot article. Theoretically, the larger the reservation information of the target item is, the larger the number of the deduction servers is, but the number of the deduction servers is also limited by the inventory information of the target item, so as to ensure that the inventory quantity distributed on each deduction server is reasonable.
S220, configuring a deduction server cluster related to the hot spot articles based on the number of deduction servers.
After the number of the deduction servers is determined, the deduction servers with the corresponding number are configured, the configured deduction servers are built into a deduction server cluster, and then user requests are monitored.
It should be noted that, when the configured deduction server cluster cannot process the current user traffic, the deduction server cluster may be expanded to add a new deduction server. Specifically, the deduction cluster key words are deleted firstly, then the new deduction server is configured to the deduction server cluster, and the engine is restarted to realize smooth capacity expansion.
S230, obtaining the target object identification associated with the user request, and determining the deduction server cluster associated with the target object identification.
And S240, distributing the user request to a target deduction server in the deduction server cluster based on a preset non-encryption Hash algorithm according to the user identification, so that the target deduction server deducts the inventory information of the target deduction server according to the user request.
And S250, generating request feedback information according to the deduction response information of the target deduction server and responding.
According to the embodiment of the invention, the number of the deduction servers related to the hot spot article is determined according to the reservation information of the hot spot article and the inventory information of the hot spot article by acquiring the reservation information of the hot spot article; the deduction server cluster related to the hot spot articles is configured based on the number of the deduction servers, the deduction server cluster related to the hot spot articles is flexibly configured through inventory information and reservation information of the hot spot articles, the capacity expansion mode of the deduction server cluster is simplified, and the deduction server cluster has strong cluster self-adaption characteristics.
EXAMPLE III
The present embodiment provides a preferred embodiment based on the above-described embodiments. Fig. 3a is a flowchart of an inventory deduction method according to a third embodiment of the present invention. In this embodiment, the deduction server cluster is embodied as a deduction large cluster, and the deduction server is embodied as a redis deduction cluster. As shown in fig. 3a, the method comprises:
s310, deducting the building and the capacity expansion of the large cluster.
Fig. 3b is a schematic flowchart of the building and capacity expansion of a deductive large cluster according to a third embodiment of the present invention, and as shown in fig. 3b, after a docker (application engine) is started, a local configuration is scanned through a routing algorithm, and when a plurality of configured redis deductive clusters are scanned, the redis deductive clusters are built into one large cluster by using a ktama hash algorithm, and then request monitoring is performed. And if the current cluster cannot meet the current user flow, judging to expand the capacity, adding a redis deduction cluster, and expanding the capacity of the deduction large cluster. Because the inventory keys are the same in each deduction cluster, the possibility of moving the inventory keys does not exist, the deductible cluster keys can be directly deleted, then the new cluster is configured into a configuration file, and smooth capacity expansion can be realized by restarting docker.
And S320, monitoring the user request, and performing current limiting request through sliding window counting.
Fig. 3c is a schematic diagram of a flow of request throttling according to a third embodiment of the present invention, as shown in fig. 3c, when a user request enters to perform inventory deduction, the user request first needs to pass through a counter in the guava cache, the counter will be incremented, when a set threshold is reached, such as 4000QPS, the counter will not be incremented, and all subsequent requests will be directly rejected. Since the counter is expired after one second, the counter is cleared after the next second, and then the number of user requests is recalculated to determine whether to pass or not, and the process is repeated. The current limiting is realized at extremely low cost, and compared with a peak clipping and valley filling mode, the current limiting device has the advantages that the investment of software and hardware is not required to be excessive, and the performance-price ratio is high.
And S330, distributing the user request to the cluster to be deducted through a murmurur algorithm.
Fig. 3d is a schematic flow chart of a user request distribution according to a third embodiment of the present invention, and as shown in fig. 3d, the uniformity of deduction is ensured by the murmur algorithm. After a user requests to enter, the inventory keys of the same commodity are deducted, so that a random number is generated by using a random algorithm on the basis of the inventory keys, the generated random number is attached to the inventory keys to obtain a reference value, a hash value of the reference value is calculated by using a murmurmur algorithm, the hash value is used for positioning in a deduction large cluster, and a cluster to be deducted is found. Due to the good discreteness and explosiveness of the murmur algorithm, the balance of the inventory deduction whole can be ensured.
And S340, responding to the user request according to the verification keywords fed back by the cluster to be deducted.
Fig. 3e is a schematic flowchart of a user request response based on a verification keyword according to a third embodiment of the present invention, as shown in fig. 3e, in consideration of a situation that a redis operation may be successfully deducted but overtime occurs, and such overtime cannot accurately know whether the inventory is deducted. Therefore, for each inventory deduction, a deduction check key is written on the currently operated redis cluster to confirm the result of the deduction. The verification key comprises various information of the deduction, such as pin information, commodity information, idempotent information and the like, and since the writing of the verification key occurs after the stock deduction, if the writing of the verification key is successful, the stock deduction can be considered to be certainly successful. Otherwise, the inventory deduction may be considered unsuccessful. And when the stock deduction is unsuccessful, carrying out retry deduction by utilizing a postposition worker, and if the retry is successful, returning the success of deduction to the user. If the retry fails, the user is directly returned to the user to deduct the failure without excessive retry operation, because excessive retry operation is likely to cause the condition of over-sending or under-sending.
The embodiment of the invention realizes the requested current limiting through the sliding window counting, and realizes high-efficiency current limiting measures by utilizing simple components; the high-efficiency routing algorithm is realized by combining the ketama hash with the murmurr hash, so that the request distribution is more balanced; the deductible cluster information is stored by using a built-in deductible cluster list, when a new cluster needs to be added, the key of the deductible cluster information is directly deleted, then the configuration of the machine is modified, and the machine is restarted, so that one-key smooth capacity expansion can be realized, and the capacity expansion mode is simplified.
Example four
Fig. 4 is a schematic structural diagram of an inventory deduction device according to a fourth embodiment of the present invention. The inventory reduction device may be implemented in software and/or hardware, for example, the inventory reduction device may be configured in a computer device. As shown in fig. 4, the apparatus includes a server cluster determining module 410, a user request allocating module 420, and a feedback information responding module 430, wherein:
the server cluster determining module 410 is configured to obtain a target item identifier associated with a user request, and determine a deduction server cluster associated with the target item identifier;
the user request distribution module 420 is configured to distribute, according to the user identifier, the user request to the target deduction server in the deduction server cluster based on a preset non-encrypted hash algorithm, so that the target deduction server subtracts the inventory information of the target deduction server according to the user request;
and a feedback information response module 430, configured to generate request feedback information according to the deduction response information of the target deduction server, and respond to the request feedback information.
In the embodiment of the invention, a server cluster determining module is used for acquiring the target article identifier associated with the user request and determining a deduction server cluster associated with the target article identifier; the user request distribution module distributes the user request to a target deduction server in the deduction server cluster based on a preset non-encrypted Hash algorithm according to the user identification so that the target deduction server deducts the inventory information of the target deduction server according to the user request; the feedback information response module generates request feedback information to respond according to the deduction response information of the target deduction server, and the user request is distributed to the target deduction server in the deduction server cluster to respond to the user request based on the non-encrypted Hash algorithm, so that the processing efficiency of the user request is improved.
Optionally, on the basis of the foregoing scheme, the user request allocating module 420 is specifically configured to:
generating a random number according to the inventory keyword associated with the target article identifier;
generating a reference value according to the random number and the inventory keyword, and determining a hash value corresponding to the reference value according to a non-encryption hash algorithm;
and determining a target deduction server according to the hash value, and distributing the user request to the target deduction server.
Optionally, on the basis of the above scheme, the non-encrypted hash algorithm is a murmurmur algorithm.
Optionally, on the basis of the foregoing scheme, the server cluster determining module 410 is specifically configured to:
acquiring the accumulated request number of a request counter in a set time period;
and when the request quantity is within the set quantity threshold value, acquiring the target item identification associated with the user request.
Optionally, on the basis of the foregoing scheme, the feedback information response module 430 is configured to:
and when the request number is not within the set number threshold, generating request failure information as response information of the user request.
Optionally, on the basis of the foregoing scheme, the apparatus further includes a server cluster configuration module, configured to:
acquiring reservation information of the hot spot article, and determining the number of deduction servers related to the hot spot article according to the reservation information and inventory information of the hot spot article;
and configuring a deduction server cluster related to the hot spot article based on the number of deduction servers.
Optionally, on the basis of the foregoing scheme, the feedback information response module 430 is specifically configured to:
when the deduction response information is deduction success, generating request success information as request feedback information;
and when the deduction response information is deduction failure, calling a post worker to perform retry deduction, and generating request feedback information according to a retry deduction result.
The inventory deduction device provided by the embodiment of the invention can execute the inventory deduction method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention. FIG. 5 illustrates a block diagram of an exemplary computer device 512 suitable for use in implementing embodiments of the present invention. The computer device 512 shown in FIG. 5 is only an example and should not bring any limitations to the functionality or scope of use of embodiments of the present invention.
As shown in FIG. 5, computer device 512 is in the form of a general purpose computing device. Components of computer device 512 may include, but are not limited to: one or more processors 516, a system memory 528, and a bus 518 that couples the various system components including the system memory 528 and the processors 516.
Bus 518 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and processor 516, or a local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 512 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 512 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 528 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)530 and/or cache memory 532. The computer device 512 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage 534 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, and commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 518 through one or more data media interfaces. Memory 528 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 540 having a set (at least one) of program modules 542, including but not limited to an operating system, one or more application programs, other program modules, and program data, may be stored in, for example, the memory 528, each of which examples or some combination may include an implementation of a network environment. The program modules 542 generally perform the functions and/or methods of the described embodiments of the invention.
The computer device 512 may also communicate with one or more external devices 514 (e.g., keyboard, pointing device, display 524, etc.), with one or more devices that enable a user to interact with the computer device 512, and/or with any devices (e.g., network card, modem, etc.) that enable the computer device 512 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 522. Also, computer device 512 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via network adapter 520. As shown, the network adapter 520 communicates with the other modules of the computer device 512 via the bus 518. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the computer device 512, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 516 executes various functional applications and data processing by running programs stored in the system memory 528, for example, to implement the inventory reduction method provided by the embodiment of the present invention, the method includes:
acquiring a target article identifier associated with a user request, and determining a deduction server cluster associated with the target article identifier;
according to the user identification, distributing the user request to a target deduction server in a deduction server cluster based on a preset non-encrypted Hash algorithm, so that the target deduction server deducts the stock information of the target deduction server according to the user request;
and generating request feedback information according to the deduction response information of the target deduction server to respond.
Of course, those skilled in the art will appreciate that the processor may also implement the inventory deduction method provided by any of the embodiments of the present invention.
EXAMPLE six
The sixth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a stock reduction method provided in the sixth embodiment of the present invention, where the method includes:
acquiring a target article identifier associated with a user request, and determining a deduction server cluster associated with the target article identifier;
according to the user identification, distributing the user request to a target deduction server in a deduction server cluster based on a preset non-encrypted Hash algorithm, so that the target deduction server deducts the stock information of the target deduction server according to the user request;
and generating request feedback information according to the deduction response information of the target deduction server to respond.
Of course, the computer program stored on the computer-readable storage medium provided by the embodiments of the present invention is not limited to the above method operations, and may also perform operations related to the inventory deduction method provided by any embodiments of the present invention.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments illustrated herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An inventory deduction method, comprising:
acquiring a target article identifier associated with a user request, and determining a deduction server cluster associated with the target article identifier;
according to the user identification, distributing the user request to a target deduction server in the deduction server cluster based on a preset non-encrypted Hash algorithm, so that the target deduction server deducts the stock information of the target deduction server according to the user request;
and generating request feedback information according to the deduction response information of the target deduction server to respond.
2. The method of claim 1, wherein the allocating the user request to a target deduction server in the deduction server cluster based on a preset non-cryptographic hash algorithm according to the user identifier further comprises:
generating a random number according to the inventory keyword associated with the target article identifier;
generating a reference value according to the random number and the inventory keyword, and determining a hash value corresponding to the reference value according to the non-encryption hash algorithm;
and determining the target deduction server according to the hash value, and distributing the user request to the target deduction server.
3. The method of claim 2, wherein the non-cryptographic hash algorithm is a murmurmur algorithm.
4. The method of claim 1, wherein obtaining the target item identifier associated with the user request comprises:
acquiring the accumulated request number of a request counter in a set time period;
and when the request quantity is within a set quantity threshold value, acquiring the target item identification associated with the user request.
5. The method of claim 4, further comprising:
and when the request number is not within a set number threshold, generating request failure information as response information of the user request.
6. The method of claim 5, further comprising:
acquiring reservation information of hot spot articles, and determining the number of deduction servers related to the hot spot articles according to the reservation information and the inventory information of the hot spot articles;
and configuring a deduction server cluster associated with the hot spot article based on the number of deduction servers.
7. The method of claim 1, wherein the generating request feedback information for responding according to the deduction response information of the target deduction server comprises:
when the deduction response information is deduction success, generating request success information serving as the request feedback information;
and when the deduction response information is deduction failure, calling a post worker to perform retry deduction, and generating the request feedback information according to a retry deduction result.
8. An inventory deduction device, comprising:
the server cluster determining module is used for acquiring a target article identifier associated with a user request and determining a deduction server cluster associated with the target article identifier;
the user request distribution module is used for distributing the user request to a target deduction server in the deduction server cluster based on a preset non-encrypted Hash algorithm according to the user identification so that the target deduction server deducts the stock information of the target deduction server according to the user request;
and the feedback information response module is used for generating request feedback information according to the deduction response information of the target deduction server and responding.
9. A computer device, the device comprising:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the inventory deduction method as recited in any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the inventory deduction method as claimed in any one of claims 1 to 7.
CN202011330954.0A 2020-11-24 2020-11-24 Inventory deduction method, device, equipment and storage medium Pending CN113762857A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011330954.0A CN113762857A (en) 2020-11-24 2020-11-24 Inventory deduction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011330954.0A CN113762857A (en) 2020-11-24 2020-11-24 Inventory deduction method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113762857A true CN113762857A (en) 2021-12-07

Family

ID=78786045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011330954.0A Pending CN113762857A (en) 2020-11-24 2020-11-24 Inventory deduction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113762857A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103580988A (en) * 2012-07-31 2014-02-12 阿里巴巴集团控股有限公司 Method for message receiving, pushing and transmitting, device, server group and system
CN107231402A (en) * 2016-08-31 2017-10-03 北京新媒传信科技有限公司 HTTP request processing method, apparatus and system
CN108897615A (en) * 2018-05-31 2018-11-27 康键信息技术(深圳)有限公司 Second kills request processing method, application server cluster and storage medium
CN110839084A (en) * 2019-11-19 2020-02-25 中国建设银行股份有限公司 Session management method, device, equipment and medium
CN110958317A (en) * 2019-11-29 2020-04-03 腾讯科技(深圳)有限公司 Data processing method and equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103580988A (en) * 2012-07-31 2014-02-12 阿里巴巴集团控股有限公司 Method for message receiving, pushing and transmitting, device, server group and system
CN107231402A (en) * 2016-08-31 2017-10-03 北京新媒传信科技有限公司 HTTP request processing method, apparatus and system
CN108897615A (en) * 2018-05-31 2018-11-27 康键信息技术(深圳)有限公司 Second kills request processing method, application server cluster and storage medium
CN110839084A (en) * 2019-11-19 2020-02-25 中国建设银行股份有限公司 Session management method, device, equipment and medium
CN110958317A (en) * 2019-11-29 2020-04-03 腾讯科技(深圳)有限公司 Data processing method and equipment

Similar Documents

Publication Publication Date Title
CN108111554B (en) Control method and device for access queue
US7716193B2 (en) Ensuring timely servicing of desired transactions in a database server
CN108112038B (en) Method and device for controlling access flow
CN107729137B (en) Server, block chain signature verification decryption method and storage medium
CN110866008B (en) Data processing method, device and system
CN111427971B (en) Business modeling method, device, system and medium for computer system
CN105591743A (en) Method and device for carrying out identity authentication through equipment operation features of user terminal
WO2019148728A1 (en) Electronic device, execution task assignment method for distributed system, and storage medium
US11914732B2 (en) Systems and methods for hard deletion of data across systems
CN111586177B (en) Cluster session loss prevention method and system
CN111752944A (en) Data allocation method and device, computer equipment and storage medium
CN111324622A (en) Resource first-aid-purchase processing method, device, equipment and storage medium
US11960465B2 (en) Database inventory isolation
CN107451301B (en) Processing method, device, equipment and storage medium for real-time delivery bill mail
CN111913861A (en) Performance test method, device, equipment and medium of Internet of things system
CN113762857A (en) Inventory deduction method, device, equipment and storage medium
CN111385294A (en) Data processing method, system, computer device and storage medium
US20230237017A1 (en) Data flow control in distributed computing systems
CN114070847A (en) Current limiting method, device, equipment and storage medium of server
CN113434069A (en) Menu configuration method, device, equipment and storage medium
CN113763094A (en) Service information processing method, device, server, medium and system
CN114650252B (en) Routing method and device based on enterprise service bus and computer equipment
CN113055401B (en) Enterprise business authorization processing method and device
CN117472908A (en) Method, device, electronic equipment and storage medium for preventing repeated service delivery
CN117312712A (en) Form submitting method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination