CN114490318B - Environment treatment system and method for realizing weak isolation based on byte code enhancement - Google Patents

Environment treatment system and method for realizing weak isolation based on byte code enhancement Download PDF

Info

Publication number
CN114490318B
CN114490318B CN202111562841.8A CN202111562841A CN114490318B CN 114490318 B CN114490318 B CN 114490318B CN 202111562841 A CN202111562841 A CN 202111562841A CN 114490318 B CN114490318 B CN 114490318B
Authority
CN
China
Prior art keywords
environment
application
project
request
call
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
CN202111562841.8A
Other languages
Chinese (zh)
Other versions
CN114490318A (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.)
Jiangsu Carzone Automobile Accessories Co ltd
Original Assignee
Jiangsu Carzone Automobile Accessories 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 Jiangsu Carzone Automobile Accessories Co ltd filed Critical Jiangsu Carzone Automobile Accessories Co ltd
Priority to CN202111562841.8A priority Critical patent/CN114490318B/en
Publication of CN114490318A publication Critical patent/CN114490318A/en
Application granted granted Critical
Publication of CN114490318B publication Critical patent/CN114490318B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/36—Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668—Testing of software
    • G06F11/3696—Methods or tools to render software testable
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00—Error detection; Error correction; Monitoring
    • G06F11/36—Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668—Testing of software
    • G06F11/3672—Test management
    • G06F11/3684—Test management for test design, e.g. generating new test cases
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00—Arrangements for software engineering
    • G06F8/40—Transformation of program code
    • G06F8/41—Compilation
    • G06F8/44—Encoding
    • G06F8/447—Target code generation

Landscapes

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

Abstract

The invention discloses an environment treatment system and method for realizing weak isolation based on byte code enhancement, and belongs to the technical field of software testing. The system comprises a code implementation module with increased byte codes, a weak isolation module based on software implementation, a distributed call link agent-trace-id transparent transmission implementation module and a request routing priority control module. The invention divides the application environment into project environment and basic environment, the project environment can depend on the basic environment, the project environment only deploys the application of project related change, the basic environment deploys the full quantity of application; through a byte code enhancement mode, dubbo, MQ, http and multithreading of each scene call route isolation of the application is realized, a data transparent transmission protocol is realized by self definition, data transparent transmission of a distributed link scene is realized, and the call links related to a plurality of applications can be accurately and safely isolated and called; the environments available for multiple application invocation scenarios are weakly isolated.

Description

