[go: up one dir, main page]

CN112199218A - A pressure measurement method, device, electronic device and storage medium - Google Patents

A pressure measurement method, device, electronic device and storage medium Download PDF

Info

Publication number
CN112199218A
CN112199218A CN202011159880.9A CN202011159880A CN112199218A CN 112199218 A CN112199218 A CN 112199218A CN 202011159880 A CN202011159880 A CN 202011159880A CN 112199218 A CN112199218 A CN 112199218A
Authority
CN
China
Prior art keywords
request message
dyeing
mark
pressure measurement
request
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
CN202011159880.9A
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 Baijia Technology Group Co ltd
Original Assignee
Beijing Baijia Technology Group 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 Baijia Technology Group Co ltd filed Critical Beijing Baijia Technology Group Co ltd
Priority to CN202011159880.9A priority Critical patent/CN112199218A/en
Publication of CN112199218A publication Critical patent/CN112199218A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/547Messaging middleware

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • General Factory Administration (AREA)

Abstract

The embodiment of the application provides a pressure measurement method and device, electronic equipment and a storage medium, and relates to the technical field of pressure measurement. The method comprises the following steps: receiving a request message sent by a client; intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message; correspondingly transmitting the dyeing mark in the process of executing the request message in a cross-thread and/or cross-process manner and generating the pressure measurement flow; the method has the advantages that the pressure measurement flow generated by the request message is stored in the shadow table, the dyeing data and the production data are distinguished through the dyeing marks and are stored in an isolated mode, and the problems that dirty data generated by pressure measurement in the production table needs to be manually cleaned in the existing method, and a large amount of workload is increased for pressure measurement personnel are solved.

Description

