WO2020048391A1 - 基于多租户技术的web服务的部署、调用方法和装置 - Google Patents

基于多租户技术的web服务的部署、调用方法和装置 Download PDF

Info

Publication number
WO2020048391A1
WO2020048391A1 PCT/CN2019/103532 CN2019103532W WO2020048391A1 WO 2020048391 A1 WO2020048391 A1 WO 2020048391A1 CN 2019103532 W CN2019103532 W CN 2019103532W WO 2020048391 A1 WO2020048391 A1 WO 2020048391A1
Authority
WO
WIPO (PCT)
Prior art keywords
web service
tenant
private
request
business system
Prior art date
Application number
PCT/CN2019/103532
Other languages
English (en)
French (fr)
Inventor
韩晓飞
Original Assignee
京东数字科技控股有限公司
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 京东数字科技控股有限公司 filed Critical 京东数字科技控股有限公司
Publication of WO2020048391A1 publication Critical patent/WO2020048391A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • 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/04Protocols for data compression, e.g. ROHC
    • 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/22Parsing or analysis of headers

Definitions

  • the present invention relates to the field of computer technology, and in particular, to a method and device for deploying and calling web services based on multi-tenant technology.
  • Multi-tenancy technology is a software architecture technology that discusses and implements how to share the same business system or program components in a multi-user environment and still ensure data between users Isolation.
  • the existing multi-tenant technology simply means that a single business instance can serve multiple organizations or systems.
  • the business instance is a system that can support multi-tenant technology, and these multiple organizations or systems constitute this business.
  • the business instance supporting multi-tenant technology needs to be designed to virtualize its data and configuration, so that each tenant of the business instance can use a separate system instance , And each tenant can personalize the leased system instance according to their own needs.
  • the core of the existing multi-tenant technology lies in the virtual partitioning of the data and configuration of the business instances supporting the multi-tenant technology.
  • Java the programming language
  • most existing multi-tenant technology implementation solutions are based on Hibernate to implement the virtual partition of the data and configuration of the business instance, and then the business instance is deployed on the JVM (Java Virtual Machine, Java virtual machine) Thereby implementing a multi-tenant system.
  • JVM Java Virtual Machine, Java virtual machine
  • threads are the main way of working of the JVM in the Java language
  • multi-tenant systems deployed on the JVM generally perform business processing based on threads.
  • Hibernate is an object-relational mapping framework, which is mainly used to map data-layer entity objects in the user's business system to database tables.
  • the implementation of the multi-tenant technology based on Hibernate can establish an independent data source for each tenant, which is equivalent to isolating several sub-libraries in the database.
  • Web World Wide Web, also known as the World Wide Web
  • requests are intercepted by the request interceptor, and forwarded to the tenant resolver;
  • the tenant resolver resolves the corresponding tenant identification ID (identification) from the web request and sends the tenant identification ID to the multi-tenant link manager;
  • the multi-tenant link manager obtains the corresponding schema of the tenant and binds the data source of the tenant to the data source manager;
  • the web controller obtains the corresponding data source from the data source manager to process the business request and returns the corresponding result;
  • the existing technology is based on threads for business processing, so there will be the following problems: Limiting the type of request. If the business request initiated by the tenant is not an atomic request and requires multiple sub-threads to co-process, the existing multi-tenant system cannot efficiently process it; Even without any business requests, the existing multi-tenant system still needs to maintain a certain amount of threads (daemon threads for each tenant); the blocked threads cannot handle new requests, and the thread callback overhead is very large. Before the callback, the thread cannot receive new tasks; the creation and maintenance costs of the thread are too high, and blocking, synchronization, and deadlock issues need to be considered.
  • embodiments of the present invention provide a method and device for deploying and invoking web services based on multi-tenant technology, which can deploy multiple business systems in the form of tenants on the same web service platform to achieve business service isolation.
  • cross-domain remote procedure calls can be converted into local calls, thereby saving the overhead of network communication and interaction, and improving response efficiency.
  • a method for deploying a web service based on multi-tenant technology includes Acquiring a tenant registration request of a business system, the tenant registration request including a configuration file and an executable class file of the business system; parsing the configuration file, generating a permission verification rule for a private method therein, and loading the The executable class file is described; a port is allocated to the business system and published as a web service.
  • a device for deploying a web service based on multi-tenant technology which deploys no less than one business system to a web service platform in the form of a tenant.
  • the device includes: a request acquisition module For obtaining a tenant registration request of a business system, the tenant registration request including a configuration file and an executable class file of the business system; a parsing loading module for parsing the configuration file and generating a private method therein A permission checking rule, and loading the executable class file; a service publishing module, configured to allocate a port for the business system and publish it as a web service.
  • a method for invoking a web service based on a multi-tenant technology is provided, and the web service is deployed according to a method for deploying a web service based on a multi-tenant technology as provided in an embodiment of the present invention
  • the calling method includes: obtaining a request type of a web service call request initiated by a user; when the request type is a private request, performing a permission check on the user; and when the permission check passes, responding to the web service Invoke the request.
  • a device for invoking a web service based on a multi-tenant technology is provided, and the web service is deployed according to a method for deploying a web service based on a multi-tenant technology as provided in an embodiment of the present invention.
  • the calling device includes a type acquisition module for acquiring a request type of a web service invocation request initiated by a user, and a permission verification module for performing permission verification on the user when the request type is a private request.
  • a request response module configured to respond to the web service call request when the permission check passes.
  • an electronic device including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are used by the one Or multiple processors, so that the one or more processors implement the method for deploying and invoking a web service based on the multi-tenant technology provided by the embodiment of the present invention.
  • a computer-readable medium having stored thereon a computer program that, when executed by a processor, implements a multi-tenant technology-based web service provided by an embodiment of the present invention. Deploy and invoke methods.
  • An embodiment of the above invention has the following advantages or beneficial effects: by acquiring a tenant registration request of a business system, and analyzing a configuration file of the business system to generate a permission verification rule for a private method, and loading an executable class of the business system After the file, the business system is assigned a port and published as a web service, which implements a web service deployment method based on multi-tenant technology. Based on the multi-tenant technology theory, multiple business systems are deployed as tenants on the same web service platform. In order to achieve business service isolation, in this way, cross-domain remote procedure calls can be converted into local calls, thereby saving the overhead of network communication and interaction and improving response efficiency. In addition, the present invention can also use coroutines for business processing.
  • Coroutines are more flexible in switching mode than threads, and can save the creation and maintenance overhead of threads, and improve the throughput under distributed high concurrency. You can also save the executable class file of the business system to the database or disk corresponding to the workspace of the web service platform, instead of loading it directly into the JVM.
  • the class file is only generated when the business system is called Dynamic loading and execution, and release resources after the completion of business processing, to achieve dynamic loading and unloading of classes, thereby improving the effective utilization of the JVM.
  • FIG. 1 is a schematic diagram of main steps of a method for deploying a web service based on a multi-tenant technology according to an embodiment of the present invention
  • FIG. 2 is a system architecture diagram of an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a web service deployment process according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of main modules of an apparatus for deploying a web service based on a multi-tenant technology according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of a calling process of a web service according to an embodiment of the present invention.
  • FIG. 6 is an exemplary system architecture diagram to which embodiments of the present invention can be applied;
  • FIG. 7 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
  • the present invention provides a web service deployment method. Based on the multi-tenant technology theory, multiple business systems are deployed in the form of tenants on the same web service platform to achieve business service isolation. Cross-domain remote procedure calls can be converted into local calls, which saves network communication and interaction overhead, and improves response efficiency.
  • the present invention implements a multi-tenant system for business service isolation by embedding a web server as a web service platform and registering an external business system instance as a tenant to the web service platform. Specifically, after receiving the tenant registration request of the business system example, first assign a tenant ID to the tenant; and then obtain the configuration information corresponding to the business system according to the tenant ID to resolve the service alias provided by the tenant (or the The domain name of the tenant, other tenants can access the tenant through the service alias), private service interface (that is, only methods that the tenant can call itself), public service interface (methods that all tenants can share), calls to external systems Service alias (that is, the service alias of other systems that the current tenant needs to access), service interface (no distinction between public and private), data source fragmentation information, etc .; then, obtain the executable class file of the business system according to the tenant identity and load it into In the JVM, the specific implementation requires a Java-based class loading mechanism.
  • the tenant's executable resource package is not loaded by the Java class loader, it needs to be loaded by itself.
  • the tenant's resource files can also be loaded.
  • Weaving (connecting aspects to other application types or objects and creating a notification Object, such a behavior is called weaving) identification that is, adding a tenant identifier tenantId that does not affect the running of the program to the compiled bytecode file to achieve the encoding of the tenant; finally, the business system instance is published as a web service Different from other web services by port.
  • a lock can also be configured for the private service interface, so that the tenant holding the lock can access the private method of the business system instance.
  • FIG. 1 is a schematic diagram of main steps of a method for deploying a web service based on a multi-tenant technology according to an embodiment of the present invention.
  • the method for deploying a web service based on the multi-tenant technology in the embodiment of the present invention mainly includes the following steps S101 to S103 .
  • Step S101 Obtain a tenant registration request of a business system.
  • the tenant registration request includes a configuration file and an executable class file of the business system.
  • Step S102 Parse a configuration file, generate a permission verification rule for the private method therein, and load an executable class file;
  • Step S103 Assign a port to the business system and publish it as a web service.
  • the resource files such as the executable files of the tenant can be isolated through data in step S102, and the intervention code is dynamically injected during the loading process to realize the suspension and wake-up of the general thread.
  • the intervention code is dynamically injected during the loading process to realize the suspension and wake-up of the general thread.
  • a permission verification rule is added to the annotation of the dependent method.
  • the dependent method refers to the method that the private method needs to depend on when it is executed. If the private method has a dependent method, when the private method is called and executed, the dependent method needs to be executed. At this time, the user can be checked for permissions according to the permission checking rule saved in the annotation of the dependent method.
  • the permission verification rule can be flexibly set according to requirements. For example, it can be generating a token key pair and using the token key pair to perform permission verification, or it can generate a check code and use the check code to perform permission verification. ,and many more.
  • the method may further include: marking a method declared in an executable class file of the business system using a coroutine processing method, and marking the availability of the business system.
  • the executed class file is updated to the marked class file.
  • loading the executable class file includes parsing the executable class file, and weaving intervention code into the marked method to implement the suspension and wake-up of the general thread.
  • coroutines like a subroutine, is also a program component.
  • a subroutine is part of the code of a main program. This code performs a specific task and is relatively independent of other code in the main program.
  • coroutines are more general and flexible, but in practice there are no subroutines.
  • the process is as extensive. Coroutines and threads are relatively independent, with multiple threads having their own context, but switching is controlled by the system; while multiple coroutines are also relatively independent and have their own context, but their switching is controlled by themselves and by the current protocol.
  • the process switch to other coroutines is controlled by the current coroutine. Therefore, compared with threads, coroutines are more flexible in their switching methods, and can save the thread creation and maintenance overhead, and improve the throughput under distributed high concurrency.
  • the JVM-based lightweight coroutine performs business processing.
  • the built-in class loader and JVM agent of the present invention when a class file is systematically compiled, a class or method with a coroutine identifier is identified and recorded, and The location of the class or method that contains the coroutine identifier is recorded in a custom file-"coroutine file", which is loaded with the standard Java bytecode file (.class) and coroutine file at load time. Intervention code is woven into the classes and methods to implement the general thread pause (yield method) and wake (notify method). The realization of the yield method of the coroutine of the present invention does not cause memory occupation on the JVM and does not suspend threads, thereby saving the thread creation and maintenance overhead.
  • the coroutine processing mode of the present invention suspends and resumes execution of threads by the business system through the yield action on the coroutines, and processing of distributed transactions in a concurrent environment does not cause the threads to hang and block.
  • the method may further include: storing the executable class file in a database or a disk after serialization and compression processing.
  • the web service platform can also save the executable class file of the business system to the workspace of the web service platform.
  • the database or disk is not directly loaded into the JVM. Only when the business system is called, the class file is dynamically loaded and executed, and resources are released after the business process is completed, realizing the class dynamics. Loading and unloading, which improves the effective utilization of the JVM.
  • the present invention may save the aforementioned executable class file containing the coroutine file to a disk or a database after serialization and compression processing. Only when the coroutine method is called, dynamics are performed according to the coroutine file. Loading and intervening code weaving. If no coroutine method is needed, this process will not produce extra stack frames on the JVM.
  • the class loader reads the coroutine file from the compressed data, so as to obtain the method that contains the coroutine identifier and the method line that requires yield (thread suspension), as well as the parameter name and request type. The class loader loads the target service class according to the parameter name and request type and weaves in the intervention code.
  • the program When the program executes the yield method, it will terminate the execution by throwing an exception, and save the execution result when the execution is suspended to the target as an intermediate value.
  • the intermediate value At the top of the service class stack, when the next call to the web service is initiated, the intermediate value is directly loaded from the last paused position as a variable value and pushed onto the operation stack.
  • the present invention writes a coroutine file to disk by serializing and deserializing an executable class file, which does not consume the memory of the JVM.
  • the class files can be conveniently stored on storage media such as disks and databases.
  • storage media such as disks and databases.
  • the present invention provides two dynamic compression methods. In Windows or Linux systems, English alphabets, numbers, and English half-width symbols occupy one byte. In relational databases such as mysql, varchar type Chinese and English occupy the same.
  • the compression process includes: byte-processing the serialized executable class file to convert it to byte code; and byte code based on the Base64 encoding method Encoding; After cutting the first two digits of the 8-bit binary code corresponding to each byte code, the binary codes of all byte codes are spliced; the binary code obtained after the splicing is divided into 8-bit segments, and Each segment of binary code obtained after division is converted into bytes for compression processing.
  • Base64 is one of the most common encoding methods for transmitting 8Bit (bit) bytecodes on the network.
  • Base64 is a method for representing binary data based on 64 printable characters.
  • 64 bytes of uppercase letters (AZ), lowercase letters (az), numbers (0-9), and English half-width symbols (+ /) are generated through the Base64 encoding processing of byte data.
  • the serialization file generated by the symbol arrangement and combination first establishes the correspondence between 0-63 and 64 symbols, then binarizes 0-63, and then cuts off the first two bits of the 8-bit binary code and the next processed binary
  • the code is spliced, and then every 8 bits are segmented.
  • the binary code after the segmentation process is decimalized and its byte value is output to achieve compression processing.
  • the decompression process is reversed.
  • the compression process includes: establishing a coordinate axis with a vertical axis of 54 and a horizontal axis of 20, and representing an intersection point of the horizontal and vertical axis of each unit as one Chinese character number; serialize the executable class file after serialization to convert to bytecode, and encode the bytecode based on the Base64 encoding method; according to the preset encoding and the coordinate value on the coordinate axis Correspondence relationship, obtain the horizontal and vertical coordinate values corresponding to the encoding, and use the Chinese character number of the corresponding intersection point of the vertical axis and the horizontal axis as a compressed file.
  • 54 refers to a total of 54 symbols consisting of uppercase letters (A-Z), lowercase letters (a-z), and English half-width symbols (+ /), and 20 refers to the number of symbols that may be repeated.
  • A-Z uppercase letters
  • a-z lowercase letters
  • 20 refers to the number of symbols that may be repeated.
  • a coordinate axis with a vertical axis of 54 and a vertical axis of 20 can be established.
  • the intersection point of each unit of the horizontal and vertical axis is replaced by a Chinese character number.
  • the bytecode is processed by Base64, and the connected letters are abbreviated.
  • sssss is recorded as the original value plus the number s5, and then s5 is found on the coordinate axis (where the first character s is the corresponding vertical axis coordinate,
  • the second character 5 corresponds to the Chinese character number and is output to implement the compression process, and the decompression process is reversed.
  • FIG. 2 is a system architecture diagram of an embodiment of the present invention.
  • the web service platform system of the present invention mainly includes a monitoring management platform, a web server, and a database.
  • the monitoring management platform is used to monitor and manage the web service platform system of the present invention, and the user submits the tenant registration request of the business system and the executable resource files of the business system (such as: * .jar, *.) Through the monitoring management platform.
  • zip, * .war, * .tar and configuration information
  • a web server is a container that provides the operating environment of various business systems deployed on the web service platform, where solid lines indicate public methods and data access, and dashed lines indicate private methods and Use of data
  • the database is used to store application data for various business systems.
  • FIG. 3 is a schematic flowchart of a web service deployment process according to an embodiment of the present invention. As shown in Figure 3, taking a business system to register tenants through a web service platform as an example, the web service deployment process mainly includes the following steps:
  • Step S301 The user uploads an engineering compressed package of the business system through the monitoring management platform, wherein the engineering compressed package includes the configuration file and executable class files of the business system, etc .;
  • Step S303 The coder parses the configuration file in the engineering compressed package to obtain the service alias, private service interface, public service interface, service alias, service interface, and data source fragmentation provided by the external system of the business system. id and other information; and, the executable class file in the project compressed package needs to be renamed using the coroutine processing method to add the coroutine identification, the rename format is, for example: the original name _coroutine_ coroutine Method name, and record the location of the method with the coroutine identification added. Finally, move the processed file to the workspace of the web service platform and save it to the disk or database corresponding to the workspace;
  • Step S305 The initializer is used to deploy the business system uploaded to the workspace of the web service platform into the JVM.
  • the JVM agent invokes a custom class loader to load the executable class file and parses the file containing the executable class file.
  • the file identified by the coroutine to generate a coroutine file parse the configuration file, generate a token key pair for the private method, and push the private method and key to the registry; then search the registry for whether the private method has a dependent method If yes, save the secret key to the annotation file of the dependent method;
  • Step S307 the user triggers execution
  • Step S308 The central control transfer device of the web service platform allocates tasks to the splitter
  • Step S309 The splitter obtains an available port from the port pool of the registration center, and publishes the business system as a web service.
  • FIG. 4 is a schematic diagram of main modules of an apparatus for deploying a web service based on a multi-tenant technology according to an embodiment of the present invention.
  • an apparatus 400 for deploying a web service based on a multi-tenant technology according to an embodiment of the present invention mainly includes a request obtaining module 401 and parsing loading Module 402 and service publishing module 403.
  • the request obtaining module 401 is configured to obtain a tenant registration request of a business system, where the tenant registration request includes a configuration file and an executable class file of the business system;
  • the parsing and loading module 402 is configured to parse the configuration file, generate a permission verification rule for a private method therein, and load the executable class file;
  • the service publishing module 403 is configured to allocate a port for the business system and publish it as a web service.
  • the permission verification rule is added to the annotation of the dependent method.
  • the multi-tenant technology-based web service deployment device 400 may further include a marking module (not shown in the figure), configured to: after acquiring a tenant registration request of a business system, send the service The executable class file declared in the system needs to be marked using the coroutine processing method, and the executable class file of the business system is updated to the marked class file.
  • a marking module (not shown in the figure), configured to: after acquiring a tenant registration request of a business system, send the service The executable class file declared in the system needs to be marked using the coroutine processing method, and the executable class file of the business system is updated to the marked class file.
  • the parsing and loading module 402 may be further configured to parse the executable class file and weave intervention code into the marked method to implement the suspension and wake-up of the general thread.
  • the multi-tenant technology-based web service deployment device 400 may further include a file saving module (not shown in the figure), configured to: after obtaining a tenant registration request of a business system, The executable class files are stored in a database or disk after serialization and compression.
  • a file saving module (not shown in the figure), configured to: after obtaining a tenant registration request of a business system, The executable class files are stored in a database or disk after serialization and compression.
  • the compression process includes: byte-processing the serialized executable class file to convert it to byte code; Encode the byte code; cut the first two digits of the 8-bit binary code corresponding to each byte code, and stitch all the binary codes of the byte code; Divide and convert each segment of binary code obtained after the division into bytes for compression.
  • the compression process includes: establishing a coordinate axis with a vertical axis of 54 and a horizontal axis of 20, and representing a Chinese character at the intersection of the horizontal and vertical axes of each unit Symbols; byte-process the serialized executable file to convert to bytecode, and encode the bytecode based on the Base64 encoding method; according to the preset encoding and the coordinates on the axis Correspondence between coordinate values, obtain the horizontal and vertical coordinate values corresponding to the encoding, and use the Chinese character number of the corresponding intersection point of the vertical axis and the horizontal axis as a compressed file.
  • a method and an apparatus for calling a web service are also provided.
  • the web service is deployed according to the method in the foregoing embodiment.
  • the calling method of the web service mainly includes the following steps:
  • performing permission verification on the user includes:
  • performing permission verification on the user includes:
  • FIG. 5 is a schematic flowchart of calling a web service according to an embodiment of the present invention. As shown in FIG. 5, the calling process of the web service according to an embodiment of the present invention mainly includes the following steps:
  • Step S501 The user initiates a web service call request to the web service platform.
  • the call request does not need to distinguish the web service device, and only needs to add the port number corresponding to the web service.
  • the call request is, for example, http: // xxxx : port / x / x;
  • Step S502 After the request reaches the target web service, the IOC (Inversion Control) controller of the web service platform performs permission verification before business processing. Since the web service has a public method and a private method, the user needs to perform Permission check
  • Step S503 the IOC controller determines the request type, and when the request type is a private request, the encryption machine performs permission verification;
  • Step S504 The encryption machine first obtains the key corresponding to the private method of the target web service or the key corresponding to the private method's dependent method key from the registry; then, the encryption machine checks whether the composition of the key is valid (Such as: whether the generation rules are met, and whether it is issued by the web service platform, etc.), and whether the secret key is valid; if so, the verification is passed, and the secret key or successful verification information is sent to the IOC for control Device
  • Step S505 the IOC controller sends the secret key to the target web service
  • Step S506 the target web service requests the dependent service (the service corresponding to the dependent method) for business processing according to the secret key;
  • Step S507 After receiving the request of the target web service, the dependent service will perform the permission verification again by the IOC control system by performing the above steps S502-S504, and after the verification is passed, the IOC controller will send the secret key to the dependent service;
  • Step S508 the dependent service returns a response result to the target web service
  • Step S509 The target web service returns a response result.
  • a device for invoking a web service based on a multi-tenant technology mainly includes:
  • a type acquisition module for acquiring a request type of a web service call request initiated by a user
  • a permission checking module configured to perform a permission check on the user when the request type is a private request
  • a request response module is configured to respond to the web service invocation request when the permission verification passes.
  • the permission verification module may be further configured to: obtain a private method corresponding to the private request; perform permission verification on the user according to the permission verification rule of the private method.
  • the permission checking module may be further configured to: obtain the private method corresponding to the private request; if the private method has a dependent method, obtain the permission checking rule from the annotation of the dependent method; and according to the The authority verification rule performs authority verification on the user.
  • the service by acquiring the tenant registration request of the business system, and analyzing the configuration file of the business system to generate a permission verification rule for the private method, and after loading the executable class file of the business system, the service is The system allocates ports and publishes them as web services, and implements a web service deployment method based on multi-tenant technology. Based on multi-tenant technology theory, multiple business systems are deployed as tenants on the same web service platform to implement business services. Isolation, in this way, you can convert cross-domain remote procedure calls into local calls, thereby saving the overhead of network communication and interaction and improving response efficiency.
  • the present invention can also use coroutines for business processing.
  • Coroutines are more flexible in switching mode than threads, and can save the creation and maintenance overhead of threads, and improve the throughput under distributed high concurrency. You can also save the executable class file of the business system to the database or disk corresponding to the workspace of the web service platform, instead of loading it directly into the JVM.
  • the class file is only generated when the business system is called Dynamic loading and execution, and release resources after the completion of business processing, to achieve dynamic loading and unloading of classes, thereby improving the effective utilization of the JVM.
  • FIG. 6 illustrates an exemplary system architecture 600 of a method for deploying and invoking a web service based on a multi-tenant technology or a web service based on a multi-tenant technology in an embodiment of the present invention.
  • the system architecture 600 may include terminal devices 601, 602, and 603, a network 604, and a server 605.
  • the network 604 is used to provide a medium for a communication link between the terminal devices 601, 602, 603 and the server 605.
  • the network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • Terminal devices 601, 602, and 603 Users can use terminal devices 601, 602, and 603 to interact with the server 605 through the network 604 to receive or send messages and the like.
  • Various communication client applications can be installed on the terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, and the like (only examples).
  • the terminal devices 601, 602, and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
  • the server 605 may be a server that provides various services, for example, a background management server that provides support for a shopping website browsed by a user using the terminal devices 601, 602, and 603 (only examples).
  • the background management server can analyze and process the received product information query request and other data, and feed back the processing results (such as target push information and product information-just examples) to the terminal device.
  • the method for deploying and invoking a web service based on multi-tenant technology is generally executed by the server 605, and accordingly, the device for deploying and invoking a web service based on the multi-tenant technology is generally set on the server 605 in.
  • terminal devices, networks, and servers in FIG. 6 are merely exemplary. According to implementation needs, there can be any number of terminal devices, networks, and servers.
  • FIG. 7 illustrates a schematic structural diagram of a computer system 700 suitable for implementing a terminal device or server according to an embodiment of the present invention.
  • the terminal device or server shown in FIG. 7 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present invention.
  • the computer system 700 includes a central processing unit (CPU) 701, which can be loaded into a random access memory (RAM) 703 from a program stored in a read-only memory (ROM) 702 or from a storage section 708. Instead, perform various appropriate actions and processes.
  • RAM random access memory
  • ROM read-only memory
  • various programs and data required for the operation of the system 700 are also stored.
  • the CPU 701, ROM 702, and RAM 703 are connected to each other through a bus 704.
  • An input / output (I / O) interface 705 is also connected to the bus 704.
  • the following components are connected to the I / O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage portion 708 including a hard disk and the like And a communication section 709 including a network interface card such as a LAN card, a modem, and the like.
  • the communication section 709 performs communication processing via a network such as the Internet.
  • the driver 710 is also connected to the I / O interface 705 as needed.
  • a removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
  • the process described above with reference to the flowchart may be implemented as a computer software program.
  • the disclosed embodiments include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network through the communication section 709, and / or installed from a removable medium 711.
  • this computer program is executed by a central processing unit (CPU) 701
  • CPU central processing unit
  • the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the foregoing.
  • the computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programming read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium containing or storing a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • the computer-readable signal medium may include a data signal transmitted in baseband or transmitted as a part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
  • each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, which contains one or more of the logic functions used to implement the specified logic.
  • Executable instructions may also occur in a different order than those marked in the drawings. For example, two successively represented boxes may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with A combination of dedicated hardware and computer instructions.
  • the units or modules involved in the embodiments of the present invention may be implemented by software or hardware.
  • the described unit or module may also be provided in a processor, for example, it may be described as: a processor includes a request obtaining module, a parsing loading module, and a service publishing module.
  • a processor includes a request obtaining module, a parsing loading module, and a service publishing module.
  • the names of these units or modules do not in any way constitute a limitation on the units or modules themselves.
  • the request acquisition module can also be described as "a module for acquiring a tenant registration request of a business system".
  • the present invention also provides a computer-readable medium.
  • the computer-readable medium may be included in the device described in the foregoing embodiments, or may exist alone without being assembled into the device.
  • the computer-readable medium carries one or more programs, and when the one or more programs are executed by one of the devices, the device includes: a tenant registration request to obtain a business system, and the tenant registration request includes the business system Configuration file and executable class file; parse the configuration file and generate permission verification rules for the private methods in it, and load the executable class file; assign a port to the business system and publish it as web services.
  • the service by acquiring the tenant registration request of the business system, and analyzing the configuration file of the business system to generate a permission verification rule for the private method, and after loading the executable class file of the business system, the service is The system allocates ports and publishes them as web services, and implements a web service deployment method based on multi-tenant technology. Based on multi-tenant technology theory, multiple business systems are deployed as tenants on the same web service platform to implement business services. Isolation, in this way, you can convert cross-domain remote procedure calls into local calls, thereby saving the overhead of network communication and interaction and improving response efficiency.
  • the present invention can also use coroutines for business processing.
  • Coroutines are more flexible in switching mode than threads, and can save the creation and maintenance overhead of threads, and improve the throughput under distributed high concurrency. You can also save the executable class file of the business system to the database or disk corresponding to the workspace of the web service platform, instead of loading it directly into the JVM.
  • the class file is only generated when the business system is called Dynamic loading and execution, and release resources after the completion of business processing, to achieve dynamic loading and unloading of classes, thereby improving the effective utilization of the JVM.

Abstract

本发明公开了一种基于多租户技术的web服务的部署、调用方法和装置,涉及计算机技术领域。该部署方法将不少于一个业务系统以租户的形式部署到web服务平台,其一具体实施方式包括:获取业务系统的租户注册请求,租户注册请求包括业务系统的配置文件和可执行的类文件;解析配置文件,并为其中的私有方法生成权限校验规则,以及加载可执行的类文件;为业务系统分配端口并将其发布为web服务。该实施方式能够将多个业务系统以租户的形式部署于同一个web服务平台上以实现业务服务隔离,如此,即可将跨域的远程过程调用转化为本地调用,从而节省网络通信、交互等的开销,提高响应效率。

Description

基于多租户技术的web服务的部署、调用方法和装置 技术领域
本发明涉及计算机技术领域,尤其涉及一种基于多租户技术的web服务的部署、调用方法和装置。
背景技术
多租户技术(multi-tenancy technology)或称多重租赁技术,是一种软件架构技术,它探讨与实现如何于多用户的环境下共用相同的业务系统或程序组件,并且仍可确保各用户间数据的隔离性。
现有的多租户技术,简单来说是指一个单独的业务实例可以为多个组织或系统服务,该业务实例即为可支持多租户技术的系统,这多个组织或系统即构成了这个业务实例的多个租户,它们共用该业务实例的数据中心。为了保障多个租户之间的数据隔离,该支持多租户技术的业务实例需要在设计上对它的数据和配置进行虚拟分区,从而使该业务实例的每个租户都能够使用一个单独的系统实例,并且每个租户都可以根据自己的需求对租用的系统实例进行个性化配置。
现有的多租户技术的核心在于对支持多租户技术的业务实例的数据和配置进行虚拟分区。以Java作为编程语言为例,现有的多租户技术的实现方案多是基于Hibernate来实现业务实例的数据和配置的虚拟分区,然后将业务实例部署于JVM(Java Virtual Machine,Java虚拟机)上从而实现多租户系统。由于在Java语言中线程是JVM工作的主要方式,故而部署于JVM上的多租户系统一般基于线程来进行业务处理,通过为每个租户分配守护线程,使多租户可以访问同一个对象,从而使程序具备并发处理的能力,最大限度的发挥目前多核处理器的运算能力。其中,Hibernate是对象关系映射框架,主要用来将用户业务系统中的数据层实体对象与数据库表进行映射。基于Hibernate的多租户技术的实现可以为每个租户建立一个独立的数据源,相当于在数据库中隔离出了若干个子库。
现有的基于Hibernate实现的部署于JVM上的多租户系统的调用过 程如下:
1、为多租户系统配置公共/私有架构schema(架构的作用是定义一份文档的合法组件群,或者是系统执行的约束规则),分别对应共享区和私有区,并将配置的架构schema保存到不同数据源中;
2、通过请求拦截器拦截web(World Wide Web,即全球广域网,也称为万维网)请求,并转发给租户解析器;
3、租户解析器从web请求中解析出对应的租户标识ID(identification),并将租户标识ID发送给多租户链接管理器;
4、多租户链接管理器获取该租户对应的schema,绑定该租户的数据源到数据源管理者;
5、web控制器从数据源管理者处拿到对应的数据源处理业务请求并返回对应结果;
6、重复步骤2-5。
在实现本发明过程中,发明人发现现有技术中至少存在如下问题:
1、当出现跨域请求(例如:远程过程调用RPC请求)时,现有的多租户系统在进行跨域访问时会存在网络开销问题;
2、随着私有类型租户的增加,为私有类型租户建立的数据源也会增加,导致数据库资源开销会迅速增大;
3、现有技术是基于线程进行业务处理,故会存在以下问题:限制请求类型,若租户发起的业务请求不是原子请求,需要多个子线程协作处理时,现有的多租户系统无法高效处理;即便是在无任何业务请求的情况下,现有的多租户系统仍需要维护一定量的线程(每个租户的守护线程);阻塞中的线程无法处理新的请求,线程的回调开销很大,在回调前线程无法接收新的任务;线程的创建、维护成本太高,需要考虑阻塞、同步、死锁等问题。
发明内容
有鉴于此,本发明实施例提供一种基于多租户技术的web服务的部署、调用方法和装置,能够将多个业务系统以租户的形式部署于同一个web服务平台上以实现业务服务隔离,如此,即可将跨域的远程 过程调用转化为本地调用,从而节省网络通信、交互等的开销,提高响应效率。
为实现上述目的,根据本发明实施例的一个方面,提供了一种基于多租户技术的web服务的部署方法,将不少于一个业务系统以租户的形式部署到web服务平台,所述方法包括:获取业务系统的租户注册请求,所述租户注册请求包括所述业务系统的配置文件和可执行的类文件;解析所述配置文件,并为其中的私有方法生成权限校验规则,以及加载所述可执行的类文件;为所述业务系统分配端口并将其发布为web服务。
根据本发明实施例的另一方面,提供了一种基于多租户技术的web服务的部署装置,将不少于一个业务系统以租户的形式部署到web服务平台,所述装置包括:请求获取模块,用于获取业务系统的租户注册请求,所述租户注册请求包括所述业务系统的配置文件和可执行的类文件;解析加载模块,用于解析所述配置文件,并为其中的私有方法生成权限校验规则,以及加载所述可执行的类文件;服务发布模块,用于为所述业务系统分配端口并将其发布为web服务。
根据本发明实施例的又一方面,提供了一种基于多租户技术的web服务的调用方法,所述web服务按照如本发明实施例所提供的基于多租户技术的web服务的部署方法进行部署,所述调用方法包括:获取用户发起的web服务调用请求的请求类型;当所述请求类型为私有请求时,对所述用户进行权限校验;当权限校验通过时,响应所述web服务调用请求。
根据本发明实施例的又一方面,提供了一种基于多租户技术的web服务的调用装置,所述web服务按照如本发明实施例所提供的基于多租户技术的web服务的部署方法进行部署,所述调用装置包括:类型获取模块,用于获取用户发起的web服务调用请求的请求类型;权限校验模块,用于当所述请求类型为私有请求时,对所述用户进行权限校验;请求响应模块,用于当权限校验通过时,响应所述web服务调用请求。
根据本发明实施例的又一方面,提供了一种电子设备,包括:一 个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本发明实施例所提供的基于多租户技术的web服务的部署、调用方法。
根据本发明实施例的再一方面,提供了一种计算机可读介质,其上存储有计算机程序,所述程序被处理器执行时实现本发明实施例所提供的基于多租户技术的web服务的部署、调用方法。
上述发明中的一个实施例具有如下优点或有益效果:通过获取业务系统的租户注册请求,并对业务系统的配置文件进行解析以为私有方法生成权限校验规则,以及加载业务系统的可执行的类文件之后,为业务系统分配端口并发布为web服务,实现了基于多租户技术的web服务的部署方法,基于多租户的技术理论,将多个业务系统以租户的形式部署于同一个web服务平台上以实现业务服务隔离,如此,即可将跨域的远程过程调用转化为本地调用,从而节省网络通信、交互等的开销,提高响应效率。另外,本发明还可以使用协程的方式进行业务处理,协程相对线程来说,其切换方式更为灵活,并且可节省线程的创建、维护开销,提高分布式高并发下的吞吐量;同时,还可以将业务系统的可执行的类文件保存到web服务平台的工作空间对应的数据库或磁盘中,而并不是直接加载到JVM中,只有当该业务系统被调用时,才会进行类文件的动态加载和执行,并且在业务处理完成后即释放资源,实现了类的动态加载和卸载,从而提高了JVM的有效利用率。
上述的非惯用的可选方式所具有的进一步效果将在下文中结合具体实施方式加以说明。
附图说明
附图用于更好地理解本发明,不构成对本发明的不当限定。其中:
图1是根据本发明实施例的基于多租户技术的web服务的部署方法的主要步骤示意图;
图2是本发明实施例的系统架构图;
图3是本发明实施例的web服务的部署流程示意图;
图4是根据本发明实施例的基于多租户技术的web服务的部署装置的主要模块示意图;
图5是本发明实施例的web服务的调用流程示意图;
图6是本发明实施例可以应用于其中的示例性系统架构图;
图7是适于用来实现本发明实施例的终端设备或服务器的计算机系统的结构示意图。
具体实施方式
以下结合附图对本发明的示范性实施例做出说明,其中包括本发明实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本发明的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。
现有的多租户系统多是通过对支持多租户技术的业务实例的数据和配置进行虚拟分区以实现数据和配置隔离,但是无法做到服务隔离,故而当出现跨域访问时会存在网络开销的问题。为了解决这个技术问题,本发明提供了一种web服务的部署方法,基于多租户技术理论,将多个业务系统以租户的形式部署于同一个web服务平台上以实现业务服务隔离,如此,即可将跨域的远程过程调用转化为本地调用,从而节省网络通信、交互等的开销,提高响应效率。
本发明通过内嵌web服务器作为web服务平台,并将外部的业务系统实例作为租户注册到web服务平台,从而实现了业务服务隔离的多租户系统。具体地,在接收到业务系统示例的租户注册请求后,首先为该租户分配一个租户标识;之后可根据租户标识获取业务系统对应的配置信息,以解析出该租户对外提供的服务别名(或该租户的域名,别的租户可以通过该服务别名来访问该租户)、私有服务接口(即只允许该租户自己调用的方法)、公共服务接口(所有的租户可以共享的方法)、调用外部系统的服务别名(即当前租户需要访问的其它系统的服务别名)、服务接口(不区分公有和私有),数据源分片信 息等;然后,根据租户标识获取业务系统的可执行的类文件并加载到JVM中,具体实现时需基于Java的类加载机制,由于租户的可执行资源包处于Java类加载器加载不到的地方,故需要自行加载,在加载的过程中还可以对该租户的资源文件织入(把切面连接到其它的应用程序类型或者对象上,并创建一个被通知的对象,这样的行为叫做织入)标识,即在编译后的字节码文件中添加不影响程序运行的租户标识tenantId,以实现对租户进行打码;最后,将业务系统实例发布为web服务并以端口区别于其他的web服务。其中,在对业务系统的配置信息进行解析时,还可以为私有服务接口配置锁,以使持有该锁的租户才能访问该业务系统实例的私有方法。
下面结合附图及具体实施例介绍本发明的web服务的部署方法。
图1是根据本发明实施例的基于多租户技术的web服务的部署方法的主要步骤示意图。,如图1所示,为了实现将不少于一个业务系统以租户的形式部署到web服务平台,本发明实施例的基于多租户技术的web服务的部署方法主要包括如下的步骤S101至步骤S103。
步骤S101:获取业务系统的租户注册请求,租户注册请求包括业务系统的配置文件和可执行的类文件;
步骤S102:解析配置文件,并为其中的私有方法生成权限校验规则,以及加载可执行的类文件;
步骤S103:为业务系统分配端口并将其发布为web服务。
其中,通过步骤S102即可将租户的可执行类文件等资源文件进行数据隔离,并且在进行加载的过程中动态进行干预代码的注入以实现通用线程的暂停和唤醒。通过为私有方法生成权限校验规则,以实现只有指定的用户可以访问该业务系统的私有服务接口,从而实现了服务隔离。在为私有方法生成权限校验规则后,会将私有方法及权限校验规则保存到web平台的租户注册中心,以备后续用户通过该web服务平台访问该业务系统时可以进行权限校验。
根据本发明的一个实施例,若私有方法具有依赖方法,则将权限校验规则添加到依赖方法的注解中。其中,依赖方法指的是该私有方法在执行时需要依赖的方法。若私有方法具有依赖方法,则当该私有 方法被调用执行时,该依赖方法即需要被执行,此时可根据该依赖方法的注解中保存的权限校验规则对用户进行权限校验。其中,权限校验规则根据需要可灵活设定,例如可以是生成令牌秘钥对并使用令牌秘钥对进行权限校验,也可以是生成校验码并使用校验码进行权限校验,等等。
根据本发明的一个实施例,在获取业务系统的租户注册请求之后,还可以包括:将业务系统的可执行的类文件中声明的需要使用协程处理的方法进行标记,并将业务系统的可执行的类文件更新为标记后的类文件。
并且,加载可执行的类文件包括:对可执行的类文件进行解析,将已进行标记的方法中织入干预代码以实现通用线程的暂停和唤醒。
通过该实施例的技术方案,即可使用协程的方式进行业务处理,协程(coroutine)与子例程一样,也是一种程序组件。子例程是某个主程序的一部分代码,该代码执行特定的任务并且与主程序中的其他代码相对独立,相对子例程而言,协程更为一般和灵活,但在实践中使用没有子例程那样广泛。协程与线程相比较来说,多个线程相对独立,有自己的上下文,但是切换受系统控制;而多个协程也相对独立,有自己的上下文,但是其切换由自己控制,由当前协程切换到其他协程由当前协程来控制。因此,协程相对线程来说,其切换方式更为灵活,并且可节省线程的创建、维护开销,提高分布式高并发下的吞吐量。
本发明基于JVM的轻量级协程进行业务处理,根据本发明的内置类加载器和JVM代理器在对类文件进行系统编译时,识别和记录带有协程标识的类或方法,并将含有协程标识的类或方法的位置记录到一个自定义文件——“协程文件”中,在加载时通过配合标准的Java字节码文件(.class)和协程文件在含有协程标识的类和方法上织入干预代码以实现通用线程的暂停(yield方法)和唤醒(notify方法)。本发明协程的yield方法实现不会在JVM上产生内存占用也不会挂起线程,从而可以节省线程的创建和维护开销。
在分布式部署环境中,本发明的协程处理模式通过对协程的yield动作由业务系统控制线程暂停和继续执行,在并发环境下分布式事务 的处理不会造成线程的挂起和阻塞。
根据本发明的另一个实施例,在获取业务系统的租户注册请求之后,还可以包括:将可执行的类文件经过序列化及压缩处理后保存到数据库或磁盘中。
根据该实施例,web服务平台在获取业务系统的租户注册请求及业务系统的配置文件和可执行的类文件之后,还可以将业务系统的可执行的类文件保存到web服务平台的工作空间对应的数据库或磁盘中,而并不是直接加载到JVM中,只有当该业务系统被调用时,才会进行类文件的动态加载和执行,并且在业务处理完成后即释放资源,实现了类的动态加载和卸载,从而提高了JVM的有效利用率。
根据另一个实施例,本发明可将前述包含有协程文件的可执行的类文件通过序列化及压缩处理后保存到磁盘或者数据库,只有当调用协程方法时才会根据协程文件进行动态加载和干预代码的织入。如不需要协程方法,该过程不会在JVM上生产多余栈帧。当该web服务被调用时,类加载器会从压缩数据中读取协程文件,从而获取包含有协程标识的方法和需要yield(线程暂停)的方法行,以及参数名称和请求类型。类加载器根据参数名称和请求类型加载目标服务类并织入干预代码,当程序执行到yield方法时会通过抛出异常的方式终止执行,并将中止执行时的执行结果作为中间值保存到目标服务类的栈顶,等待下次发起对该web服务的调用时,直接从上次暂停的位置加载中间值作为变量值并压入操作栈。
在大规模的业务集成环境中,本发明通过对可执行的类文件的序列化和反序列化以将协程文件写入磁盘,该过程不会损耗JVM的内存。
通过对运行时对象的序列化和字节(byte)化再进行文件化,可以便捷的将类文件存储到磁盘、数据库等存储介质上。根据不同的介质对数据大小的定义不同本发明提供两种动态压缩方式。在windows或linux系统中英文字母、数字、英文半角符号占用一个字节,在mysql等关系型数据库中varchar类型中文与英文占用是一致的。
在本发明的一个实施例中,若保存到数据库中,则压缩处理包括:将序列化后的可执行的类文件进行字节化处理以转换为字节码;基于 Base64编码方式对字节码进行编码;将每个字节码对应的8位二进制码的前两位切割掉之后,将所有字节码的二进制码拼接;对拼接后得到的二进制码按照每8位为一段进行分割,并将分割后得到的每段二进制码十进制化后转换为字节以进行压缩处理。
其中,Base64是网络上最常见的用于传输8Bit(位)字节码的编码方式之一,Base64就是一种基于64个可打印字符来表示二进制数据的方法。
在服务器的磁盘介质中,通过对字节化数据的Base64编码处理,会产生由大写字母(A-Z)、小写字母(a-z)、数字(0-9)、英文半角符号(+/)共64个符号排列组合产生的序列化文件,首先建立0-63与64个符号的对应关系,然后对0-63进行二进制化,之后将8位的二进制码切割掉前两位与下一个处理后的二进制码拼接,然后进行每8位一段的分割,对分割处理后的二进制码十进制化并获取其字节值输出以实现压缩处理,解压缩过程相反。
在本发明的另一个实施例中,若保存到磁盘中,则压缩处理包括:建立一个纵轴为54横轴为20的坐标轴,并以每一个单元横、纵坐标轴的相交点表示一个汉字符号;将序列化后的可执行的类文件进行字节化处理以转换为字节码,并对字节码基于Base64编码方式进行编码;根据预设的编码与坐标轴上的坐标值的对应关系,获取编码对应的横、纵坐标值,并将对应的纵轴和横轴的相交点的汉字符号作为压缩文件。
其中,54指的是由大写字母(A-Z)、小写字母(a-z)和英文半角符号(+/)共有54个符号,20指的是可能重复的符号的个数。具体地,对于关系型数据库中类文件的存储,可建立一个纵轴为54纵轴横轴为20的坐标轴,每一个单元横纵轴相交点用一个汉字符号代替位置,将字节化后的字节码进行Base64处理,对于相连的字母进行简记,例如sssss记为原值加个数的形式s5,然后在坐标轴上寻找s5(其中,第一个字符s即对应纵轴坐标,第二个字符5即对应横轴坐标)对应的汉字符号并输出以实现压缩处理,解压缩过程相反。
图2是本发明实施例的系统架构图。如图2所示,本发明的web服务平台系统主要包括监控管理平台、web服务器和数据库3部分。其 中,监控管理平台用于对本发明的web服务平台系统进行监控和管理,用户通过监控管理平台提交业务系统的租户注册请求,以及业务系统的可执行的资源文件(如:*.jar,*.zip,*.war,*.tar)以及配置信息等;web服务器是提供部署于web服务平台的各业务系统的运行环境的容器,其中实线表示公共方法与数据的访问,虚线表示私有方法和数据的使用;数据库用于存储各业务系统的应用数据。
图3是本发明实施例的web服务的部署流程示意图。如图3所示,以一个业务系统通过web服务平台进行租户注册为例,web服务的部署流程主要包括如下的步骤:
步骤S301:用户通过监控管理平台上传业务系统的工程压缩包,其中,工程压缩包内包括业务系统的配置文件和可执行的类文件等;
步骤S302:web服务平台的中控调拨装置判断当前节点状态并分配给不同的处理器,其中,若“_f_=0”,即该业务系统为首次上传工程压缩包,则将对应的工程压缩包传递给打码器;
步骤S303:打码器对工程压缩包内的配置文件进行解析,以获取该业务系统对外提供的服务别名、私有服务接口、公共服务接口、调用外部系统的服务别名、服务接口,数据源分片id等信息;并且,将工程压缩包内的可执行的类文件中声明的需要使用协程处理的方法进行重命名以实现添加协程标识,重命名的格式例如是:原名_coroutine_协程方法名,并且将添加了协程标识的方法的位置记录下来;最后,将处理后的文件移动到web服务平台的工作空间,并保存到工作空间对应的磁盘或者数据库中;
步骤S304:web服务平台的中控调拨装置在打码器完成处理后,再次判断当前节点状态并分配给不同的处理器,此时,“_f_=1”,表示文件已转移至web服务平台的工作空间,然后将当前节点的任务分配给初始化器;
步骤S305:初始化器用于将上传到web服务平台的工作空间的业务系统部署到JVM中,具体地,通过JVM的代理器调用自定义的类加载器以加载可执行的类文件,并解析其中含有协程标识的文件以生成协程文件;解析配置文件,为私有方法生成令牌秘钥对,并将该私 有方法和秘钥推送到注册中心;然后在注册中心搜索该私有方法是否有依赖方法,如有,则将秘钥保存到该依赖方法的注解文件中;
步骤S306:web服务平台的中控调拨装置在初始化器完成处理后,再次判断当前节点状态,此时,“_f_=2”,表示文件已加载、解析完成,返回监控管理平台文件上传成功;
步骤S307:用户触发执行;
步骤S308:web服务平台的中控调拨装置将任务分配给分离器;
步骤S309:分离器从注册中心的端口池中获取一个可用的端口,并将该业务系统发布为web服务。
其他的业务系统通过web服务平台进行租户注册的过程与上述流程相同。如此,即可将多个业务系统以租户的形式注册到统一的web服务平台,以实现服务隔离。
图4是根据本发明实施例的基于多租户技术的web服务的部署装置的主要模块示意图。如图4所示,为了实现将不少于一个业务系统以租户的形式部署到web服务平台,本发明实施例的基于多租户技术的web服务的部署装置400主要包括请求获取模块401、解析加载模块402和服务发布模块403。
请求获取模块401用于获取业务系统的租户注册请求,所述租户注册请求包括所述业务系统的配置文件和可执行的类文件;
解析加载模块402用于解析所述配置文件,并为其中的私有方法生成权限校验规则,以及加载所述可执行的类文件;
服务发布模块403用于为所述业务系统分配端口并将其发布为web服务。
根据本发明的一个实施例,若所述私有方法具有依赖方法,则将所述权限校验规则添加到所述依赖方法的注解中。
根据本发明的另一个实施例,基于多租户技术的web服务的部署装置400还可以包括标记模块(图中未示出),用于:在获取业务系统的租户注册请求之后,将所述业务系统的可执行的类文件中声明的需要使用协程处理的方法进行标记,并将所述业务系统的可执行的类文件更新为标记后的类文件。
根据本发明的实施例,解析加载模块402还可以用于:对所述可执行的类文件进行解析,将已进行标记的方法中织入干预代码以实现通用线程的暂停和唤醒。
根据本发明的另一个实施例,基于多租户技术的web服务的部署装置400还可以包括文件保存模块(图中未示出),用于:在获取业务系统的租户注册请求之后,将所述可执行的类文件经过序列化及压缩处理后保存到数据库或磁盘中。
根据本发明的一个实施例,若保存到数据库中,则压缩处理包括:将序列化后的所述可执行的类文件进行字节化处理以转换为字节码;基于Base64编码方式对所述字节码进行编码;将每个字节码对应的8位二进制码的前两位切割掉之后,将所有字节码的二进制码拼接;对拼接后得到的二进制码按照每8位为一段进行分割,并将分割后得到的每段二进制码十进制化后转换为字节以进行压缩处理。
根据本发明的另一个实施例,若保存到磁盘中,则压缩处理包括:建立一个纵轴为54横轴为20的坐标轴,并以每一个单元横、纵坐标轴的相交点表示一个汉字符号;将序列化后的所述可执行的类文件进行字节化处理以转换为字节码,并对所述字节码基于Base64编码方式进行编码;根据预设的编码与坐标轴上的坐标值的对应关系,获取所述编码对应的横、纵坐标值,并将对应的纵轴和横轴的相交点的汉字符号作为压缩文件。
根据本发明的另一方面,还提供了一种web服务的调用方法和装置。其中,该web服务是按照前述实施例中的方法进行部署的。该web服务的调用方法主要包括以下的步骤:
获取用户发起的web服务调用请求的请求类型;
当所述请求类型为私有请求时,对所述用户进行权限校验;
当权限校验通过时,响应所述web服务调用请求。
根据本发明的一个实施例,对所述用户进行权限校验包括:
获取所述私有请求对应的私有方法;
根据所述私有方法的权限校验规则对所述用户进行权限校验。
根据本发明的另一个实施例,对所述用户进行权限校验包括:
获取所述私有请求对应的私有方法;
若所述私有方法具有依赖方法,则从所述依赖方法的注解中获取所述权限校验规则;
根据所述权限校验规则对所述用户进行权限校验。
图5是本发明实施例的web服务的调用流程示意图。如图5所示,本发明一个实施例的web服务的调用流程主要包括如下的步骤:
步骤S501:用户向web服务平台发起web服务的调用请求,此时的调用请求中无需区分web服务设备,仅需添加web服务对应的端口号port即可,调用请求例如是:http://xxxx:port/x/x;
步骤S502:请求到达目标web服务后,web服务平台的IOC(Inversion of Control,控制反转)控制器进行业务处理之前的权限校验,由于web服务具有公有方法和私有方法,故需对用户进行权限校验;
步骤S503:IOC控制器判断请求类型,当请求类型为私有请求时,由加密机进行权限校验;
步骤S504:加密机首先从注册中心中获取目标web服务的私有方法对应的秘钥或者与该私有方法的依赖方法的秘钥key对应的秘钥;然后,加密机校验key的构成是否是合法的(例如:是否满足生成规则,以及是否是本web服务平台颁发的,等等),以及秘钥是否合法;如果是,则校验通过,将秘钥或者将校验成功信息发送给IOC控制器;
步骤S505:IOC控制器将秘钥发送到目标web服务;
步骤S506:目标web服务根据秘钥请求依赖服务(依赖方法对应的服务)进行业务处理;
步骤S507:依赖服务在接收到目标web服务的请求后,将由IOC控制系统通过执行上述的步骤S502-S504再次进行权限校验,并在校验通过后,由IOC控制器将秘钥发送到依赖服务;
步骤S508:依赖服务返回响应结果给目标web服务;
步骤S509:目标web服务返回响应结果。
根据本发明的实施例,基于多租户技术的web服务的调用装置主要包括:
类型获取模块,用于获取用户发起的web服务调用请求的请求类型;
权限校验模块,用于当所述请求类型为私有请求时,对所述用户进行权限校验;
请求响应模块,用于当权限校验通过时,响应所述web服务调用请求。
其中,权限校验模块还可以用于:获取所述私有请求对应的私有方法;根据所述私有方法的权限校验规则对所述用户进行权限校验。
另外,权限校验模块还可以用于:获取所述私有请求对应的私有方法;若所述私有方法具有依赖方法,则从所述依赖方法的注解中获取所述权限校验规则;根据所述权限校验规则对所述用户进行权限校验。
根据本发明实施例的技术方案,通过获取业务系统的租户注册请求,并对业务系统的配置文件进行解析以为私有方法生成权限校验规则,以及加载业务系统的可执行的类文件之后,为业务系统分配端口并发布为web服务,实现了基于多租户技术的web服务的部署方法,基于多租户的技术理论,将多个业务系统以租户的形式部署于同一个web服务平台上以实现业务服务隔离,如此,即可将跨域的远程过程调用转化为本地调用,从而节省网络通信、交互等的开销,提高响应效率。另外,本发明还可以使用协程的方式进行业务处理,协程相对线程来说,其切换方式更为灵活,并且可节省线程的创建、维护开销,提高分布式高并发下的吞吐量;同时,还可以将业务系统的可执行的类文件保存到web服务平台的工作空间对应的数据库或磁盘中,而并不是直接加载到JVM中,只有当该业务系统被调用时,才会进行类文件的动态加载和执行,并且在业务处理完成后即释放资源,实现了类的动态加载和卸载,从而提高了JVM的有效利用率。
图6示出了可以应用本发明实施例的基于多租户技术的web服务的部署、调用方法或基于多租户技术的web服务的部署、调用装置的示例性系统架构600。
如图6所示,系统架构600可以包括终端设备601、602、603,网 络604和服务器605。网络604用以在终端设备601、602、603和服务器605之间提供通信链路的介质。网络604可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
用户可以使用终端设备601、602、603通过网络604与服务器605交互,以接收或发送消息等。终端设备601、602、603上可以安装有各种通讯客户端应用,例如购物类应用、网页浏览器应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等(仅为示例)。
终端设备601、602、603可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。
服务器605可以是提供各种服务的服务器,例如对用户利用终端设备601、602、603所浏览的购物类网站提供支持的后台管理服务器(仅为示例)。后台管理服务器可以对接收到的产品信息查询请求等数据进行分析等处理,并将处理结果(例如目标推送信息、产品信息--仅为示例)反馈给终端设备。
需要说明的是,本发明实施例所提供的基于多租户技术的web服务的部署、调用方法一般由服务器605执行,相应地,基于多租户技术的web服务的部署、调用装置一般设置于服务器605中。
应该理解,图6中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。
下面参考图7,其示出了适于用来实现本发明实施例的终端设备或服务器的计算机系统700的结构示意图。图7示出的终端设备或服务器仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。
如图7所示,计算机系统700包括中央处理单元(CPU)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储部分708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM 703中,还存储有系统700操作所需的各种程序和数据。CPU 701、ROM 702以及RAM 703通过总线704彼此相连。输入/ 输出(I/O)接口705也连接至总线704。
以下部件连接至I/O接口705:包括键盘、鼠标等的输入部分706;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分707;包括硬盘等的存储部分708;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分709。通信部分709经由诸如因特网的网络执行通信处理。驱动器710也根据需要连接至I/O接口705。可拆卸介质711,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器710上,以便于从其上读出的计算机程序根据需要被安装入存储部分708。
特别地,根据本发明公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本发明公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分709从网络上被下载和安装,和/或从可拆卸介质711被安装。在该计算机程序被中央处理单元(CPU)701执行时,执行本发明的系统中限定的上述功能。
需要说明的是,本发明所示的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本发明中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本发明中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组 合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本发明实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,可以描述为:一种处理器包括请求获取模块、解析加载模块和服务发布模块。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定,例如,请求获取模块还可以被描述为“用于获取业务系统的租户注册请求的模块”。
作为另一方面,本发明还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的设备中所包含的;也可以是单独存在,而未装配入该设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被一个该设备执行时,使得该设备包括:获取业务系统的租户注册请求,所述租户注册请求包括所述业务系统的配置文件和可执行的类文件;解析所述配置文件,并为其中的私有方法生成权限校验规则,以及加载所述可执行的类文件;为所述业务系统分配端口并将其发布为web服务。
根据本发明实施例的技术方案,通过获取业务系统的租户注册请求,并对业务系统的配置文件进行解析以为私有方法生成权限校验规则,以及加载业务系统的可执行的类文件之后,为业务系统分配端口并发布为web服务,实现了基于多租户技术的web服务的部署方法,基于多租户的技术理论,将多个业务系统以租户的形式部署于同一个web服务平台上以实现业务服务隔离,如此,即可将跨域的远程过程调用转化为本地调用,从而节省网络通信、交互等的开销,提高响应效率。另外,本发明还可以使用协程的方式进行业务处理,协程相对线程来说,其切换方式更为灵活,并且可节省线程的创建、维护开销,提高分布式高并发下的吞吐量;同时,还可以将业务系统的可执行的类文件保存到web服务平台的工作空间对应的数据库或磁盘中,而并不是直接加载到JVM中,只有当该业务系统被调用时,才会进行类文件的动态加载和执行,并且在业务处理完成后即释放资源,实现了类的动态加载和卸载,从而提高了JVM的有效利用率。
上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。

Claims (22)

  1. 一种基于多租户技术的web服务的部署方法,其特征在于,将不少于一个业务系统以租户的形式部署到web服务平台,所述方法包括:
    获取业务系统的租户注册请求,所述租户注册请求包括所述业务系统的配置文件和可执行的类文件;
    解析所述配置文件,并为其中的私有方法生成权限校验规则,以及加载所述可执行的类文件;
    为所述业务系统分配端口并将其发布为web服务。
  2. 根据权利要求1所述的部署方法,其特征在于,若所述私有方法具有依赖方法,则将所述权限校验规则添加到所述依赖方法的注解中。
  3. 根据权利要求1所述的部署方法,其特征在于,获取业务系统的租户注册请求之后,还包括:
    将所述业务系统的可执行的类文件中声明的需要使用协程处理的方法进行标记,并将所述业务系统的可执行的类文件更新为标记后的类文件。
  4. 根据权利要求3所述的部署方法,其特征在于,加载所述可执行的类文件包括:
    对所述可执行的类文件进行解析,将已进行标记的方法中织入干预代码以实现通用线程的暂停和唤醒。
  5. 根据权利要求1所述的部署方法,其特征在于,获取业务系统的租户注册请求之后,还包括:
    将所述可执行的类文件经过序列化及压缩处理后保存到数据库或磁盘中。
  6. 根据权利要求5所述的部署方法,其特征在于,若保存到数据库中,则所述压缩处理包括:
    将序列化后的可执行的类文件进行字节化处理以转换为字节码;
    基于Base64编码方式对所述字节码进行编码;
    将每个字节码对应的8位二进制码的前两位切割掉之后,将所有字节码的二进制码拼接;
    对拼接后得到的二进制码按照每8位为一段进行分割,并将分割后得到的每段二进制码十进制化后转换为字节以进行压缩处理。
  7. 根据权利要求5所述的部署方法,其特征在于,若保存到磁盘中,则所述压缩处理包括:
    建立一个纵轴为54横轴为20的坐标轴,并以每一个单元横、纵坐标轴的相交点表示一个汉字符号;
    将序列化后的可执行的类文件进行字节化处理以转换为字节码,并对所述字节码基于Base64编码方式进行编码;
    根据预设的编码与坐标轴上的坐标值的对应关系,获取所述编码对应的横、纵坐标值,并将对应的纵轴和横轴的相交点的汉字符号作为压缩文件。
  8. 一种基于多租户技术的web服务的部署装置,其特征在于,将不少于一个业务系统以租户的形式部署到web服务平台,所述装置包括:
    请求获取模块,用于获取业务系统的租户注册请求,所述租户注册请求包括所述业务系统的配置文件和可执行的类文件;
    解析加载模块,用于解析所述配置文件,并为其中的私有方法生成权限校验规则,以及加载所述可执行的类文件;
    服务发布模块,用于为所述业务系统分配端口并将其发布为web服务。
  9. 根据权利要求9所述的部署装置,其特征在于,若所述私有方法具有依赖方法,则将所述权限校验规则添加到所述依赖方法的注解中。
  10. 根据权利要求8所述的部署装置,其特征在于,还包括标记模块,用于:
    在获取业务系统的租户注册请求之后,将所述业务系统的可执行的类文件中声明的需要使用协程处理的方法进行标记,并将所述业务系统的可执行的类文件更新为标记后的类文件。
  11. 根据权利要求10所述的部署装置,其特征在于,所述解析加载模块还用于:
    对所述可执行的类文件进行解析,将已进行标记的方法中织入干预代码以实现通用线程的暂停和唤醒。
  12. 根据权利要求8所述的部署装置,其特征在于,还包括文件保存模块,用于:
    在获取业务系统的租户注册请求之后,将所述可执行的类文件经过序列化及压缩处理后保存到数据库或磁盘中。
  13. 根据权利要求12所述的部署装置,其特征在于,若保存到数据库中,则所述压缩处理包括:
    将序列化后的可执行的类文件进行字节化处理以转换为字节码;
    基于Base64编码方式对所述字节码进行编码;
    将每个字节码对应的8位二进制码的前两位切割掉之后,将所有字节码的二进制码拼接;
    对拼接后得到的二进制码按照每8位为一段进行分割,并将分割后得到的每段二进制码十进制化后转换为字节以进行压缩处理。
  14. 根据权利要求12所述的部署装置,其特征在于,若保存到磁盘中,则所述压缩处理包括:
    建立一个纵轴为54横轴为20的坐标轴,并以每一个单元横、纵坐标轴的相交点表示一个汉字符号;
    将序列化后的可执行的类文件进行字节化处理以转换为字节码,并对所述字节码基于Base64编码方式进行编码;
    根据预设的编码与坐标轴上的坐标值的对应关系,获取所述编码对应的横、纵坐标值,并将对应的纵轴和横轴的相交点的汉字符号作为压缩文件。
  15. 一种基于多租户技术的web服务的调用方法,其特征在于,所述web服务按照如权利要求1-7中任一所述的方法进行部署,所述调用方法包括:
    获取用户发起的web服务调用请求的请求类型;
    当所述请求类型为私有请求时,对所述用户进行权限校验;
    当权限校验通过时,响应所述web服务调用请求。
  16. 根据权利要求15所述的调用方法,其特征在于,对所述用户进行权限校验包括:
    获取所述私有请求对应的私有方法;
    根据所述私有方法的权限校验规则对所述用户进行权限校验。
  17. 根据权利要求15所述的调用方法,其特征在于,对所述用户进行权限校验包括:
    获取所述私有请求对应的私有方法;
    若所述私有方法具有依赖方法,则从所述依赖方法的注解中获取所述权限校验规则;
    根据所述权限校验规则对所述用户进行权限校验。
  18. 一种基于多租户技术的web服务的调用装置,其特征在于,所述web服务按照如权利要求1-7中任一所述的方法进行部署,所述调用装置包括:
    类型获取模块,用于获取用户发起的web服务调用请求的请求类型;
    权限校验模块,用于当所述请求类型为私有请求时,对所述用户进行权限校验;
    请求响应模块,用于当权限校验通过时,响应所述web服务调用请求。
  19. 根据权利要求18所述的调用装置,其特征在于,所述权限校验模块还用于:
    获取所述私有请求对应的私有方法;
    根据所述私有方法的权限校验规则对所述用户进行权限校验。
  20. 根据权利要求18所述的调用装置,其特征在于,所述权限校验模块还用于:
    获取所述私有请求对应的私有方法;
    若所述私有方法具有依赖方法,则从所述依赖方法的注解中获取所述权限校验规则;
    根据所述权限校验规则对所述用户进行权限校验。
  21. 一种电子设备,其特征在于,包括:
    一个或多个处理器;
    存储装置,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7和/或15-17中任一所述的方法。
  22. 一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如权利要求1-7和/或15-17中任一所述的方法。
PCT/CN2019/103532 2018-09-04 2019-08-30 基于多租户技术的web服务的部署、调用方法和装置 WO2020048391A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811025208.3 2018-09-04
CN201811025208.3A CN109274731B (zh) 2018-09-04 2018-09-04 基于多租户技术的web服务的部署、调用方法和装置

Publications (1)

Publication Number Publication Date
WO2020048391A1 true WO2020048391A1 (zh) 2020-03-12

Family

ID=65188180

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103532 WO2020048391A1 (zh) 2018-09-04 2019-08-30 基于多租户技术的web服务的部署、调用方法和装置

Country Status (2)

Country Link
CN (1) CN109274731B (zh)
WO (1) WO2020048391A1 (zh)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427684A (zh) * 2020-03-20 2020-07-17 支付宝(杭州)信息技术有限公司 一种服务部署的方法、系统、及装置
CN111580820A (zh) * 2020-05-25 2020-08-25 泰康保险集团股份有限公司 一种小程序生成方法和装置
CN111861140A (zh) * 2020-06-28 2020-10-30 微民保险代理有限公司 一种业务处理方法、装置、存储介质和电子装置
CN112463147A (zh) * 2020-11-26 2021-03-09 杭州览众数据科技有限公司 一种针对通用化模型客制化需求开发框架
CN113495895A (zh) * 2020-04-02 2021-10-12 北京京东振世信息技术有限公司 一种更新数据的方法和装置
CN113515437A (zh) * 2020-04-10 2021-10-19 北京沃东天骏信息技术有限公司 调试接口的方法和装置
CN113535419A (zh) * 2020-04-16 2021-10-22 北京沃东天骏信息技术有限公司 一种服务编排方法和装置
CN113688152A (zh) * 2021-08-30 2021-11-23 北京京东振世信息技术有限公司 一种系统功能自校验方法和装置
CN113778658A (zh) * 2020-09-29 2021-12-10 北京沃东天骏信息技术有限公司 任务分配方法及装置、电子设备、存储介质
CN114595199A (zh) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 文件解析方法、装置、计算机设备和存储介质
CN114693283A (zh) * 2022-06-01 2022-07-01 四川高灯企服科技有限公司 跨系统的业务流程审批处理方法、装置和计算机设备

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109274731B (zh) * 2018-09-04 2020-07-31 京东数字科技控股有限公司 基于多租户技术的web服务的部署、调用方法和装置
CN110708310B (zh) * 2019-09-30 2022-02-08 杭州数梦工场科技有限公司 租户级权限管理方法、装置及设备
CN111581291B (zh) * 2020-05-09 2023-04-28 抖音视界有限公司 数据处理方法、装置、电子设备及可读介质
CN111931103A (zh) * 2020-07-09 2020-11-13 北京皮尔布莱尼软件有限公司 一种网站部署方法
CN113778499B (zh) * 2020-08-21 2023-09-26 北京京东振世信息技术有限公司 发布服务的方法、装置、设备和计算机可读介质
CN112800120B (zh) * 2021-01-26 2023-06-06 政采云有限公司 业务处理方法及装置
CN115509727A (zh) * 2021-06-07 2022-12-23 贵州白山云科技股份有限公司 基于分布式网络的服务代码处理方法、装置、设备及介质
CN113742774B (zh) * 2021-09-03 2024-02-09 北京字跳网络技术有限公司 数据处理方法、装置、可读介质及电子设备
CN115001776B (zh) * 2022-05-26 2024-01-30 浙江网商银行股份有限公司 数据处理系统及方法
CN115268924B (zh) * 2022-06-10 2023-05-02 知学云(北京)科技股份有限公司 一种基于aPaaS平台的公式计算引擎服务方法及系统
CN116107547A (zh) * 2023-01-04 2023-05-12 三峡高科信息技术有限责任公司 一种统一服务与多数据源管理的方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036856A (zh) * 2011-10-09 2013-04-10 镇江金软计算机科技有限责任公司 基于saas应用的多租户系统实现
US8924542B1 (en) * 2011-05-31 2014-12-30 Amazon Technologies, Inc. Methods and apparatus for scalable private services
CN109274731A (zh) * 2018-09-04 2019-01-25 北京京东金融科技控股有限公司 基于多租户技术的web服务的部署、调用方法和装置

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7506175B2 (en) * 2000-11-06 2009-03-17 International Business Machines Corporation File language verification
US6714778B2 (en) * 2001-05-15 2004-03-30 Nokia Corporation Context sensitive web services
US7415704B2 (en) * 2004-05-20 2008-08-19 Sap Ag Sharing objects in runtime systems
CN101192937B (zh) * 2006-11-24 2010-05-12 华为技术有限公司 一种可热部署的方法及其系统
US8825815B2 (en) * 2008-01-08 2014-09-02 Amdocs Software Systems Limited System and method for client synchronization for a communication device
CN102411506B (zh) * 2011-07-07 2014-03-12 杭州典能科技有限公司 Java系统业务单元插件式管理系统及业务功能动态变更方法
CN102323884B (zh) * 2011-09-07 2014-07-09 山东中创软件工程股份有限公司 一种多Web服务发布的方法及Web服务装置
CN102663009B (zh) * 2012-03-19 2014-11-12 华侨大学 一种支持企业用户数据私有化的web服务集成方法
CN103078858B (zh) * 2012-12-31 2015-08-26 上海同岩土木工程科技有限公司 基于web服务和签名证书的软件授权试用方法
CN104539429B (zh) * 2014-12-30 2017-09-22 飞天诚信科技股份有限公司 一种定位国密证书的方法和装置及系统
CN106453288B (zh) * 2016-09-29 2019-06-04 上海和付信息技术有限公司 一种支持异步模式的分布式微服务框架系统及其实现方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8924542B1 (en) * 2011-05-31 2014-12-30 Amazon Technologies, Inc. Methods and apparatus for scalable private services
CN103036856A (zh) * 2011-10-09 2013-04-10 镇江金软计算机科技有限责任公司 基于saas应用的多租户系统实现
CN109274731A (zh) * 2018-09-04 2019-01-25 北京京东金融科技控股有限公司 基于多租户技术的web服务的部署、调用方法和装置

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GAN, HONG ET AL.: "Multi-Tenant Service Oriented Access Control Model", DIGITAL COMMUNICATION, vol. 40, no. 5, 25 October 2013 (2013-10-25), pages entire document *
PATHIRAGE, MILINDA: "A Multi-tenant Architecture for Buniness Process Exe- cutions", 2011 IEEE INTERNATIONAL CONFERENCE ON WEB SERVICES, 6 September 2011 (2011-09-06), XP031965132 *

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427684A (zh) * 2020-03-20 2020-07-17 支付宝(杭州)信息技术有限公司 一种服务部署的方法、系统、及装置
CN111427684B (zh) * 2020-03-20 2023-04-07 支付宝(杭州)信息技术有限公司 一种服务部署的方法、系统、及装置
CN113495895A (zh) * 2020-04-02 2021-10-12 北京京东振世信息技术有限公司 一种更新数据的方法和装置
CN113495895B (zh) * 2020-04-02 2023-11-03 北京京东振世信息技术有限公司 一种更新数据的方法和装置
CN113515437A (zh) * 2020-04-10 2021-10-19 北京沃东天骏信息技术有限公司 调试接口的方法和装置
CN113535419A (zh) * 2020-04-16 2021-10-22 北京沃东天骏信息技术有限公司 一种服务编排方法和装置
CN111580820A (zh) * 2020-05-25 2020-08-25 泰康保险集团股份有限公司 一种小程序生成方法和装置
CN111580820B (zh) * 2020-05-25 2023-09-15 泰康保险集团股份有限公司 一种小程序生成方法和装置
CN111861140A (zh) * 2020-06-28 2020-10-30 微民保险代理有限公司 一种业务处理方法、装置、存储介质和电子装置
CN113778658A (zh) * 2020-09-29 2021-12-10 北京沃东天骏信息技术有限公司 任务分配方法及装置、电子设备、存储介质
CN112463147A (zh) * 2020-11-26 2021-03-09 杭州览众数据科技有限公司 一种针对通用化模型客制化需求开发框架
CN112463147B (zh) * 2020-11-26 2023-07-04 杭州览众数据科技有限公司 一种针对通用化模型客制化需求开发方法
CN113688152A (zh) * 2021-08-30 2021-11-23 北京京东振世信息技术有限公司 一种系统功能自校验方法和装置
CN113688152B (zh) * 2021-08-30 2023-12-05 北京京东振世信息技术有限公司 一种系统功能自校验方法和装置
CN114595199A (zh) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 文件解析方法、装置、计算机设备和存储介质
CN114693283A (zh) * 2022-06-01 2022-07-01 四川高灯企服科技有限公司 跨系统的业务流程审批处理方法、装置和计算机设备
CN114693283B (zh) * 2022-06-01 2022-09-27 四川高灯企服科技有限公司 跨系统的业务流程审批处理方法、装置和计算机设备

Also Published As

Publication number Publication date
CN109274731B (zh) 2020-07-31
CN109274731A (zh) 2019-01-25

Similar Documents

Publication Publication Date Title
WO2020048391A1 (zh) 基于多租户技术的web服务的部署、调用方法和装置
CN110622129B (zh) 使用软件容器用于加速数据分析应用程序开发和部署的各方面的方法、系统和门户
US11537409B2 (en) System and method for managing system configuration data models
US8336047B2 (en) Provisioning virtual resources using name resolution
US20190196875A1 (en) Method, system and computer program product for processing computing task
US20150186228A1 (en) Managing nodes in a distributed computing environment
US20120215920A1 (en) Optimized resource management for map/reduce computing
CN113495921A (zh) 一种数据库集群的路由方法和装置
US10887392B2 (en) Distributed client based cache for keys using demand fault invalidation
CN109032796B (zh) 一种数据处理方法和装置
US10235223B2 (en) High-performance computing framework for cloud computing environments
WO2023082716A1 (zh) 在Linux系统中操作安卓应用的方法、装置和设备
US10917357B2 (en) Message exchange during parallel execution of processes in a high-performance computer
CN111985906A (zh) 一种远程办公系统、方法、装置及存储介质
US20190278639A1 (en) Service for enabling legacy mainframe applications to invoke java classes in a service address space
WO2024045646A1 (zh) 管理集群访问权限的方法、装置和系统
US20130283297A1 (en) Shared versioned workload partitions
US10228982B2 (en) Hyper-threaded processor allocation to nodes in multi-tenant distributed software systems
US20170090973A1 (en) Virtual node deployments of cluster-based applications
CN105205031A (zh) 分布式运算系统和分布式系统的运算方法
US11861386B1 (en) Application gateways in an on-demand network code execution system
Vivek et al. Payload fragmentation framework for high-performance computing in cloud environment
CN115485677A (zh) 在分布式数据存储环境中的安全数据复制
Sudarsan et al. Building a distributed K‐Means model for Weka using remote method invocation (RMI) feature of Java
Kwon et al. Container based testbed for gate security using open API mashup

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19856971

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19856971

Country of ref document: EP

Kind code of ref document: A1