Environment treatment system and method for realizing weak isolation based on byte code enhancement
Technical Field
The invention belongs to the technical field of software testing, and particularly relates to an environment management system and method for realizing weak isolation based on byte code enhancement.
Background
Byte Buddy is a code generation and operation library for creating and modifying Java classes at Java application runtime without the aid of a compiler. In addition to the code generation utility attached to the Java class library, byte Buddy also allows creation of arbitrary classes, and is not limited to implementing an interface for creating runtime agents. In addition, byte Buddy provides a convenient API that can be changed using Java agents or manually during construction.
Byte Buddy has the following advantages over other Byte code operation libraries: the method can be operated without understanding the format of the byte code, and the byte code can be easily operated by a simple and easy API. Any version of Java is supported, the library is lightweight, and depends only on the visitor API of the Java byte code parser library ASM, which itself does not need any other dependencies. Byte Buddy has performance advantages over JDK dynamic proxy cglib, javassist.
In one project period, the environmental resources of the application can be occupied, especially when the time proportion occupied by the development environment and the test environment exceeds 80%, so that the problem of environmental resource conflict can occur when one application belongs to a scene of a plurality of projects.
Disclosure of Invention
Aiming at the problems in the prior art, the technical problem to be solved by the invention is to provide an environment management system and method for realizing weak isolation based on byte code enhancement. By means of byte code enhancement, weak isolation of application is achieved, and the problem of environmental resource conflict in a multi-project parallel scene is solved by matching with certain specifications and conventions.
In order to solve the problems, the technical scheme adopted by the invention is as follows:
The environment management system based on the byte code enhancement for realizing the weak isolation comprises a code realization module for increasing the byte code, a weak isolation module based on the software realization, a distributed call link agent-trace-id transparent transmission realization module and a request routing priority control module;
The code implementation module added with the byte codes can be plugged into and pulled out from the isolation implementation of each calling tool, can be rapidly deployed and can be reused;
The weak isolation module based on software implementation is used for subdividing a development environment and a test environment into a project environment and a basic environment;
The distributed calling link agent-trace-id transparent transmission realization module completes the transmission of the agent-trace-id of the whole distributed calling link under the technical condition based on thread local, and the routing priority of each call of a request is controllable;
The request routing priority control module is used for finding out the corresponding request routing priority control code when the request is called, and completing the routing priority control of the request.
The environment management system for realizing weak isolation based on byte code enhancement is characterized in that a code realization module for byte code augmentation is constructed according to a microkernel mode and comprises a core module and a plurality of plug in modules.
The environment treatment system for realizing weak isolation based on byte code enhancement has corresponding project environments for each project, and the project environments only deploy the application with codes or configuration changes in the current project; the basic environment deploys all application environments, and deployed application codes and configurations are consistent with the online environment, so that the stability of the service is ensured; the application of the project environment can rely on the application of the basic environment to complete the request call, namely, the application of the project environment can call the application of the basic environment, and the normal call of the whole call link is completed through the application spam of the basic environment.
According to the environment management system for realizing weak isolation based on the byte code enhancement, in each application internal calling stage, the agent-trace-id is stored in the calling context, so that the acquisition is convenient at any time, and between the two calling stages, the technical framework comprises Dubbo, MQ, http and multithreading through the custom parameter function of a specific calling technical framework, so that the agent-trace-id transmission of the whole distributed calling link is completed.
When the request routing priority control module is used for carrying out request call in Java application or among applications, the request routing priority control module comprises Dubbo call, MQ call, http call and multithread call, and a corresponding request routing priority control code is found through the call source code research of each technology and is realized according to a specific routing control strategy, so that the routing priority control of the request is completed.
The environment treatment method for realizing weak isolation based on byte code enhancement comprises the following steps:
(1) In the stand stage, firstly determining the project code number of the stand, then determining the application contained in the project of the stand, completing stand operation in the stand platform, completing application configuration information creation by taking the configuration of the online environment as a base line, automatically creating all project environment GIDs of the application, and generating the project environment access domain name of the application;
(2) In the deployment stage, application deployment is carried out according to the project environment identifier, so that the environment identifier, the project identifier and the application identifier are ensured to be correctly transmitted to the Java application in a form of-D, and are started in a javaagent mode, and the specific agent path configuration realizes the generation of agent. Jar;
(3) And in the calling stage, the entry corresponding to the front end needs to use the project environment access domain name of the corresponding application to request, so long as the access domain name of the entry request is ensured to be correct, the subsequent request link can normally complete calling, and the agent. Jar can automatically complete the agent-trace-id transmission and request routing processing in the link process.
The beneficial effects are that: compared with the prior art, the invention has the advantages that:
(1) The invention realizes weak isolation of application by a byte code enhancement mode, and solves the problem of environmental resource conflict under a multi-project parallel scene by matching with certain specifications and conventions; has high universality and is easy to be implemented and used in Java application.
(2) The invention divides the application environment into project environment and basic environment, the project environment can depend on the basic environment, the project environment only deploys the application of project related change, the basic environment deploys the full quantity of application; by means of byte code enhancement, dubbo, MQ, http and multithreading of each scene call route isolation of the application is achieved, a data transparent transmission protocol is achieved through self definition, data transparent transmission of a distributed link scene is achieved, and accurate and safe isolation call of call links related to a plurality of applications is guaranteed. The method is used for the environment weak isolation of a plurality of application call scenes.
Drawings
FIG. 1 is a schematic diagram of a microkernel mode implementation;
FIG. 2 is a schematic diagram of an Http call isolation implementation;
FIG. 3 is a diagram of Dubbo call isolation implementation;
FIG. 4 is a schematic diagram of an MQ call isolation implementation;
FIG. 5 is a schematic diagram of a multi-threaded call isolation implementation;
FIG. 6 is a flow chart of an environmental remediation process.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more apparent, a more particular description of the invention will be rendered by reference to specific embodiments thereof.
Example 1
The environment management system based on the byte code enhancement for realizing the weak isolation comprises a code realization module for increasing the byte code, a weak isolation module based on software realization, a distributed call link agent-trace-id transparent transmission realization module and a request routing priority control module, wherein the method comprises the following steps:
(1) The code implementation module with the added byte codes is used for carrying out one-layer abstraction aiming at the byte code enhancement technology, constructing a core module and a plurality of plug in modules according to a microkernel mode (the microkernel mode implementation principle is shown in figure 1), realizing the isolation implementation of each calling tool, being pluggable, being capable of being rapidly deployed and being multiplexed.
(2) The weak isolation module based on software implementation subdivides a development environment and a test environment into a project environment and a basic environment; each project has a corresponding project environment, and the project environment only deploys the application with codes or configuration changes in the current project; the basic environment deploys all application environments, and deployed application codes and configurations are consistent with the online environment, so that the stability of the service is ensured; the application of the project environment can rely on the application of the basic environment to complete the request call, namely, the application of the project environment can call the application of the basic environment, and the normal call of the whole call link is completed through the application spam of the basic environment.
(3) The distributed calling link agent-trace-id transparent transmission realization module is based on a thread local technology, realizes the construction of a calling context aiming at a distributed calling link, stores the agent-trace-id in the calling context in each application internal calling stage, is convenient to acquire at any time, and completes the transmission of the agent-trace-id of the whole distributed calling link by a specific calling technical framework between two calling stages through a custom parameter function, wherein the technical framework comprises Dubbo calling, MQ calling, http calling and multithreading calling;
For the realization of Http call isolation (the principle is shown in figure 2), an access domain name corresponding to a project environment is configured for each application, and the domain name is used as a carrier of the information of the request source according to the uniform format of http:// { environment identification } { project identification } { -application identification }, in the application service of the bottom request of Http, the environment identification, the project identification and the application identification are identified by reading host data in the information of the request head, a request source is uniquely identified, the information of the request source is used for adding timestamp information in the application service, and a 4-bit random number is added to generate a globally unique agent-trace-id which is used as a carrier of the information of the request source, so that the transparent transmission of the source information in the subsequent request is completed. And the agent-trace-id is stored in the thread of the processing thread of the Http request, so that the agent-trace-id can be obtained in the current JVM when the agent-trace-id is called.
For Dubbo call isolation implementation (principle is shown in fig. 3), at the service consumption end Comsumer, acquiring the agent-trace-id through ThreadLocal, and setting the agent-trace-id in the attachments parameters of the request according to the custom parameters; and at the service providing end Provider, analyzing source environment information by acquiring the agent-trace-id from the attachments parameters of the request, filtering out the service corresponding to the target group in a service routing link, and completing service call by taking the service of the basic environment as a spam if the service of the target group does not exist.
For MQ call isolation implementation (the principle is shown in FIG. 4), at a message production end Producer, acquiring a agent-trace-id through thread local, and setting the agent-trace-id in userProperties of a message by using a custom parameter; at the message consumer Comsumer, the source context information is parsed by obtaining the agent-trace-id from the userProperties parameters of the message.
Non-basic environment: if the environment where the current application is located is not matched with the source environment information, the message is directly set as successful consumption;
Basic environment: if the environment where the current application is located is not matched with the source environment information and the application corresponding to the source environment does not exist, the message is directly set as successful consumption;
if the environment where the application is located is matched with the source environment information, normal business processing is carried out, and normal return is carried out.
For a multithreaded call isolation implementation (the principle is shown in fig. 5), byte code enhancement is performed on the ThreadPoolExecutor class execute, submit method, agent-trace-id transparent transmission between a main thread and a sub thread is realized, and code implementation of a multithreaded Cheng Changjing call is agreed to be required by all applications by using ThreadPoolExecutor.
(4) The request route priority control module is a request route priority control module which is realized according to a specific route control strategy by finding out a corresponding request route priority control code through the research of calling source codes of each technology when the above-mentioned calling is carried out in Java application or among applications.
The environment treatment method for realizing weak isolation based on byte code enhancement comprises the following steps:
(1) In the stand stage, firstly determining the project code number of the stand, then determining the application contained in the project of the stand, completing stand operation in the stand platform, completing application configuration information creation by taking the configuration of the online environment as a base line, automatically creating all project environment GIDs of the application, and generating the project environment access domain name of the application;
(2) In the deployment stage, application deployment is carried out according to the project environment identification, so that the environment identification, the project identification and the application identification are ensured to be correctly transmitted to the Java application in the form of-D, and are started in a javaagent mode, and a specific agent path configures the agent.
(3) In the calling stage, the entry corresponding to the front end needs to use the project environment access domain name of the corresponding application to request, and as long as the access domain name of the entry request is ensured to be correct, the subsequent request link can normally complete calling.

