CN116662208B - Transaction testing method, device and medium based on distributed baffle - Google Patents

Transaction testing method, device and medium based on distributed baffle Download PDF

Info

Publication number
CN116662208B
CN116662208B CN202310917688.9A CN202310917688A CN116662208B CN 116662208 B CN116662208 B CN 116662208B CN 202310917688 A CN202310917688 A CN 202310917688A CN 116662208 B CN116662208 B CN 116662208B
Authority
CN
China
Prior art keywords
message
transaction
distributed
newspaper
mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310917688.9A
Other languages
Chinese (zh)
Other versions
CN116662208A (en
Inventor
王有为
张笑虹
苗咏
邹胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Huarui Distributed Technology Co ltd
Huarui Distributed Beijing Technology Co ltd
Original Assignee
Shenzhen Huarui Distributed Technology Co ltd
Huarui Distributed Beijing 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 Shenzhen Huarui Distributed Technology Co ltd, Huarui Distributed Beijing Technology Co ltd filed Critical Shenzhen Huarui Distributed Technology Co ltd
Priority to CN202310917688.9A priority Critical patent/CN116662208B/en
Publication of CN116662208A publication Critical patent/CN116662208A/en
Application granted granted Critical
Publication of CN116662208B publication Critical patent/CN116662208B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of big data, and provides a transaction testing method, equipment and medium based on a distributed baffle, wherein the method is applied to the distributed baffle constructed based on C++, and the lower time delay level can be ensured based on the characteristic of C++; recording the receiving time delay dotting information of each message in the message stream, recording the sending time delay dotting information of the response report message, and lasting the information to a file so as to assist in judging the performance of each system in the transaction process; different processes are started to process different flows respectively, and different business messages are processed respectively by utilizing different message processors, so that a large number of orders can be processed simultaneously, and the method is suitable for a high concurrency transaction scene.

Description

Transaction testing method, device and medium based on distributed baffle
Technical Field
The invention relates to the technical field of big data, in particular to a transaction testing method, device and medium based on a distributed baffle.
Background
In an actual transaction, there is a scenario in which a large number of orders are simultaneously reported from a newspaper board to an exchange, or a large number of responses and returns of deals are simultaneously returned from the exchange to the newspaper board.
However, under the existing test conditions, high concurrency and large quantity of order matching cannot be provided, multiple complex order matching strategies are not supported, and a time delay statistics file cannot be output to analyze performance, so that the requirements of high concurrency and complex test scenes cannot be met.
Disclosure of Invention
In view of the above, it is necessary to provide a transaction testing method, device and medium based on a distributed baffle, which aims to solve the problem that accurate transaction testing cannot be performed in a high concurrency scene.
A transaction testing method based on a distributed baffle is applied to the distributed baffle constructed based on C++, and comprises the following steps:
registering at least one message processor when a transaction test request in a high concurrency low latency scenario is received;
receiving connection and message stream sent by a newspaper disc end, and recording receiving time delay dotting information of each message in the message stream;
performing deserialization processing on the message flow by using a first thread to obtain service messages, and storing the service messages into a lock-free message queue;
acquiring a corresponding message processor from the at least one message processor by using a second thread to process the service message in the message queue to obtain a response return message;
transmitting the response return message to the disc reporting end, and recording the transmission delay dotting information of the response return message;
storing the receiving time delay dotting information of each message and the sending time delay dotting information of the response report message into a time delay processing queue;
The data in the delay processing queue are persisted to a file by using a third thread, and a target file is obtained;
and generating a transaction test result according to the target file.
According to a preferred embodiment of the present invention, said registering at least one message processor comprises:
acquiring position data of a processing function of each message processor;
generating a function pointer according to the position data of the processing function of each message processor, and determining the function pointer as a message number;
generating an array by taking the message number as an array subscript;
wherein the message number corresponds to the service message.
According to a preferred embodiment of the present invention, the connection and message flow sent by the receiving newspaper board end includes:
receiving connection and message flow sent by the newspaper disc end by using a pre-established TCP server;
the TCP server is established by using an ASIO analog exchange gateway.
According to a preferred embodiment of the present invention, the performing, by using a first thread, a deserialization process on the message flow to obtain a service message includes:
for each message in the message stream, acquiring a message header and a message body of the message by using the first thread;
analyzing the message header to obtain the service message type and the message length of the message;
Invoking a service message anti-sequence processing interface corresponding to the service message type;
and reading the fields from the message body according to the message length by utilizing the service message anti-sequence processing interface, and sequentially and anti-serializing the read fields to the corresponding message object fields to obtain the service message corresponding to the message.
According to a preferred embodiment of the present invention, the obtaining, by the second thread, a corresponding message processor from the at least one message processor, to process a service message in the message queue, and obtaining a response report message includes:
for each service message in the message queue, acquiring a message processor corresponding to a message number of each service message from the at least one message processor by utilizing the second thread;
calling a processing function of a corresponding message processor to process each service message to obtain a response message and a return message corresponding to each service message;
and assembling the response message and the return message corresponding to each service message to obtain the response return message.
According to a preferred embodiment of the invention, the method further comprises:
when a modification instruction of the configuration file of the distributed baffle is received, determining a transaction strategy, an order transaction mode and an additional working mode according to the modification instruction;
Wherein the additional operation mode includes: a filtering mode, a synchronous return mode, a report polling mode, a real-time matching mode, an automatic matching mode and a exchange state switching mode.
According to a preferred embodiment of the present invention, after determining the transaction policy, the order transaction mode, and the additional working mode according to the modification instruction, the method further includes:
when the repeat filtering mode is started, acquiring a repeat detection rule of each trade market, and detecting whether the current order is a repeat order according to the repeat detection rule of each trade market; when the current order is the repeated order, not processing the current order or returning a refusal response signal to the current order;
when the synchronous return mode is started, caching all processed orders and response return messages; when a synchronous report request sent by the disc reporting end is received, breakpoint continuous transmission is carried out on the order and the response report message stored in the cache;
when the newspaper disc polling mode is started, modifying partition configuration of the distributed baffle by using the configuration file, and simulating partitions or transaction units of each exchange when the distributed baffle is started;
When the exchange state switching mode is started, determining state switching time according to the configuration file, and performing state switching according to the state switching time; wherein the states comprise a closed state, a pre-open state and an open state;
the real-time matching mode corresponds to a scene of matching according to a buying and selling order when simulating collective bidding or continuous bidding; the automatic matching mode corresponds to a scene that matches on demand.
According to a preferred embodiment of the invention, the method further comprises:
when the distributed baffle is started, determining an IP address, a port, a database name and a table name according to the configuration file; determining a newspaper disc library corresponding to the newspaper disc end based on the IP address, the port, the database name and the table name; continuously detecting the connection state of the distributed baffle and the newspaper disc library by using a detection thread; when the connection state is unconnected, the connection between the distributed baffle and the newspaper disc library is initiated; when the connection state is changed, recording the changed connection state, and updating the connection state of the distributed baffle and the newspaper disc library by using the recorded connection state; wherein the connection state comprises unconnected, connected and reconnection states;
When the connection state of the distributed baffle and the newspaper disc library is connected, continuously polling traversing messages from the newspaper disc library by using a message reading thread to conduct transaction processing, and writing the response return messages obtained after the processing back to the newspaper disc library.
A distributed baffle-based transaction testing device operating on a distributed baffle constructed based on c++, the distributed baffle-based transaction testing device comprising:
a registration unit, configured to register at least one message processor when a transaction test request in a high concurrency low latency scenario is received;
the recording unit is used for receiving the connection and the message stream sent by the disc reporting end and recording the receiving time delay dotting information of each message in the message stream;
the processing unit is used for performing deserialization processing on the message flow by utilizing a first thread to obtain service messages, and storing the service messages into a lock-free message queue;
the processing unit is further configured to acquire a corresponding message processor from the at least one message processor by using a second thread, and process the service message in the message queue to obtain a response report message;
the recording unit is further used for sending the response return message to the newspaper disc end and recording the sending delay dotting information of the response return message;
The storage unit is used for storing the receiving time delay dotting information of each message and the sending time delay dotting information of the response report message into a time delay processing queue;
the persistence unit is used for persistence of the data in the time delay processing queue to a file by using a third thread to obtain a target file;
and the generating unit is used for generating a transaction test result according to the target file.
A computer device, the computer device comprising:
a memory storing at least one instruction; a kind of electronic device with high-pressure air-conditioning system
And the processor executes the instructions stored in the memory to realize the transaction testing method based on the distributed baffle.
A computer-readable storage medium having stored therein at least one instruction for execution by a processor in a computer device to implement the distributed barrier-based transaction testing method.
According to the technical scheme, on one hand, the method is applied to the distributed baffle constructed based on C++, and the characteristic based on C++ can ensure a lower time delay level; on one hand, recording the receiving time delay dotting information of each message in the message stream, recording the sending time delay dotting information of the response return message, and lasting to a file to assist in judging the performance of each system in the transaction process; on the other hand, different processes are started to process different processes respectively, and different business messages are processed respectively by utilizing different message processors, so that a large number of orders can be processed simultaneously, and the method is suitable for a high-concurrency transaction scene.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of the distributed baffle-based transaction testing method of the present invention.
FIG. 2 is a functional block diagram of a preferred embodiment of a distributed baffle-based transaction testing device of the present invention.
FIG. 3 is a schematic diagram of a computer device for implementing a transaction testing method based on distributed baffles according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of a transaction testing method based on a distributed baffle according to a preferred embodiment of the present invention. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
The transaction testing method based on the distributed baffle is applied to one or more computer devices, wherein the computer device is a device capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and the hardware of the computer device comprises, but is not limited to, a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, an ASIC), a programmable gate array (Field-Programmable Gate Array, an FPGA), a digital processor (Digital Signal Processor, a DSP), an embedded device and the like.
The computer device may be any electronic product that can interact with a user in a human-computer manner, such as a personal computer, tablet computer, smart phone, personal digital assistant (Personal Digital Assistant, PDA), game console, interactive internet protocol television (Internet Protocol Television, IPTV), smart wearable device, etc.
The computer device may also include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network server, a server group composed of a plurality of network servers, or a Cloud based Cloud Computing (Cloud Computing) composed of a large number of hosts or network servers.
The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
The network in which the computer device is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), and the like.
The transaction testing method based on the distributed baffle is applied to the distributed baffle constructed based on C++, and comprises the following steps:
s10, registering at least one message processor when a transaction test request in a high concurrency low latency scenario is received.
For example: when a large number of orders are detected to be reported to the exchange from the newspaper board at the same time, or a large number of responses and deal returns are simultaneously returned to the newspaper board from the exchange, determining that the current transaction scene is the high-concurrency low-delay scene.
In this embodiment, the transaction test request may be triggered by a tester or a developer, which is not limited by the present invention.
In this embodiment, unlike the conventional baffle implementation using python, the distributed baffle in this embodiment is constructed based on c++, which can ensure a lower latency level.
In this embodiment, in order to facilitate processing of a large number of highly concurrent messages, a plurality of message processors need to be registered in advance.
Specifically, the registering at least one message processor comprises:
acquiring position data of a processing function of each message processor;
generating a function pointer according to the position data of the processing function of each message processor, and determining the function pointer as a message number;
generating an array by taking the message number as an array subscript;
wherein the message number corresponds to the service message.
Specifically, when the test program is started, all message processors are registered into a message factory, and in order to reduce the time consumption of inquiry, the message factory uses an array as a stored data structure, wherein a message number is used as an array subscript, the position of the subscript is stored as a corresponding message processor function pointer, the data structure is an array for storing the function pointer, and because specific values (the number of bits is fixed, so that the range and the maximum value) of different service message numbers are specified in a transaction office document, and therefore the array capacity is fixed. Storing the processing function pointer of the corresponding service message at the lower label position of the corresponding message number of the array enables the time complexity of processing the message by the subsequent acquisition processor function pointer to reach the O (1) level.
S11, receiving connection and message stream sent by a newspaper disc end, and recording receiving time delay dotting information of each message in the message stream.
In this embodiment, the receiving the connection and the message flow sent by the newspaper board end includes:
receiving the connection and the message flow sent by the newspaper disc end by utilizing a pre-established TCP (Transmission Control Protocol ) server;
the TCP server is established by using an ASIO analog exchange gateway.
Wherein, ASIO is a cross-platform C++ development packet used for processing network and low-level I/O (Input/Output) programming, and provides a continuous asynchronous model for developers through an advanced C++ method.
Further, after receiving the connection and the message flow sent by the disc reporting end by using the pre-established TCP server, registering the message processing handle and the abnormal event processing handle for later use in message processing.
In this embodiment, the time delay dotting is performed every time a message in the message stream is received, providing a data basis for subsequent computing system time delays.
S12, performing deserialization processing on the message flow by using a first thread to obtain service messages, and storing the service messages into a lock-free message queue.
The service message is stored in a lock-free message queue to wait for processing, so that when a put or push operation is executed, the spin lock can ensure that a CPU (Central Processing Unit, a central processing unit) still operates in a current thread, switching of the CPU can not occur, and processing delay is reduced.
In this embodiment, the performing, by using the first thread, the deserializing processing on the message flow to obtain the service message includes:
for each message in the message stream, acquiring a message header and a message body of the message by using the first thread;
analyzing the message header to obtain the service message type and the message length of the message;
invoking a service message anti-sequence processing interface corresponding to the service message type;
and reading the fields from the message body according to the message length by utilizing the service message anti-sequence processing interface, and sequentially and anti-serializing the read fields to the corresponding message object fields to obtain the service message corresponding to the message.
Wherein, each message in the message stream is a binary message, and consists of three parts, including: message header, traffic message body, tail checksum.
Specifically, in the process of reverse serialization, a message header is analyzed first, which service message type is analyzed, then a corresponding service message reverse-sequence processing interface is obtained through the service message type, a binary service message body is taken out according to the length of the message body in the message header, and one field of the binary message body are deserialized to a specific object field through the service message reverse-sequence processing interface, so that the service message corresponding to the message is obtained.
S13, obtaining a corresponding message processor from the at least one message processor by using a second thread to process the service message in the message queue, and obtaining a response return message.
In this embodiment, the obtaining, by the second thread, the corresponding message processor from the at least one message processor, to process the service message in the message queue, and obtaining the response report message includes:
for each service message in the message queue, acquiring a message processor corresponding to a message number of each service message from the at least one message processor by utilizing the second thread;
calling a processing function of a corresponding message processor to process each service message to obtain a response message and a return message corresponding to each service message;
And assembling the response message and the return message corresponding to each service message to obtain the response return message.
Specifically, the message number of the service message is confirmed when the header in the reverse serialization process is resolved, and in the process of assembling the response message and the return message, the response message and the return message are assembled according to the configuration file of the distributed baffle for the response and return transaction configuration, for example: returning forward report, confirmation, refusal, partial deals, complete deals, multiple deals, etc. The assembled response and return messages are assigned according to the message structure and fields of the response and return defined in the exchange document.
S14, the response return message is sent to the newspaper disc end, and the sending time delay dotting information of the response return message is recorded.
Specifically, the assembled response and return message is returned, and finally, the serialized response and return message binary stream is sent and returned to the newspaper disc end through the sending interface of the TCP server end.
And performing delay dotting when the message is sent so as to perform delay calculation of the transaction process based on the recorded delay dotting.
And S15, storing the receiving time delay dotting information of each message and the sending time delay dotting information of the response report message into a time delay processing queue.
In this embodiment, the received delay dotting information of each message and the sending delay dotting information of the response report message are stored in a delay processing queue, so that the delay processing queue is convenient for performing related delay calculation subsequently.
S16, the data in the delay processing queue are persisted to a file by using a third thread, and a target file is obtained.
Specifically, after the target file is obtained, the target file can be provided for the outside to process and analyze the performance of the distributed baffle, or the target file is used for calculating the overall uplink time delay and the overall downlink time delay of the outside.
S17, generating a transaction test result according to the target file.
Specifically, the transaction delay may be calculated based on the target file, and the performance of each system in the transaction process may be determined according to the calculated transaction delay, which is not described herein.
In this embodiment, the method further includes:
when a modification instruction of the configuration file of the distributed baffle is received, determining a transaction strategy, an order transaction mode and an additional working mode according to the modification instruction;
wherein the additional operation mode includes: a filtering mode, a synchronous return mode, a report polling mode, a real-time matching mode, an automatic matching mode and a exchange state switching mode.
Specifically, after determining the transaction policy, the order transaction mode and the additional working mode according to the modification instruction, the method further includes:
when the repeat filtering mode is started, acquiring a repeat detection rule of each trade market, and detecting whether the current order is a repeat order according to the repeat detection rule of each trade market; when the current order is the repeated order, not processing the current order or returning a refusal response signal to the current order; for example: the market A takes a reporting transaction unit sub-transmission_ pbu _id and a newspaper disc contract number cl_ord_id as a combination to judge whether repeated orders exist, if so, the market A does not process or returns a specific refusal response signal, and the purpose is to simulate the actual processing scene of the exchange. For part of test scenes of the transaction system, a scene of refused bill under the heavy bill needs to be tested, and whether the transaction system can normally process or not can be tested;
when the synchronous return mode is started, caching all processed orders and response return messages; when a synchronous report request sent by the disc reporting end is received, breakpoint continuous transmission is carried out on the order and the response report message stored in the cache;
When the newspaper disc polling mode is started, modifying partition configuration of the distributed baffle by using the configuration file, and simulating partitions or transaction units of each exchange when the distributed baffle is started;
when the exchange state switching mode is started, determining state switching time according to the configuration file, and performing state switching according to the state switching time; wherein the states comprise a closed state, a pre-open state and an open state;
the real-time matching mode corresponds to a scene of matching according to a buying and selling order when simulating collective bidding or continuous bidding; the automatic matching mode corresponds to a scene that matches on demand. For example: the real-time matching mode is utilized to simulate the collective bidding stage in the time period of 9:15-9:25, the purchase and sale commission is stored in the commission book, the commission of the buyer and the seller is simulated and matched in quantity and price in continuous bidding, and the transaction result is returned, namely, if the simulated collective bidding or the continuous bidding is expected to be matched according to the purchase and sale order, the real-time matching mode can be selected; the automatic matching mode may be selected when it is desired to complete a transaction according to its configuration parameters in the configuration file (e.g., whether to return an acknowledgement, whether to return a return to the transaction, refuse a proportion, etc.).
It should be noted that, each mode of the distributed barrier may determine whether to open by modifying a configuration file. Multiple complex order matching strategies are supported through different configurations, and order matching requirements under different trading platforms and different trading scenes can be supported.
In this embodiment, the method further includes:
when the distributed baffle is started, determining an IP address (Internet Protocol Address ), a port, a database name and a table name according to the configuration file; determining a newspaper disc library corresponding to the newspaper disc end based on the IP address, the port, the database name and the table name; continuously detecting the connection state of the distributed baffle and the newspaper disc library by using a detection thread; when the connection state is unconnected, the connection between the distributed baffle and the newspaper disc library is initiated; when the connection state is changed, recording the changed connection state, and updating the connection state of the distributed baffle and the newspaper disc library by using the recorded connection state; wherein the connection state comprises unconnected, connected and reconnection states;
when the connection state of the distributed baffle and the newspaper disc library is connected, continuously polling traversing messages from the newspaper disc library by using a message reading thread to conduct transaction processing, and writing the response return messages obtained after the processing back to the newspaper disc library.
The distributed baffle in the embodiment can process a large number of orders in unit time under a high concurrency scene, restore an actual transaction scene, simulate a large number of complex transaction scenes in actual transaction according to custom configuration, accurately judge the performance condition of the system through a lasting time delay file, and further assist in carrying out more accurate transaction test.
According to the technical scheme, on one hand, the method is applied to the distributed baffle constructed based on C++, and the characteristic based on C++ can ensure a lower time delay level; on one hand, recording the receiving time delay dotting information of each message in the message stream, recording the sending time delay dotting information of the response return message, and lasting to a file to assist in judging the performance of each system in the transaction process; on the other hand, different processes are started to process different processes respectively, and different business messages are processed respectively by utilizing different message processors, so that a large number of orders can be processed simultaneously, and the method is suitable for a high-concurrency transaction scene.
FIG. 2 is a functional block diagram of a preferred embodiment of the distributed baffle-based transaction testing device of the present invention. The distributed barrier-based transaction testing device 11 includes a registration unit 110, a recording unit 111, a processing unit 112, a storage unit 113, a persistence unit 114, and a generation unit 115. The module/unit referred to in the present invention refers to a series of computer program segments, which are stored in a memory, capable of being executed by a processor and of performing a fixed function. In the present embodiment, the functions of the respective modules/units will be described in detail in the following embodiments.
The transaction testing device 11 based on the distributed baffle operates on the distributed baffle constructed based on C++, and comprises:
the registering unit 110 is configured to register at least one message processor when receiving a transaction test request in a high concurrency low latency scenario;
the recording unit 111 is configured to receive a connection and a message stream sent by a disc reporting end, and record reception delay dotting information of each message in the message stream;
the processing unit 112 is configured to perform deserialization processing on the message flow by using a first thread to obtain a service message, and store the service message in a lock-free message queue;
the processing unit 112 is further configured to obtain, by using a second thread, a corresponding message processor from the at least one message processor, and process the service message in the message queue to obtain a response report message;
the recording unit 111 is further configured to send the response report message to the disc reporting end, and record transmission delay dotting information of the response report message;
the storage unit 113 is configured to store, in a delay processing queue, the received delay dotting information of each message and the sending delay dotting information of the response report message;
The persistence unit 114 is configured to persistence the data in the delay processing queue to a file by using a third thread to obtain a target file;
the generating unit 115 is configured to generate a transaction test result according to the target file.
According to the technical scheme, on one hand, the method is applied to the distributed baffle constructed based on C++, and the characteristic based on C++ can ensure a lower time delay level; on one hand, recording the receiving time delay dotting information of each message in the message stream, recording the sending time delay dotting information of the response return message, and lasting to a file to assist in judging the performance of each system in the transaction process; on the other hand, different processes are started to process different processes respectively, and different business messages are processed respectively by utilizing different message processors, so that a large number of orders can be processed simultaneously, and the method is suitable for a high-concurrency transaction scene.
FIG. 3 is a schematic diagram of a computer device for implementing a transaction testing method based on distributed baffles according to a preferred embodiment of the present invention.
The computer device 1 may comprise a memory 12, a processor 13 and a bus, and may further comprise a computer program stored in the memory 12 and executable on the processor 13, such as a distributed barrier-based transaction test program.
It will be appreciated by those skilled in the art that the schematic diagram is merely an example of the computer device 1 and does not constitute a limitation of the computer device 1, the computer device 1 may be a bus type structure, a star type structure, the computer device 1 may further comprise more or less other hardware or software than illustrated, or a different arrangement of components, for example, the computer device 1 may further comprise an input-output device, a network access device, etc.
It should be noted that the computer device 1 is only used as an example, and other electronic products that may be present in the present invention or may be present in the future are also included in the scope of the present invention by way of reference.
The memory 12 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 12 may in some embodiments be an internal storage unit of the computer device 1, such as a removable hard disk of the computer device 1. The memory 12 may in other embodiments also be an external storage device of the computer device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the computer device 1. Further, the memory 12 may also include both an internal storage unit and an external storage device of the computer device 1. The memory 12 may be used not only for storing application software installed in the computer device 1 and various types of data, such as codes of a distributed barrier-based transaction test program, etc., but also for temporarily storing data that has been output or is to be output.
The processor 13 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, a combination of various control chips, and the like. The processor 13 is a Control Unit (Control Unit) of the computer device 1, connects the respective components of the entire computer device 1 using various interfaces and lines, executes various functions of the computer device 1 and processes data by running or executing programs or modules stored in the memory 12 (for example, executing a distributed barrier-based transaction test program, etc.), and calls data stored in the memory 12.
The processor 13 executes the operating system of the computer device 1 and various types of applications installed. The processor 13 executes the application program to implement the steps of the various distributed baffle-based transaction testing method embodiments described above, such as the steps shown in fig. 1.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing the specified functions, which instruction segments describe the execution of the computer program in the computer device 1. For example, the computer program may be divided into a registration unit 110, a recording unit 111, a processing unit 112, a storage unit 113, a persistence unit 114, a generation unit 115.
The integrated units implemented in the form of software functional modules described above may be stored in a computer readable storage medium. The software functional module is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor (processor) to execute portions of the distributed barrier-based transaction testing method according to the embodiments of the present invention.
The modules/units integrated in the computer device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on this understanding, the present invention may also be implemented by a computer program for instructing a relevant hardware device to implement all or part of the procedures of the above-mentioned embodiment method, where the computer program may be stored in a computer readable storage medium and the computer program may be executed by a processor to implement the steps of each of the above-mentioned method embodiments.
Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory, or the like.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created from the use of blockchain nodes, and the like.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one straight line is shown in fig. 3, but not only one bus or one type of bus. The bus is arranged to enable a connection communication between the memory 12 and at least one processor 13 or the like.
Although not shown, the computer device 1 may further comprise a power source (such as a battery) for powering the various components, preferably the power source may be logically connected to the at least one processor 13 via a power management means, whereby the functions of charge management, discharge management, and power consumption management are achieved by the power management means. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The computer device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described in detail herein.
Further, the computer device 1 may also comprise a network interface, optionally comprising a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the computer device 1 and other computer devices.
The computer device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the computer device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
Fig. 3 shows only a computer device 1 with components 12-13, it being understood by those skilled in the art that the structure shown in fig. 3 is not limiting of the computer device 1 and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
In connection with fig. 1, the memory 12 in the computer device 1 stores a plurality of instructions to implement a distributed barrier-based transaction testing method, the processor 13 being executable to implement:
registering at least one message processor when a transaction test request in a high concurrency low latency scenario is received;
receiving connection and message stream sent by a newspaper disc end, and recording receiving time delay dotting information of each message in the message stream;
performing deserialization processing on the message flow by using a first thread to obtain service messages, and storing the service messages into a lock-free message queue;
acquiring a corresponding message processor from the at least one message processor by using a second thread to process the service message in the message queue to obtain a response return message;
Transmitting the response return message to the disc reporting end, and recording the transmission delay dotting information of the response return message;
storing the receiving time delay dotting information of each message and the sending time delay dotting information of the response report message into a time delay processing queue;
the data in the delay processing queue are persisted to a file by using a third thread, and a target file is obtained;
and generating a transaction test result according to the target file.
Specifically, the specific implementation method of the above instructions by the processor 13 may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
The data in this case were obtained legally.
In the several embodiments provided in the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The invention is operational with numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. The units or means stated in the invention may also be implemented by one unit or means, either by software or hardware. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

