[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN118075059B - Gateway execution method, device and equipment based on MySQL protocol - Google Patents

Gateway execution method, device and equipment based on MySQL protocol Download PDF

Info

Publication number
CN118075059B
CN118075059B CN202410459554.1A CN202410459554A CN118075059B CN 118075059 B CN118075059 B CN 118075059B CN 202410459554 A CN202410459554 A CN 202410459554A CN 118075059 B CN118075059 B CN 118075059B
Authority
CN
China
Prior art keywords
request
execution
session
received
requests
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
CN202410459554.1A
Other languages
Chinese (zh)
Other versions
CN118075059A (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.)
Hangzhou Shiatomic Technology Co ltd
Original Assignee
Hangzhou Shiatomic 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 Hangzhou Shiatomic Technology Co ltd filed Critical Hangzhou Shiatomic Technology Co ltd
Priority to CN202410459554.1A priority Critical patent/CN118075059B/en
Publication of CN118075059A publication Critical patent/CN118075059A/en
Application granted granted Critical
Publication of CN118075059B publication Critical patent/CN118075059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/289Object oriented databases
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures
    • 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)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a gateway execution method, a device and equipment based on MySQL protocol, and relates to the technical field of computers, wherein the method comprises the steps of executing initialization of Session and Session context each time connection is established; performing ReqContext object and monitoring object initialization each time a request is received, and binding ReqId and ReqContext, listener instances according to connID in a SessionContext object; pressing the same connID bound requests into a request queue through a dispatcher to generate sequential increment IDs; and when the received more than two requests have no data dependency relationship, executing SQL concurrently to obtain an execution result. The method supports concurrent execution and improves the execution efficiency.

Description