Claims (2)

1. The environment management system for realizing weak isolation based on byte code enhancement is characterized by comprising a code implementation of byte code enhancement, a weak isolation module based on software implementation, a distributed call link agent-trace-id transparent transmission implementation module and a request routing priority control module; the byte code enhanced code is realized as pluggable to the isolation realization of each calling tool, can be rapidly deployed and can be reused; the weak isolation module based on software implementation is used for subdividing a development environment and a test environment into a project environment and a basic environment; the distributed calling link agent-trace-id transparent transmission realization module completes the transmission of the agent-trace-id of the whole distributed calling link under the technical condition based on thread local, and the routing priority of each call of a request is controllable; the request route priority control module is used for finding out a corresponding request route priority control code when a request is called, and completing the route priority control of the request;
the implementation of the byte code enhanced code is constructed according to the mode of the microkernel and comprises a core module and a plurality of plug in modules;
each project has a corresponding project environment, and the project environment only deploys the application with codes or configuration changes in the current project; the basic environment deploys all application environments, and deployed application codes and configurations are consistent with the online environment, so that the stability of the service is ensured; the application of the project environment can rely on the application of the basic environment to complete the request call, namely, the application of the project environment can call the application of the basic environment, and the normal call of the whole call link is completed through the application spam of the basic environment;
In each application internal calling stage, the agent-trace-id is stored in a calling context, so that the agent-trace-id is convenient to acquire at any time, and between the two calling stages, the agent-trace-id is transferred through a specific calling technical framework comprising Dubbo, MQ, http and multiple threads, so that the agent-trace-id of the whole distributed calling link is transferred;
The request routing priority control module finds out the corresponding request routing priority control code through the research of the calling source code of each technology when the request is called in Java application or among applications, including Dubbo call, MQ call, http call and multithread call, and completes the routing priority control of the request according to the specific routing control strategy.
2. An environmental governance method for realizing weak isolation based on byte code enhancement, which is applied to the system realization as claimed in claim 1, and is characterized by comprising the following steps:
(1) In the stand stage, firstly determining the project code number of the stand, then determining the application contained in the project of the stand, completing stand operation in the stand platform, completing application configuration information creation by taking the configuration of the online environment as a base line, automatically creating all project environment GIDs of the application, and generating the project environment access domain name of the application;
(2) In the deployment stage, application deployment is carried out according to the project environment identifier, so that the environment identifier, the project identifier and the application identifier are ensured to be correctly transmitted to the Java application in an ID mode, and are started in a javaagent mode, and the specific agent path configuration realizes the generation of agent. Jar;
(3) And in the calling stage, the entry corresponding to the front end needs to use the project environment access domain name of the corresponding application to request, so long as the access domain name of the entry request is ensured to be correct, the subsequent request link can normally complete calling, and the agent. Jar can automatically complete the agent-trace-id transmission and request routing processing in the link process.
CN202111562841.8A 2021-12-20 2021-12-20 Environment treatment system and method for realizing weak isolation based on byte code enhancement Active CN114490318B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111562841.8A CN114490318B (en) 2021-12-20 2021-12-20 Environment treatment system and method for realizing weak isolation based on byte code enhancement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111562841.8A CN114490318B (en) 2021-12-20 2021-12-20 Environment treatment system and method for realizing weak isolation based on byte code enhancement