1. The transaction testing method based on the distributed baffle is characterized by being applied to the distributed baffle constructed based on C++, and comprises the following steps of:
registering at least one message processor when a transaction test request in a high concurrency low latency scenario is received;
receiving connection and message stream sent by a newspaper disc end, and recording receiving time delay dotting information of each message in the message stream;
performing deserialization processing on the message flow by using a first thread to obtain service messages, and storing the service messages into a lock-free message queue;
Acquiring a corresponding message processor from the at least one message processor by using a second thread to process the service message in the message queue to obtain a response return message;
transmitting the response return message to the disc reporting end, and recording the transmission delay dotting information of the response return message;
storing the receiving time delay dotting information of each message and the sending time delay dotting information of the response report message into a time delay processing queue;
the data in the delay processing queue are persisted to a file by using a third thread, and a target file is obtained;
and generating a transaction test result according to the target file.
2. The distributed barrier-based transaction testing method of claim 1, wherein registering at least one message processor comprises:
acquiring position data of a processing function of each message processor;
generating a function pointer according to the position data of the processing function of each message processor, and determining the function pointer as a message number;
generating an array by taking the message number as an array subscript;
wherein the message number corresponds to the service message.
3. The distributed barrier-based transaction testing method of claim 1, wherein receiving the connection and message stream sent by the newspaper server comprises:
Receiving connection and message flow sent by the newspaper disc end by using a pre-established TCP server;
the TCP server is established by using an ASIO analog exchange gateway.
4. The distributed barrier-based transaction testing method of claim 1, wherein the de-serializing the message stream with the first thread to obtain the service message comprises:
for each message in the message stream, acquiring a message header and a message body of the message by using the first thread;
analyzing the message header to obtain the service message type and the message length of the message;
invoking a service message anti-sequence processing interface corresponding to the service message type;
and reading the fields from the message body according to the message length by utilizing the service message anti-sequence processing interface, and sequentially and anti-serializing the read fields to the corresponding message object fields to obtain the service message corresponding to the message.
5. The distributed barrier-based transaction testing method of claim 1, wherein the obtaining, by the second thread, a corresponding message processor from the at least one message processor, the service message in the message queue for processing, and obtaining a response report message includes:
For each service message in the message queue, acquiring a message processor corresponding to a message number of each service message from the at least one message processor by utilizing the second thread;
calling a processing function of a corresponding message processor to process each service message to obtain a response message and a return message corresponding to each service message;
and assembling the response message and the return message corresponding to each service message to obtain the response return message.
6. The distributed baffle-based transaction testing method of claim 1, further comprising:
when a modification instruction of the configuration file of the distributed baffle is received, determining a transaction strategy, an order transaction mode and an additional working mode according to the modification instruction;
wherein the additional operation mode includes: a filtering mode, a synchronous return mode, a report polling mode, a real-time matching mode, an automatic matching mode and a exchange state switching mode.
7. The distributed barrier-based transaction testing method of claim 6, wherein after determining a transaction strategy, an order placement mode, an additional mode of operation according to the modification instructions, the method further comprises:
When the repeat filtering mode is started, acquiring a repeat detection rule of each trade market, and detecting whether the current order is a repeat order according to the repeat detection rule of each trade market; when the current order is the repeated order, not processing the current order or returning a refusal response signal to the current order;
when the synchronous return mode is started, caching all processed orders and response return messages; when a synchronous report request sent by the disc reporting end is received, breakpoint continuous transmission is carried out on the order and the response report message stored in the cache;
when the newspaper disc polling mode is started, modifying partition configuration of the distributed baffle by using the configuration file, and simulating partitions or transaction units of each exchange when the distributed baffle is started;
when the exchange state switching mode is started, determining state switching time according to the configuration file, and performing state switching according to the state switching time; wherein the states comprise a closed state, a pre-open state and an open state;
the real-time matching mode corresponds to a scene of matching according to a buying and selling order when simulating collective bidding or continuous bidding; the automatic matching mode corresponds to a scene that matches on demand.
8. The distributed baffle-based transaction testing method of claim 6, further comprising:
when the distributed baffle is started, determining an IP address, a port, a database name and a table name according to the configuration file; determining a newspaper disc library corresponding to the newspaper disc end based on the IP address, the port, the database name and the table name; continuously detecting the connection state of the distributed baffle and the newspaper disc library by using a detection thread; when the connection state is unconnected, the connection between the distributed baffle and the newspaper disc library is initiated; when the connection state is changed, recording the changed connection state, and updating the connection state of the distributed baffle and the newspaper disc library by using the recorded connection state; wherein the connection state comprises unconnected, connected and reconnection states;
when the connection state of the distributed baffle and the newspaper disc library is connected, continuously polling traversing messages from the newspaper disc library by using a message reading thread to conduct transaction processing, and writing the response return messages obtained after the processing back to the newspaper disc library.
9. A computer device, the computer device comprising:
A memory storing at least one instruction; a kind of electronic device with high-pressure air-conditioning system
A processor executing instructions stored in the memory to implement the distributed barrier-based transaction testing method of any one of claims 1 to 8.
10. A computer-readable storage medium, characterized by: the computer readable storage medium having stored therein at least one instruction for execution by a processor in a computer device to implement the distributed barrier-based transaction testing method of any one of claims 1 to 8.
CN202310917688.9A 2023-07-25 2023-07-25 Transaction testing method, device and medium based on distributed baffle Active CN116662208B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310917688.9A CN116662208B (en) 2023-07-25 2023-07-25 Transaction testing method, device and medium based on distributed baffle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310917688.9A CN116662208B (en) 2023-07-25 2023-07-25 Transaction testing method, device and medium based on distributed baffle