Pressure measurement method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of pressure measurement technologies, and in particular, to a pressure measurement method, an apparatus, an electronic device, and a storage medium.
Background
In order to deal with large-scale traffic access, modern enterprise application services need to frequently perform pressure tests to evaluate traffic carrying capacity of the application services, and when the application services are subjected to the pressure tests, pressure test data are generally constructed through scripts, and then the pressure tests are performed through a pressure test engine.
The existing pressure measurement method not only generates a large amount of dirty data in the pressure measurement process, but also needs to manually remove the dirty data generated by pressure measurement in a production table after the pressure measurement is finished, so that a large amount of workload is increased for pressure measurement personnel.
Disclosure of Invention
An object of the embodiment of the application is to provide a pressure measurement method, a pressure measurement device, electronic equipment and a storage medium, dyeing data and production data are distinguished through dyeing marks and are stored in an isolated mode, and the problems that dirty data generated in pressure measurement in a production table needs to be manually cleaned in the existing method, and a large amount of workload is increased for pressure measurement personnel are solved.
The embodiment of the application provides a pressure measurement method, which comprises the following steps:
receiving a request message sent by a client;
intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message;
correspondingly transmitting the dyeing mark in the process of executing the request message in a cross-thread and/or cross-process manner and generating the pressure measurement flow;
and storing the pressure measurement flow generated by the request message into a shadow table.
In the implementation process, the dyeing mark is added in the pressure measurement flow, and the dyeing mark is transmitted across threads and across threads, so that full-link transparent transmission is realized, and the dyeing data and the production data are isolated (the dyeing data are dynamically stored in a shadow table, and the production data are stored in a production table), so that the operation of clearing dirty data in the production table after pressure measurement is completed by a pressure measurement worker each time is avoided, the working time is saved, the efficiency is improved, and the problems that the dirty data generated by pressure measurement in the production table needs to be manually cleared away by the existing method, and a large amount of workload is increased for the pressure measurement worker are solved; and the dynamic isolation of the production data and the dyeing data is realized through the dyeing marks, and the dyeing data does not influence the production data, so that the pressure measurement can be carried out in an online cluster environment at any time without influencing the normal operation of actual services.
Further, the intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message includes:
intercepting through a preset interception locus before the thread pool acquires a method for executing asynchronous calling by the thread so as to transmit a dyeing mark of the current thread to a sub-thread;
adding the dyeing indicia to a thread context of the child thread prior to execution of the child thread.
In the implementation process, the dyeing mark of the current thread is transmitted to the sub-thread, and the dyeing mark is added to the sub-thread, so that the cross-thread transmission of the dyeing mark is realized.
Further, the intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message includes:
intercepting through a preset interception site before the current service sends an http cross-process request to obtain a request object;
adding a dyeing mark of a current thread in a current service into a request header of the request object to transfer the dyeing mark into a downstream service;
after the downstream service receives the request, acquiring a dyeing mark in the request header through an interception site preset in the downstream service;
adding the dyeing token to a thread context of the downstream service.
In the implementation process, when the services are called in a http cross-process mode, the dyeing mark is transmitted from the current service to the downstream service in a cross-process mode through the interception site, and the http cross-process transmission of the dyeing mark is achieved.
Further, the intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message includes:
intercepting through a preset interception site before a current service sends rpc a cross-process request to obtain rpc a request;
adding the dyeing marks of the current thread in the current service to rpc requested attributes to deliver the dyeing marks to the downstream service;
after the downstream service receives the rpc request, acquiring the dyeing marks in the attributes through the preset interception sites in the downstream service;
adding the dyeing token to a thread context of the downstream service.
In the implementation process, when rpc cross-process calling is carried out between services, cross-process transmission of the dyeing marker from the current service to the downstream service is realized through a preset interception site, and cross-process transmission of the dyeing marker rpc is realized.
Further, the intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message includes:
before asynchronous message sending, obtaining the message through a preset interception site;
adding a dyeing mark of a current thread of a current service to a header of the message;
after the downstream service receives the message, acquiring the dyeing mark from a header of the message through an interception site preset in the downstream service;
adding the dyeing token to a thread context of the downstream service.
In the implementation process, before the asynchronous message is sent, the message is acquired through the interception site, and the dyeing mark of the current thread is stored in the header of the message, so that the downstream service acquires the message and then simultaneously obtains the dyeing mark, and the cross-process transmission of the message of the dyeing mark is realized.
Further, the storing the piezometric flow generated by the request message into a shadow table includes:
before the dyeing data corresponding to the pressure measurement flow are stored, modifying the table name of the sql execution statement into a shadow table name, and storing the dyeing data into a shadow table.
In the implementation process, before the dyeing data is stored, the table name of the sql execution statement is dynamically modified into the shadow table name, and the dyeing data is automatically stored in the shadow table, so that the dyeing data is isolated from the production data, and the dynamic isolation of the production data and the dyeing data is realized.
Further, when the cache data is called, whether the data corresponding to the current thread contains a dyeing mark is judged;
if yes, adding a setting character string to the key value parameter to distinguish dyeing data from production data.
In the implementation process, dyeing data and production data are distinguished through the dyeing marks, execution parameters corresponding to the dyeing data are modified, and set character strings are added to the key value parameters to distinguish the dyeing data from the production data.
The embodiment of the present application further provides a pressure measurement device, and the device includes:
the message receiving module is used for receiving a request message sent by a client;
the mark acquisition module is used for intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message;
the dyeing mark transmission module is used for correspondingly transmitting the dyeing mark in the process of executing the request message in a cross-thread and/or cross-process manner and generating the pressure measurement flow;
and the storage module is used for storing the pressure measurement flow generated by the request message into a shadow table.
In the process, the pressure measurement flow is marked by the dyeing mark, the full-link transparent transmission of the cross process and the cross line is realized, the dyeing data and the production data are isolated (the dyeing data are stored in the shadow table, and the production data are stored in the production table), the operation of clearing dirty data in the production table after the pressure measurement is finished by the pressure measurement personnel at every time is avoided, the working time is saved, the efficiency is improved, the problem that the dirty data generated by the pressure measurement in the production table needs to be manually cleared by the existing method is solved, and a large amount of workload is increased for the pressure measurement personnel.
An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to enable the computer device to execute the pressure measurement method described in any one of the above.
An embodiment of the present application further provides a readable storage medium, where computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the method for pressure measurement is performed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a flowchart of a pressure measurement method according to an embodiment of the present disclosure;
fig. 2 is a block diagram of an implementation of a pressure measurement method provided in an embodiment of the present application;
FIG. 3 is a flowchart of cross-thread transfer provided by an embodiment of the present application;
FIG. 4 is a flowchart of the http cross-process dyed mark delivery provided by an embodiment of the present application;
FIG. 5 is a flow chart illustrating rpc cross-process dyed tag delivery provided by an embodiment of the present application;
FIG. 6 is a flowchart of cross-process dyed mark delivery in message middle provided by an embodiment of the present application;
FIG. 7 is a flowchart of a process for storing staining data provided by an embodiment of the present application;
fig. 8 is a block diagram of a pressure measurement device according to an embodiment of the present disclosure;
fig. 9 is a specific structural block diagram of a pressure measurement device according to an embodiment of the present application.
Icon:
100-a message receiving module; 200-a marker acquisition module; 300-a staining marker transfer module; 310-a cross-thread transfer module; 311-child thread marking module; 320-request object acquisition module; 321-a first marker adding module; 322-a first indicia acquisition module; 323-a second mark adding module; 330-rpc request acquisition module; 331-a third tag addition module; 332-a second marker acquisition module; 333-a fourth tag addition module; 340-a message acquisition module; 341-fifth tag addition module; 342-a third marker acquisition module; 343-a sixth tag addition module; 400-a storage module; 401-a judging module; 402-staining data saving module.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Example 1
Referring to fig. 1, fig. 1 is a flowchart of a pressure measurement method according to an embodiment of the present disclosure. The method is used for performing a pressure test on an application service, and is applied to a server, for example, as one implementation manner, the method may be a plug-in which a dyeing mark in a request is transmitted in a full link for pressure test, and the use of the plug-in has the advantages that the function of the application service itself is not changed or affected while the application service is subjected to the pressure test, and the convenience of the use of the application service is improved, as shown in fig. 2, the method is an implementation block diagram of the pressure test method according to the embodiment of the present application, and specifically may include the following steps:
step S100: receiving a request message sent by a client;
illustratively, before a request message is sent by a client, the request message needs to be preprocessed to have a pressure measurement mark; the normal pressure measurement request is based on the http request, and a pressure-measurement mark (dyeing-mark) key value pair (bag-flow) is added to the http request to mark the request message as a pressure measurement flow, specifically, identification information such as a dyeing mark (usually, a key value pair) is usually added to a request header of the http request; therefore, when the client terminal sends the request message, the received request message is the request message with the coloring mark.
Step S200: intercepting the request message through a preset interception site and acquiring at least one request message with a dyeing mark from the request message;
step S300: correspondingly transmitting the dyeing mark in the process of executing the request message in a cross-thread and/or cross-process manner and generating the pressure measurement flow;
the interception site is responsible for acquiring whether the request message has the dyeing mark or not, if so, the dyeing mark is placed in the thread context, and is acquired from the thread context and delivered to the cross-process request or the sub-thread when the next cross-process or cross-thread occurs, so that the dyeing mark is continuously transmitted, and finally the purpose of full-link transmission of the dyeing mark is achieved.
The interception site is a predefined universal point, for example, an http request or a certain name can be used as the interception site, in a specific application process, interception starts when the predefined universal point is met, and the selection of the interception site is one of the methods inevitably called by the thread pool starting sub-thread execution, so that the interception site does not need to be set for each service independently, and the method has universality.
In the cross-thread and/or cross-process execution process of the request message, the dyeing mark in the request message is obtained through the interception site, and the dyeing mark is correspondingly transmitted in a cross-thread and/or cross-process mode, and the process does not affect the execution of the request message, so that the normal operation of production data is not affected.
The application is based on Java _ agent technology, the application service is enhanced without intruding by mounting a software package (agent plugin package) when the application service is started, the application service is unaware, when a flow request reaches service processing, a processing method corresponding to a method-level interception service container is intercepted, specifically, a method for receiving a processing request by tomcat (Java Web server) is intercepted, and a dyeing mark is placed in the context of a processing thread before the method is executed, so that the marking of the current thread is realized; in the processing process of the request message after adding the coloring mark, there may be a cross-thread processing flow within the same service, or a cross-service processing flow may occur, or both, where, as shown in fig. 3, the cross-thread transfer is a flowchart of cross-thread transfer, and the cross-thread transfer specifically may include:
step S310: intercepting through a preset interception locus before the thread pool acquires a method for executing asynchronous calling by the thread so as to transmit a dyeing mark of the current thread to a sub-thread;
step S311: a dyeing marker is added to the thread context of the child thread prior to its execution.
The dyed tag is added to the thread context of the sub-thread, ensuring cross-thread transfer of the dyed tag.
Illustratively, based on two thread pools common to java: the method comprises the steps that a thread pool of a jdk (Java Development kit) self-carrying and a thread pool packaged by a Spring framework realize interception before a method for executing asynchronous calling by a thread is obtained, a dyeing mark in the thread context of the current thread is transferred to a sub-thread, and the dyeing mark is stored in the thread context of the sub-thread before the sub-thread is executed, so that cross-thread transfer of the dyeing mark is realized.
For implementation of cross-process Transfer, for example, the application service cross-process Call mainly includes a http (HyperText Transfer Protocol) cross-process, rpc (Remote Procedure Call Protocol) cross-process, a message middle cross-process, and the like, where as shown in fig. 4, the http cross-process Call mainly includes the following steps:
step S320: intercepting through a preset interception site before the current service sends an http cross-process request to obtain a request object;
step S321: adding the dyeing mark of the current thread in the current service to the request header of the request object so as to transfer the dyeing mark to the downstream service;
step S322: after receiving the request by the downstream service, acquiring a dyeing mark in a request header through an interception site preset in the downstream service;
step S323: a dyeing marker is added to the thread context of the downstream service.
When http cross-process calling is carried out between services, illustratively, when a request is sent by an http client technology, a request object is acquired by setting an interception site before the current service sends a cross-process request, a dyeing mark in the context of the current thread is set in a request header of the request object, and the dyeing mark is transmitted to a downstream service; before processing the request, the downstream service acquires the dyeing mark from the request header through the interception site and puts the dyeing mark into the context of the current thread of the downstream service, so that the dyeing mark is transferred from the upstream service to the downstream service in a cross-process manner.
As shown in fig. 5, rpc flowchart for cross-process dye marker delivery, rpc cross-process call between services mainly includes the following steps:
step S330: intercepting through a preset interception site before a current service sends rpc a cross-process request to obtain rpc a request;
step S331: adding the dyeing marks of the current thread in the current service to the attributes requested by rpc to deliver the dyeing marks to the downstream service;
step S232: after the downstream service receives rpc request, acquiring dyeing marks in attributes through the preset interception sites in the downstream service;
step S333: a dyeing marker is added to the thread context of the downstream service.
When rpc cross-process calling is carried out between services, for example, rpc calling is realized through grpc and dubbo and other technologies, and by setting an interception site, before the current service sends a cross-process request, a dyeing mark in the current thread context is put into attributes (attachment) of a rpc request; the downstream service puts the dyeing marks in the attributes into the context of the processing request thread of the downstream service when passing through the interception site before processing the received rpc request, thereby realizing that the dyeing marks are transmitted from the upstream service to the downstream service in a cross-process manner.
As shown in fig. 6, which is a flowchart of the dyed mark transfer of inter-message cross-process, inter-message cross-process invocation between services mainly includes the following steps:
step S340: before asynchronous message sending, obtaining a message through a preset interception site;
step S341: adding a dyeing mark of a current thread of a current service to a header of a message;
step S342: after receiving the message by the downstream service, acquiring the dyeing mark from a header of the message through an interception site preset in the downstream service;
step S343: a dyeing marker is added to the thread context of the downstream service.
In the process of asynchronous message sending, the service commonly used message middleware comprises kafka, rockmq, activeMQ and the like, and the message middleware is a middleware technology for realizing asynchronous cross-process message transmission. Before sending the message, acquiring the message through the interception site, storing the dyeing mark in the context of the current thread in the header of the message, and before receiving the message, the downstream service acquires the dyeing mark from the header of the message through the interception site of the plug-in and puts the dyeing mark into the context of the downstream processing thread, so that the dyeing mark is transferred to the downstream service from the upstream service in a cross-process manner.
Through the transmission of the cross-thread and cross-process dyeing marks, the whole service cluster can transmit the pressure measurement marks, and the dyeing of the whole link to the pressure measurement flow is realized; by adding the pressure measurement mark in the request head, the transparent transmission of the pressure measurement mark in the full link of the service cluster is realized in a non-invasive manner.
For the processing of the pressure measurement flow in the storage layer, the storage layer includes a redis cache and storage of a persistent database MySQL, and for the storage of the database MySQL, as shown in FIG. 7, the storage process flow chart of the dyeing data specifically includes the following steps:
step S400: and storing the pressure measurement flow generated by the request message into a shadow table.
During storage, judging whether the current flow has a dyeing mark, if so, storing the current flow into a shadow table, and if not, storing the current flow into a production table, wherein the method specifically comprises the following steps:
step S401: judging whether the current flow has a dyeing mark;
step S402: if the current flow is the pressure measurement flow, modifying the table name of the sql execution statement into the shadow table name before storing the dyeing data corresponding to the pressure measurement flow, so as to store the dyeing data into the shadow table.
For the storage of the database MySQL, if the data is dyeing data, the plug-in dynamically modifies the table name (table) of the sql execution statement into a shadow table name (table _ ptest), and the dyeing data is automatically stored in a shadow table and isolated from production data; and the pressure measurement flow is dynamically identified, and the dyeing data is stored in a shadow table of a database, so that the generation of dirty data in a production table is avoided, and the workload of pressure measurement personnel is reduced.
For the redis cache, when the current thread inserts data before calling the redis method, the plug-in unit can judge whether the current thread contains a dyeing mark so as to judge whether the current thread is a link of dyeing flow, and if the current thread does not contain the dyeing mark, the current thread is indicated as production flow and is not processed; if the dyeing flow is the dyeing flow, the plug-in unit is used for modifying parameters executed by the method, and setting character strings are spliced on the key value parameters so as to distinguish production data; when data is acquired, the data is acquired by judging whether a set character string is added to the key value parameter or not according to the dyeing mark.
According to the pressure measurement method, the dyeing marks are added in the test flow, full-link transparent transmission is achieved, isolation of dyeing data and production data can be achieved (the dyeing data enter a shadow table, the production data enter a production table), operation that pressure measurement personnel finish pressure measurement every time and dirty data in the production table are cleared is avoided, working time is saved, and efficiency is improved.
In addition, not only is the dynamic isolation of the production data and the dyeing data realized, but also the dyeing data does not influence the production data, so the pressure measurement is carried out in an online cluster environment at any time, and the normal operation of the actual service is not influenced.
The method is modified on the basis of the skywalking plug-in, the skywalking plug-in enhances the byte codes of the application services through java agents and byteuddy implementation method-level interception sites, so that interception can be implemented through other byte code enhancement technologies, and the method is not limited herein.
Example 2
An embodiment of the present application provides a pressure measurement device, which is applied to a server in embodiment 1, as shown in fig. 8, and is a structural block diagram of the pressure measurement device, where the pressure measurement device specifically includes:
a message receiving module 100, configured to receive a request message sent by a client;
a marker obtaining module 200, configured to intercept the request message through a preset interception site and obtain at least one request message with a dyeing marker from the request message;
the dyeing mark transmission module 300 is configured to correspondingly transmit the dyeing mark in the process of executing the request message in a cross-thread and/or cross-process manner and generating the pressure measurement flow;
the storage module 400 is configured to store the piezometric flow generated by the request message into a shadow table.
As shown in fig. 9, which is a block diagram of a specific structure of a pressure measuring apparatus, the dyeing mark transmission module 300 specifically includes:
the cross-thread transfer module 310 is configured to intercept the dyeing mark of the current thread to a sub-thread through a preset interception site before the thread pool acquires the method for executing the asynchronous call by the thread;
a sub-thread marking module 311 for adding a dyeing mark to a sub-thread before the sub-thread is executed.
The http cross-process transfer may specifically include:
a request object obtaining module 320, configured to intercept, through a preset interception site, before a current service sends an http cross-process request, to obtain a request object;
a first tag adding module 321, configured to add a dyed tag of a current thread in a current service to a request header of a request object, so as to deliver the dyed tag to a downstream service;
a first mark obtaining module 322, configured to obtain, after the downstream service receives the request, a dyeing mark in the request header through an interception site preset in the downstream service;
a second tag adding module 323 configured to add a dyed tag to a current thread of the downstream service.
rpc Cross-process communication may specifically include:
rpc, a request obtaining module 330, configured to, before the current service sends rpc cross-process requests, perform interception through a preset interception site to obtain rpc requests;
a third tag adding module 331, configured to add the dyed tag of the current thread in the current service to the attributes requested by rpc, so as to deliver the dyed tag to the downstream service;
a second marker obtaining module 332, configured to obtain, after the downstream service receives the rpc request, a dyeing marker in attributes through an interception site preset in the downstream service;
the fourth tag adding module 333 adds a dyed tag to the current thread of the downstream service.
The inter-message cross-process delivery may specifically include:
a message obtaining module 340, configured to obtain a message through a preset interception site before sending an asynchronous message;
a fifth tag adding module 341, configured to add a dyed tag of the current thread of the current service to the header of the message;
a third marker obtaining module 342, configured to, after receiving a message in a downstream service, obtain a dyeing marker from a header of the message through an interception site preset in the downstream service;
a sixth tag adding module 343, configured to add the dyed tag to the current thread of the downstream service.
Illustratively, the memory module 400 includes:
the judging module 401 judges whether the current flow has a dyeing mark;
a dyeing data saving module 402, configured to, if the current flow has a dyeing marker, determine that the current flow is a pressure measurement flow, modify a table name of an sql execution statement into a shadow table name before saving dyeing data corresponding to the pressure measurement flow, so as to save the dyeing data in the shadow table.
Through adding the dyeing mark to the pressure measurement flow, through setting up the interception site, realize that the full link of dyeing mark passes through to distinguish dyeing data and production data through the dyeing mark, realize the dynamic isolation of production data and dyeing data, avoided pressure measurement personnel to press at every turn and surveyed, clear away the operation of dirty data in the production table, practiced thrift operating time, improved efficiency.
An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to make the computer device execute the pressure measurement method in any one of embodiments 1.
An embodiment of the present application further provides a readable storage medium, where computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the method for pressure measurement according to any one of embodiments 1 is executed.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1.一种压测方法,其特征在于,所述方法包括:1. A pressure measurement method, characterized in that the method comprises: 接收客户端发送的请求消息;Receive the request message sent by the client; 通过预先设置的拦截位点进行拦截所述请求消息并从所述请求消息中获取带有染色标记的至少一条请求消息;Intercept the request message through a preset interception site and obtain at least one request message with a coloring mark from the request message; 在将所述请求消息在跨线程和/或跨进程执行并生成压测流量过程中,将所述染色标记进行相应传递;During the process of executing the request message across threads and/or processes and generating pressure measurement traffic, correspondingly transmitting the coloring mark; 将所述请求消息所产生的压测流量保存至影子表中。The pressure measurement traffic generated by the request message is stored in the shadow table. 2.根据权利要求1所述的压测方法,其特征在于,所述通过预先设置的拦截位点进行拦截所述请求消息并从所述请求消息中获取带有染色标记的至少一条请求消息,包括:2 . The pressure measurement method according to claim 1 , wherein, intercepting the request message through a preset interception site and obtaining at least one request message with a coloring mark from the request message, 2 . include: 在线程池获取线程执行异步调用的方法之前,通过预先设置的拦截位点进行拦截,以将当前线程的染色标记传递给子线程;Before the thread pool obtains the method of executing the asynchronous call by the thread, intercept it through the preset interception site, so as to pass the dyeing mark of the current thread to the child thread; 在所述子线程执行之前,将所述染色标记添加至所述子线程的线程上下文中。The dye marker is added to the thread context of the child thread prior to execution of the child thread. 3.根据权利要求1所述的压测方法,其特征在于,所述通过预先设置的拦截位点进行拦截所述请求消息并从所述请求消息中获取带有染色标记的至少一条请求消息,包括:3 . The pressure measurement method according to claim 1 , wherein, intercepting the request message through a preset interception site and obtaining at least one request message with a coloring mark from the request message, 3 . include: 在当前服务发送http跨进程的请求之前,通过预先设置的拦截位点进行拦截,以获取请求对象;Before the current service sends an HTTP cross-process request, intercept it through a preset interception site to obtain the request object; 将当前服务中的当前线程的染色标记添加至所述请求对象的请求头中,以将所述染色标记传递至下游服务中;adding the dyeing mark of the current thread in the current service to the request header of the request object, so as to transmit the dyeing mark to the downstream service; 在所述下游服务接收到所述请求后,通过所述下游服务中预先设置的拦截位点获取所述请求头中的染色标记;After the downstream service receives the request, obtain the dyeing mark in the request header through a preset interception site in the downstream service; 将所述染色标记添加至所述下游服务的线程上下文中。Add the dye marker to the thread context of the downstream service. 4.根据权利要求1所述的压测方法,其特征在于,所述通过预先设置的拦截位点进行拦截所述请求消息并从所述请求消息中获取带有染色标记的至少一条请求消息,包括:4 . The pressure measurement method according to claim 1 , wherein, intercepting the request message through a preset interception site and obtaining at least one request message with a coloring mark from the request message, 4 . include: 在当前服务发送rpc跨进程请求之前,通过预先设置的拦截位点进行拦截,以获取rpc请求;Before the current service sends the rpc cross-process request, intercept it through the preset interception site to obtain the rpc request; 将当前服务中的当前线程的染色标记添加至rpc请求的attachments中,以将所述染色标记传递至下游服务中;adding the dyeing mark of the current thread in the current service to the attachments of the rpc request, so as to pass the dyeing mark to the downstream service; 在所述下游服务接收所述rpc请求后,通过所述下游服务中预先设置的拦截位点获取所述attachments中的染色标记;After the downstream service receives the rpc request, obtain the dyeing mark in the attachments through the interception site preset in the downstream service; 将所述染色标记添加至所述下游服务的线程上下文中。Add the dye marker to the thread context of the downstream service. 5.根据权利要求1所述的压测方法,其特征在于,所述通过预先设置的拦截位点进行拦截所述请求消息并从所述请求消息中获取带有染色标记的至少一条请求消息,包括:5 . The pressure measurement method according to claim 1 , wherein, intercepting the request message through a preset interception site and obtaining at least one request message with a coloring mark from the request message, 6 . include: 在异步消息发送之前,通过预先设置的拦截位点获取所述消息;Before the asynchronous message is sent, obtain the message through a preset interception site; 将当前服务的当前线程的染色标记添加至所述消息的header中;adding the dyeing mark of the current thread of the current service to the header of the message; 在下游服务接收所述消息后,通过所述下游服务中预先设置的拦截位点从所述消息的header中获取所述染色标记;After the downstream service receives the message, obtain the dyeing mark from the header of the message through a preset interception site in the downstream service; 将所述染色标记添加至所述下游服务的线程上下文中。Add the dye marker to the thread context of the downstream service. 6.根据权利要求1所述的压测方法,其特征在于,所述将所述请求消息所产生的压测流量保存至影子表中,包括:6 . The stress measurement method according to claim 1 , wherein the storing the stress measurement traffic generated by the request message in a shadow table comprises: 6 . 在将所述压测流量对应的染色数据进行保存之前,将sql执行语句的表名修改为影子表名,以将所述染色数据保存至影子表中。Before saving the dyeing data corresponding to the pressure measurement flow, modify the table name of the SQL execution statement to the shadow table name, so as to save the dyeing data in the shadow table. 7.根据权利要求6所述的压测方法,其特征在于,所述方法还包括:7. The pressure measurement method according to claim 6, wherein the method further comprises: 调用缓存数据时,判断当前线程对应的数据是否含有染色标记;When calling the cached data, determine whether the data corresponding to the current thread contains a dye mark; 若有,则在key值参数上添加设定字符串,以区分染色数据和生产数据。If there is, add a setting string to the key value parameter to distinguish dyeing data and production data. 8.一种压测装置,其特征在于,所述装置包括:8. A pressure measuring device, characterized in that the device comprises: 消息接收模块,用于接收客户端发送的请求消息;The message receiving module is used to receive the request message sent by the client; 标记获取模块,用于通过预先设置的拦截位点进行拦截所述请求消息并从所述请求消息中获取带有染色标记的至少一条请求消息;a mark acquiring module, configured to intercept the request message through a preset interception site and obtain at least one request message with a dye mark from the request message; 染色标记传递模块,用于在将所述请求消息在跨线程和/或跨进程执行并生成压测流量过程中,将所述染色标记进行相应传递;a coloring mark transmission module, configured to transmit the coloring mark correspondingly in the process of executing the request message across threads and/or processes and generating pressure measurement traffic; 存储模块,用于将所述请求消息所产生的压测流量保存至影子表中。The storage module is configured to save the pressure measurement traffic generated by the request message in the shadow table. 9.一种电子设备,其特征在于,所述电子设备包括存储器以及处理器,所述存储器用于存储计算机程序,所述处理器运行所述计算机程序以使计算机设备执行根据权利要求1至7中任一项所述的压测方法。9. An electronic device, characterized in that the electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor executes the computer program to cause the computer device to execute the computer program according to claims 1 to 7 The pressure measurement method described in any one of. 10.一种可读存储介质,其特征在于,所述可读存储介质中存储有计算机程序指令,所述计算机程序指令被一处理器读取并运行时,执行权利要求1至7任一项所述的压测方法。10. A readable storage medium, wherein computer program instructions are stored in the readable storage medium, and when the computer program instructions are read and run by a processor, any one of claims 1 to 7 is executed the described pressure measurement method.
CN202011159880.9A 2020-10-26 2020-10-26 A pressure measurement method, device, electronic device and storage medium Pending CN112199218A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011159880.9A CN112199218A (en) 2020-10-26 2020-10-26 A pressure measurement method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011159880.9A CN112199218A (en) 2020-10-26 2020-10-26 A pressure measurement method, device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN112199218A true CN112199218A (en) 2021-01-08