Publications (2)

Publication Number Publication Date
CN114490318A CN114490318A (en) 2022-05-13
CN114490318B true CN114490318B (en) 2024-07-23

Family

ID=81493356

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111562841.8A Active CN114490318B (en) 2021-12-20 2021-12-20 Environment treatment system and method for realizing weak isolation based on byte code enhancement

Country Status (1)

Country Link
CN (1) CN114490318B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115766723B (en) * 2022-11-22 2025-06-06 杭州谐云科技有限公司 A distributed tracing local sampling method and system based on the sidecar model
CN117591436A (en) * 2024-01-18 2024-02-23 南京研利科技有限公司 A method and device for obtaining observability data from Go source code
CN120892296B (en) * 2025-09-30 2025-12-23 山东浪潮智能终端科技有限公司 Software monitoring method, system, equipment and medium based on byte code replacement and risk perception

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8090797B2 (en) * 2009-05-02 2012-01-03 Citrix Systems, Inc. Methods and systems for launching applications into existing isolation environments
US20150100890A1 (en) * 2013-10-04 2015-04-09 Samsung Electronics Co., Ltd. User interface management method and system
CN109871320A (en) * 2019-01-21 2019-06-11 上海德启信息科技有限公司 A kind of data processing method, device, application server and storage medium
CN110083436A (en) * 2019-05-14 2019-08-02 上海理想信息产业(集团)有限公司 A kind of business datum real-time monitoring system and method based on Java bytecode enhancing technology
CN111176791B (en) * 2019-12-31 2023-09-29 杭州趣链科技有限公司 A cross-virtual machine calling method based on multi-virtual machine blockchain platform

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于硬件虚拟化的客户虚拟机内部执行环境隔离机制;杨子涵;《cnki优秀硕士学位论文全文库 信息科技辑》;20220115(第01期);第I137-5页 *