Publications (2)

Publication Number Publication Date
CN116662208A CN116662208A (en) 2023-08-29
CN116662208B true CN116662208B (en) 2023-09-26

Family

ID=87715604

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310917688.9A Active CN116662208B (en) 2023-07-25 2023-07-25 Transaction testing method, device and medium based on distributed baffle

Country Status (1)

Country Link
CN (1) CN116662208B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102904820A (en) * 2012-09-25 2013-01-30 上海证券交易所 Extensible traffic control data interaction method and system
CN108874562A (en) * 2018-06-21 2018-11-23 北京顺丰同城科技有限公司 Distributed high concurrent message queue supplying system
CN113297037A (en) * 2021-07-27 2021-08-24 华锐分布式(北京)技术有限公司 Distributed system tracking monitoring method, system and medium
CN115713395A (en) * 2022-11-25 2023-02-24 上海品顺信息科技有限公司 Flink-based user wind control management method, device and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11995614B2 (en) * 2019-06-12 2024-05-28 Ambry Hills Technologies, Llc Methods, devices, and systems for capturing content from client transaction related messages on a client device by a third party

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102904820A (en) * 2012-09-25 2013-01-30 上海证券交易所 Extensible traffic control data interaction method and system
CN108874562A (en) * 2018-06-21 2018-11-23 北京顺丰同城科技有限公司 Distributed high concurrent message queue supplying system
CN113297037A (en) * 2021-07-27 2021-08-24 华锐分布式(北京)技术有限公司 Distributed system tracking monitoring method, system and medium
CN115713395A (en) * 2022-11-25 2023-02-24 上海品顺信息科技有限公司 Flink-based user wind control management method, device and equipment