Family

ID=74011494

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011159880.9A Pending CN112199218A (en) 2020-10-26 2020-10-26 A pressure measurement method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN112199218A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112765035A (en) * 2021-01-27 2021-05-07 北京百家科技集团有限公司 Distributed pressure test system, method, device, electronic equipment and storage medium
CN112988132A (en) * 2021-02-25 2021-06-18 平安科技(深圳)有限公司 Automatic generation method and device of data interface, computer equipment and storage medium
CN113079064A (en) * 2021-03-26 2021-07-06 北京京东振世信息技术有限公司 Pressure detection method and device and electronic equipment
CN113965510A (en) * 2021-09-23 2022-01-21 唯品会(广州)软件有限公司 Flow dyeing method and system
CN116781591A (en) * 2023-08-23 2023-09-19 国网信息通信产业集团有限公司 A pressure testing system, pressure testing terminal and storage medium based on flow dyeing and transparent transmission technology
CN117149264A (en) * 2023-10-31 2023-12-01 山东浪潮科学研究院有限公司 A multi-lane R&D environment construction method, device, equipment and storage medium
CN117453544A (en) * 2023-10-25 2024-01-26 上海任意门科技有限公司 Request processing method, system, equipment and readable storage medium
CN118337669A (en) * 2024-06-12 2024-07-12 深圳依时货拉拉科技有限公司 Traffic simulation system and method, computer readable storage medium and computer device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080271042A1 (en) * 2007-04-24 2008-10-30 Microsoft Corporation Testing multi-thread software using prioritized context switch limits
US20160110278A1 (en) * 2014-10-21 2016-04-21 International Business Machines Corporation Processor stressmarks generation
CN108090784A (en) * 2017-11-28 2018-05-29 口碑(上海)信息技术有限公司 Marketing activity emulation verification method and device
CN108536521A (en) * 2018-03-30 2018-09-14 口碑(上海)信息技术有限公司 Based on emulation platform offline environment checking method and device
CN109871320A (en) * 2019-01-21 2019-06-11 上海德启信息科技有限公司 A kind of data processing method, device, application server and storage medium
CN110532191A (en) * 2019-09-05 2019-12-03 北京博睿宏远数据科技股份有限公司 A kind of method for testing pressure, system and cluster
CN110750584A (en) * 2019-09-18 2020-02-04 苏宁云计算有限公司 Data management method and system
CN110874304A (en) * 2018-09-03 2020-03-10 广州神马移动信息科技有限公司 Pressure testing method, device, equipment and computer readable storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080271042A1 (en) * 2007-04-24 2008-10-30 Microsoft Corporation Testing multi-thread software using prioritized context switch limits
US20160110278A1 (en) * 2014-10-21 2016-04-21 International Business Machines Corporation Processor stressmarks generation
CN108090784A (en) * 2017-11-28 2018-05-29 口碑(上海)信息技术有限公司 Marketing activity emulation verification method and device
CN108536521A (en) * 2018-03-30 2018-09-14 口碑(上海)信息技术有限公司 Based on emulation platform offline environment checking method and device
CN110874304A (en) * 2018-09-03 2020-03-10 广州神马移动信息科技有限公司 Pressure testing method, device, equipment and computer readable storage medium
CN109871320A (en) * 2019-01-21 2019-06-11 上海德启信息科技有限公司 A kind of data processing method, device, application server and storage medium
CN110532191A (en) * 2019-09-05 2019-12-03 北京博睿宏远数据科技股份有限公司 A kind of method for testing pressure, system and cluster
CN110750584A (en) * 2019-09-18 2020-02-04 苏宁云计算有限公司 Data management method and system

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112765035A (en) * 2021-01-27 2021-05-07 北京百家科技集团有限公司 Distributed pressure test system, method, device, electronic equipment and storage medium
CN112988132A (en) * 2021-02-25 2021-06-18 平安科技(深圳)有限公司 Automatic generation method and device of data interface, computer equipment and storage medium
CN113079064A (en) * 2021-03-26 2021-07-06 北京京东振世信息技术有限公司 Pressure detection method and device and electronic equipment
CN113965510A (en) * 2021-09-23 2022-01-21 唯品会(广州)软件有限公司 Flow dyeing method and system
CN113965510B (en) * 2021-09-23 2023-04-18 唯品会(广州)软件有限公司 Flow dyeing method and system
CN116781591A (en) * 2023-08-23 2023-09-19 国网信息通信产业集团有限公司 A pressure testing system, pressure testing terminal and storage medium based on flow dyeing and transparent transmission technology
CN116781591B (en) * 2023-08-23 2024-01-02 国网信息通信产业集团有限公司 Pressure testing system, pressure testing terminal and storage medium based on flow dyeing and transparent transmission technology
CN117453544A (en) * 2023-10-25 2024-01-26 上海任意门科技有限公司 Request processing method, system, equipment and readable storage medium
CN117149264A (en) * 2023-10-31 2023-12-01 山东浪潮科学研究院有限公司 A multi-lane R&D environment construction method, device, equipment and storage medium
CN117149264B (en) * 2023-10-31 2024-01-30 山东浪潮科学研究院有限公司 Multi-lane research and development environment construction method, device, equipment and storage medium
CN118337669A (en) * 2024-06-12 2024-07-12 深圳依时货拉拉科技有限公司 Traffic simulation system and method, computer readable storage medium and computer device