Gateway execution method, device and equipment based on MySQL protocol
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for executing a gateway based on MySQL protocol.
Background
With the development of services and the increasing volume of data volume access, data warehouse and MySQL are systems at the infrastructure level, and access and protocol implementation levels face increasing flow challenges. As shown in fig. 4, an SQL gateway architecture is disclosed, where the SQL gateway takes over all the various forms of traffic from the user clients and then routes them to different internal system downstream nodes for synchronous or asynchronous processing. Meanwhile, the system is in a data security angle, provides basic functions of current limiting and black-and-white list, and the traditional mysql database has no capability. There is therefore a high demand for distributed coordination, concurrency performance, throughput capability of the gateway. However, the MYSQL protocol must be executed synchronously and serially when it is theoretically necessary to process request SQL, because packID must be sequentially incremented, no disorder is allowed, and only one SQL is processed at the same time by one connection in conventional implementations. Therefore, the single machine and the cluster service foundation have single machine flow bottlenecks, and the phenomenon of low efficiency of service data query or operation occurs.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a gateway executing method based on MySQL protocol.
The technical scheme of the invention is as follows:
the gateway execution method based on MySQL protocol comprises the following steps:
each time a connection is established, performing initialization of Session and Session context;
performing ReqContext object and Listener object initialization each time a request is received, and binding ReqId and ReqContext, listener object instances in a SessionContext object according to connID; pressing the same connID bound requests into a request queue through a dispatcher to generate sequential increment IDs; and when the received more than two requests have no context relation, executing SQL concurrently to obtain an execution result.
Preferably, the method further comprises a write-back method, wherein the write-back is performed according to the request arrival time sequence, the execution results are cached in a dispatcher response queue, and the response is performed one by one according to the request queue sequence.
Preferably, listener objects include a connection monitor object, a Session monitor object, and a request monitor object that are independent of each other.
Preferably, the method further comprises executing serially, and when the received two or more requests have a context, then the serial execution is marked in the SessionContext object.
The invention also provides a gateway executing device based on MySQL protocol, comprising the following structure:
a connection initializing unit for connecting the client and executing initialization of Session and Session context each time connection is established;
a request initializing unit for receiving a user request, performing ReqContext object and Listener object initialization each time the request is received, and binding ReqId and ReqContext, listener instances according to connID in a SessionContext object;
a dispatcher unit for pushing the bound request into a request queue, generating a sequential increment ID;
And the execution unit is used for sequentially increasing the IDs to execute the corresponding SQL.
Preferably, the Listener objects include a connection monitor object, a Session monitor object, and a request monitor object that are independent of each other.
Preferably, the execution unit comprises a concurrent execution unit and a serial execution unit, and the serial execution unit is used for executing the corresponding SQL in series according to the serial execution mark in the SessionContext object when the received more than two requests have data dependency.
Preferably, the apparatus further comprises a write-back unit for executing a sequential write-back procedure, the sequential write-back procedure comprising sequential write-back according to the request arrival time, the execution results being cached in a dispatcher response queue, and responding one by one according to the request queue order.
The invention also provides a computer storage medium which stores a computer program, and the computer program is called by a processor to realize a gateway concurrency execution method based on MySQL protocol.
The invention also provides electronic equipment, which comprises a memory and a processor, wherein the memory is used for storing one or more computer instructions, and the one or more computer instructions are executed by the processor to realize a gateway concurrency execution method based on MySQL protocol.
The invention has the beneficial effects that by configuring system parameters, the allowed Connection and request Req can have 1: n (N is more than or equal to 1), and monitors are configured for each request, namely concurrent execution is supported, so that the execution efficiency is improved, and the accuracy of the request and the accuracy of data are ensured.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a flow chart of a gateway execution method based on MySQL protocol;
FIG. 2 is a diagram of a MySQL protocol-based gateway architecture as disclosed in example 1;
FIG. 3 is a schematic diagram of sequential write back as disclosed in example 1;
fig. 4 is a diagram of a gateway architecture based on MySQL protocol.
Detailed Description
The present invention will be described in further detail with reference to the following examples, which are illustrative of the present invention and are not intended to limit the present invention thereto. Any changes or substitutions within the technical scope of the present disclosure should be covered in the scope of the present disclosure.
Noun interpretation:
ConnId, connection identifier, which generates a globally unique identification ID each time a new connection is established
ReqContext, requesting a context for storing the requested context;
Session, namely, a Session is started from the connection of the client to the server, and the Session is ended from the disconnection of the client and the server;
SessionContext, a Session context, for storing a Session context;
ConnectionContext, connect context;
listener objects, snoop objects.
It should be noted that, since the references to terms such as "session", "session context", etc. may be ambiguous in the actual operation, english may still be the object of description in order to better illustrate the solution of the present application.
Example 1
A gateway concurrency execution method based on MySQL protocol is disclosed, and referring to FIG. 1 and FIG. 2, the method comprises the following steps:
each time a connection is established, performing initialization of a session and a session context;
Executing initialization of a request context object and a monitoring object when receiving a request each time, and binding a request ID, a request context and a monitoring object instance in a session context object according to a connection ID;
Pressing the requests bound by the same connection ID into a request queue through a dispatcher to generate sequential increment IDs; the above processes are all completed at the connection level, namely, at the protocol level;
After the initialization, when the received more than two requests have no data dependency relationship, SQL is executed concurrently.
More precisely described, the method comprises the following steps:
By configuring system parameters, allowing Connection with request Req may have 1: n (N. Gtoreq.1);
each time a connection is established, performing initialization of Session and Session context;
Performing ReqContext object and monitoring object initialization each time a request is received, and binding ReqId and ReqContext, listener object instances in a SessionContext object according to connID;
Pressing the same connID bound requests into a request queue through a dispatcher to generate sequential increment IDs; the above processes are all completed at the connection level, namely, at the protocol level;
After the initialization, when the received more than two requests have no data dependency relationship or context relationship, SQL is executed concurrently.
The method further comprises the step of configuring a write-back program, wherein the write-back program comprises the step of writing back according to the arrival time sequence of the requests, and the execution results are cached into a dispatcher response queue and responded one by one according to the sequence of the request queue as shown in fig. 3.
For example: and in one connection established by the user, the Select and Insert operations are performed through the concurrency means, but serial write-back is performed according to the request sequence in the response stage, namely, write-back packet.
The method for executing the corresponding SQL comprises concurrent execution and serial execution, and when the received more than two requests have data dependency relationships, the serial execution is marked in the SessionContext object.
The Listener object instances comprise a connection monitoring object instance, a Session monitoring object instance and a request monitoring object instance which are independent from each other. I.e. each phase has a separate proprietary Listener object, as shown in fig. 2, connectionContext is configured with perceived connection-dependent ConnectionContext Listener; sessionContext is configured with Session change-related SessionContext Listener; reqContext are configured with a perceived request data correlation REQ LISTENER.
Each request has a separate proprietary Listener object; specifically, the Session and Session context are initialized synchronously at each connection establishment, the private attribute and data of each connection are maintained, the initialization of ReqContext objects and Listener objects is performed at each request, specifically including the initialization of each requested proprietary Listener object, and the binding of ReqId and ReqContext, listener instances (each requested proprietary Listener object) is performed according to connId in the Session context object.
Example 2: the utility model discloses a gateway concurrency executive device based on MySQL protocol, which comprises the following structures:
a connection initializing unit for connecting the client and executing initialization of Session and Session context each time connection is established;
A request initializing unit, which is used for receiving the user request, executing ReqContext object and monitoring object initialization each time the request is received, and binding ReqId and ReqContext, listener instances according to connID in the SessionContext object;
a dispatcher unit for pushing the bound request into a request queue, generating a sequential increment ID;
And the execution unit is used for sequentially increasing the IDs to execute the corresponding SQL.
Wherein the monitoring object comprises mutually independent connection monitoring, session monitoring and request monitoring
The execution unit comprises a concurrent execution unit and a serial execution unit, wherein the serial execution unit is used for executing corresponding SQL in series according to a serial execution mark in a SessionContext object when more than two received requests have data dependency.
The device also comprises a write-back unit for executing a sequential write-back program, wherein the sequential write-back program comprises write-back according to the request arrival time sequence, and the execution results are cached in a dispatcher response queue and responded one by one according to the request queue sequence.
The invention also provides electronic equipment, which comprises a memory and a processor, wherein the memory is used for storing one or more computer instructions, and the one or more computer instructions are executed by the processor to realize a gateway concurrency execution method based on MySQL protocol.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted, or not performed.
The units may or may not be physically separate, and the components shown as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit 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 may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a readable storage medium.
Based on such understanding, the technical solution of the embodiments of the present invention may be essentially or partly contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product, and the present invention proposes a computer storage medium, where the software product is stored in a storage medium, and includes several instructions to cause a device (may be a single-chip microcomputer, a chip or the like) or a processor (processor) to execute a gateway concurrent execution method based on MySQL protocol. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (10)