Also Published As

Publication number Publication date
CN116662208A (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN109582569A (en) Lending platforms test method, device, terminal device and readable storage medium storing program for executing
CN116701233B (en) Transaction system testing method, equipment and medium based on high concurrency report simulation
CN116743885B (en) UDP engine-based data transmission method, device, equipment and medium
CN116755637B (en) Transaction data storage method, device, equipment and medium
CN115731047B (en) Batch order processing method, equipment and medium
CN116501610B (en) Method, device, equipment and medium for testing market transaction system
CN108230149A (en) Acceleration financial transaction system and method based on SOC FPGA
CN116823437A (en) Access method, device, equipment and medium based on configured wind control strategy
CN116662208B (en) Transaction testing method, device and medium based on distributed baffle
CN114816371B (en) Message processing method, device, equipment and medium
CN113032543B (en) Dialogue diagnosis method, device, equipment and medium based on stack structure
CN116414699B (en) Operation and maintenance testing method, device, equipment and medium
CN116630048B (en) Trading method, device, equipment and medium based on futures quotation K line
CN116483747B (en) Quotation snapshot issuing method, device, equipment and medium
CN118014696B (en) Transaction order preheating method, device, equipment and medium
CN115964307B (en) Automatic test method, device, equipment and medium for transaction data
CN116225789B (en) Transaction system backup capability detection method, device, equipment and medium
CN116414366B (en) Middleware interface generation method, device, equipment and medium
CN115277859B (en) Request scheduling method, device, equipment and medium
CN115934576B (en) Test case generation method, device, equipment and medium in transaction scene
CN115225489B (en) Dynamic control method for queue service flow threshold, electronic equipment and storage medium
CN117316359B (en) Blood detection process tracking method, device, equipment and medium
CN112651778B (en) User behavior prediction method, device, equipment and medium
CN116506333B (en) Transaction system production inversion detection method and equipment
CN117830010A (en) Order state consistency detection method, device, 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
GR01 Patent grant
GR01 Patent grant