Also Published As

Publication number Publication date
CN114490318A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
CN111367818B (en) System component testing method and device based on dynamic data return
CN104683386B (en) The stake service implementing method and device of customizable response
CN110058864B (en) Microservice deployment method and device
US20130145352A1 (en) Business process execution language program simulation
CN114327383A (en) Service configuration system and method based on SOA (service oriented architecture) middleware and readable storage medium
US9823991B2 (en) Concurrent workload simulation for application performance testing
CN114490318A (en) Environment management system and method for realizing weak isolation based on bytecode enhancement
Beckmann et al. sDDS: A portable data distribution service implementation for WSN and IoT platforms
CN113126961A (en) Pipeline processing method, device and storage medium
CN112085217A (en) Method, device, equipment and computer medium for deploying artificial intelligence service
CN103176892A (en) Page monitoring method and system
CN101021786A (en) Method for calling universal structure
CN113708971A (en) Openstack cloud platform deployment method and related device
CN1945530B (en) A deployment system and method with dependent components
CN113434147A (en) ProtoBuf protocol-based message analysis method and device
CN117289906A (en) Low-code application development method, equipment and medium
CN114625376A (en) Data transfer mode conversion method and device, electronic equipment and readable storage medium
Villacis et al. CAT: A high performance, distributed component architecture toolkit for the grid
KR102246079B1 (en) SYSTEM OF SENSORY DATA ACQUISITION AND SYNCHRONIZATION FOR CLOUD CENTRIC IoT AND METHOD PERFORMING THEREOF
CN113254027A (en) Method, system, equipment and storage medium for converting control program of semiconductor equipment
CN115291987B (en) Page generation method and device, electronic equipment and storage medium
US7506319B2 (en) Generating a model of software in execution
CN113342633B (en) Performance test method and device
Bao et al. Extracting reusable services from legacy object-oriented systems
CN114721855A (en) Vehicle diagnosis method, apparatus, device, and 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