1. The gateway execution method based on MySQL protocol is characterized by comprising the following steps:
each time a connection is established, performing initialization of Session and Session context;
Performing ReqContext object and Listener object initialization each time a request is received, and binding ReqId and ReqContext, listener object instances in a SessionContext object according to connID; pressing the same connID bound requests into a request queue through a dispatcher to generate sequential increment IDs; and when the received more than two requests have no context, executing SQL concurrently to obtain an execution result.
2. The MySQL protocol-based gateway execution method of claim 1, further comprising a write-back method for writing back according to a request arrival time sequence, wherein the execution result is cached in a dispatcher response queue, and responds one by one according to the request queue sequence.
3. The MySQL protocol-based gateway implementation method of claim 1, wherein Listener objects include a connection snoop object, a Session snoop object, and a request snoop object that are independent of each other.
4. The MySQL protocol-based gateway execution method of claim 1, further comprising a serial execution, wherein when the received two or more requests have a context, the received two or more requests are marked as serial execution in a SessionContext object.
5. The gateway executing device based on MySQL protocol is characterized by comprising the following structure:
a connection initializing unit for connecting the client and executing initialization of Session and Session context each time connection is established;
A request initializing unit for receiving a user request, performing ReqContext object and Listener object initialization each time the request is received, and binding ReqId and ReqContext, listener object instances according to connID in a SessionContext object;
a dispatcher unit for pushing the bound request into a request queue, generating a sequential increment ID;
and the execution unit is used for executing SQL concurrently when the received more than two requests have no context.
6. The MySQL protocol-based gateway execution apparatus of claim 5, wherein the Listener objects comprise a connection snoop object, a Session snoop object, and a request snoop object that are independent of each other.
7. The MySQL protocol-based gateway execution device of claim 5, wherein the execution unit comprises a concurrent execution unit and a serial execution unit, and the serial execution unit is configured to execute the corresponding SQL serially according to a serial execution flag in the SessionContext object when the received two or more requests have a context.
8. The MySQL protocol-based gateway execution apparatus of claim 5, further comprising a write-back unit configured to execute a sequential write-back procedure including sequential write-back according to a request arrival time, the execution result being cached in a dispatcher response queue, and responding one by one in the request queue order.
9. An electronic device comprising a memory and a processor, the memory to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the MySQL protocol based gateway execution method of any of claims 1-4.
10. A computer storage medium, characterized in that it stores a computer program, which is called by a processor to implement a MySQL protocol based gateway execution method according to any of claims 1-4.
CN202410459554.1A 2024-04-17 2024-04-17 Gateway execution method, device and equipment based on MySQL protocol Active CN118075059B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410459554.1A CN118075059B (en) 2024-04-17 2024-04-17 Gateway execution method, device and equipment based on MySQL protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410459554.1A CN118075059B (en) 2024-04-17 2024-04-17 Gateway execution method, device and equipment based on MySQL protocol