Similar Documents

Publication Publication Date Title
CN112199218A (en) A pressure measurement method, device, electronic device and storage medium
CN110286897A (en) API visualization dynamic configuration method, device, equipment and storage medium
US7987246B2 (en) Method and system for client browser update
US6857119B1 (en) Techniques for modifying a compiled application
US9727405B2 (en) Problem determination in distributed enterprise applications
US9146787B2 (en) Analytics for application programming interfaces
US7827565B2 (en) Integration architecture for non-integrated tools
US9311214B2 (en) System and methods for tracing individual transactions across a mainframe computing environment
US20110167156A1 (en) Monitoring related content requests
JP7580379B2 (en) Method, system and computer readable medium for data transformation using a representational state transfer (REST) application programming interface (API) - Patents.com
WO2020010702A1 (en) Log search method and system, computer device, and storage medium
US8849981B2 (en) Response time benchmarking
JP2012221502A (en) Visualization of jvm and cross-jvm call stacks
CN112286776B (en) Method and system for tracking micro-service link
CN106991322A (en) The detection method and device of a kind of SQL SQL injection attack
US7069184B1 (en) Centralized monitoring and early warning operations console
CN109309664B (en) Browser fingerprint detection behavior monitoring method
CN111064725A (en) Code zero intrusion interface verification method and device
WO2021093672A1 (en) Method for embedding external system, workflow system, device and computer readable storage medium
WO2022062478A1 (en) Method and apparatus for detecting arbitrary account password reset logic vulnerability, and medium
US7543041B2 (en) Pattern based web services using caching
CN109409948A (en) Transaction method for detecting abnormality, device, equipment and computer readable storage medium
US7289989B2 (en) Pattern based web services
WO2014155718A1 (en) Information processing device and information processing system
CN100512158C (en) Network measuring system structure and realizing method thereof

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210108