Publications (2)

Publication Number Publication Date
CN118075059A CN118075059A (en) 2024-05-24
CN118075059B true CN118075059B (en) 2024-07-12

Family

ID=91106205

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410459554.1A Active CN118075059B (en) 2024-04-17 2024-04-17 Gateway execution method, device and equipment based on MySQL protocol

Country Status (1)

Country Link
CN (1) CN118075059B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112230901A (en) * 2020-10-29 2021-01-15 厦门市易联众易惠科技有限公司 Network programming framework system and method based on asynchronous IO model
CN113420007A (en) * 2021-03-31 2021-09-21 阿里巴巴新加坡控股有限公司 Audit processing method and device for database access and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230231811A1 (en) * 2012-05-22 2023-07-20 Xockets, Inc. Systems, devices and methods with offload processing devices
CN107566516B (en) * 2017-09-25 2019-12-03 平安科技(深圳)有限公司 Concurrent amount control method, application server and system
CN114461668A (en) * 2021-12-21 2022-05-10 天翼云科技有限公司 MYSQL database query method and device based on thread pool
CN115495107A (en) * 2022-10-08 2022-12-20 中银金融科技有限公司 Version deployment method and device and electronic equipment
CN115796766A (en) * 2022-11-14 2023-03-14 重庆市通信产业服务有限公司中冉信息分公司 Arranging method and device of high-concurrency workflow, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112230901A (en) * 2020-10-29 2021-01-15 厦门市易联众易惠科技有限公司 Network programming framework system and method based on asynchronous IO model
CN113420007A (en) * 2021-03-31 2021-09-21 阿里巴巴新加坡控股有限公司 Audit processing method and device for database access and electronic equipment

Also Published As

Publication number Publication date
CN118075059A (en) 2024-05-24

Similar Documents

Publication Publication Date Title
JP6937918B2 (en) Video live broadcasting method and equipment
CN111459418B (en) RDMA (remote direct memory Access) -based key value storage system transmission method
WO2016177285A1 (en) Data pushing method and device
CA3131954C (en) Information synchronization method, system, apparatus, computer device and storage medium
CN112751847A (en) Interface call request processing method and device, electronic equipment and storage medium
TW201724001A (en) System and method for acquiring, processing and updating global information
CN112866421B (en) Intelligent contract operation method and device based on distributed cache and NSQ
CN110764688A (en) Method and device for processing data
CN101751297A (en) Information system to which a large number of clients can log in and method for large number of clients to log in to same
WO2017015059A1 (en) Efficient cache warm up based on user requests
CN113746641B (en) ODX protocol processing method based on distributed storage
US20040139144A1 (en) Using web services to access computational grids by non-members of the grid
US20200314632A1 (en) Policy enhancement for mixed capability devices
CN118075059B (en) Gateway execution method, device and equipment based on MySQL protocol
CN114003571A (en) Data processing method and device, electronic equipment and storage medium
WO2021073405A1 (en) Data distribution method, electronic device, and storage medium
CN113377817A (en) Data processing method, system, device and storage medium
CN115840862B (en) Rapid target query method and system in large-scale scene of network target range
Gao et al. Lazy update propagation for data replication in cloud computing
CN113986133A (en) Data processing method and device, data storage system and electronic equipment
CN111294383B (en) Internet of things service management system
CN111478932B (en) Intelligent contract data processing method, block chain network and storage medium
Zhou et al. Dynamic random access for hadoop distributed file system
CN107332679B (en) Centerless information synchronization method and device
CN112463748A (en) Storage system file lock identification method, system, terminal 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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20240619

Address after: 310000 rooms 203 and 204, block B, No. 51, Xiba Road, Wuchang Street, Yuhang District, Hangzhou City, Zhejiang Province

Applicant after: Hangzhou shiatomic Technology Co.,Ltd.

Country or region after: China

Address before: Room 203, Building 12, Zone A, Yangtze River Digital Base, No. 7 Pudong North Road, Jiangbei New Area, Nanjing City, Jiangsu Province, 210000

Applicant before: Nanjing Shiato Technology Co.,Ltd.

Country or region before: China

GR01 Patent grant
GR01 Patent grant