Detailed Description
In order to better understand the technical solutions, the technical solutions of the embodiments of the present specification are described in detail below with reference to the drawings and specific embodiments, and it should be understood that the specific features of the embodiments and embodiments of the present specification are detailed descriptions of the technical solutions of the embodiments of the present specification, and are not limitations of the technical solutions of the present specification, and the technical features of the embodiments and embodiments of the present specification may be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic view of a scenario of interaction between a database and an application provided in an embodiment of the present specification, in the embodiment of the present specification, User data is divided into 5 sub-epitopes according to a User Identification (UID) level of a User, as shown in fig. 1, a database 100 includes 5 logical data sources, the 5 logical data sources are 00, 01, 02, 03, and 04, respectively, and a plurality of session objects are configured to enable the database 100 to transmit data of each logical data source to a plurality of applications at the same time.
In other embodiments of this specification, the user data may be divided into a greater number according to the actual situation of the user data, and the application is provided with services through a plurality of databases, but it should be noted that the manner adopted when dividing the user data, the number of databases, and the number of logical data sources in each database are not limited herein, and those skilled in the art may correspondingly select an appropriate manner and value to meet the needs of the actual situation, which is not described herein again.
Referring to fig. 2, fig. 2 is a flowchart of a method for allocating session objects to a database according to an embodiment of the present disclosure, where as shown in fig. 2, the first embodiment of the method for allocating session objects to a database specifically includes the following steps:
s202: receiving an access request of an application by a database, wherein the database comprises a plurality of logical data sources and a plurality of session objects;
specifically, referring to fig. 1, when an application 110 needs to access data in the database 100, the application 110 sends an access request to the database 100, and the database 100 can receive the access request of the application 110.
S204: the database responds to the access request and allocates a session object to the application from all allocable session objects;
specifically, with continued reference to fig. 1, in response to an access request from an application 110, a Session object (Session) needs to be assigned to the application 110 so that the database 100 can establish a connection with the application 110 through the Session object, and thus the database 100 can transfer data to the application 110.
In practical applications, please continue to refer to fig. 1, generally speaking, the behavior of the application 110 accessing the database 100 is controlled by the user, and the business behavior of the user is in accordance with poisson distribution, that is, the number of transactions actually falling in a single logical database is in accordance with poisson distribution, and it is set that the number of transactions executed by a server in a unit time of a single data source is, for example, M800T (T represents a transaction) in 1 second, where the time required for each transaction is S10 ms/T0.01S/T, and the traffic volume is calculated as: a is 800 · 0.01 is 8 irish. Thus, for a database 100 comprising 5 logical data sources, the traffic volume is 40 Ireland.
In this embodiment, please refer to fig. 1 again, if the number of session objects in each logical data source is set to 6, and the number of session objects included in the
database 100 is 30, then it can be calculated that the call loss rate of the
database 100 is:
this is equivalent to sharing session objects in the same database, sharing session objects in the same database for allocation to applications, and avoiding the situation where session objects of one logical data source in the database are all occupied and session objects of other logical data sources cannot provide services even if they are idle.
If the call loss rate is calculated by using a single logical data source including 6 session objects, the call loss rate is:
it should be noted that the two calculation processes for calculating the call loss rate are simplified calculation, the numerical values are approximate values, and the actual call loss rate can be searched and compared according to the ireland call loss rate formula, which is not described herein again.
It is evident that the call loss rate is greatly reduced and, correspondingly, the success rate of the database 100 in responding to the access request of the application 110 is greatly increased.
S206: and the database transmits the data in the corresponding logical data source to the application through the allocated session object.
After S204, that is, after the database 100 allocates one session object to the application 110 from all allocable session objects, the database can transmit the data in the corresponding logical data source to the application 110 through the session object allocated to the application 110, which is not described herein again.
It can be seen that, in the embodiment, the database 100 allocates one session object to the application 110 from all allocable session objects, which is equivalent to sharing the session object in the same database to allocate to the application, so as to avoid the situation that the session object of one logical data source in the database is fully occupied and the session objects of other logical data sources cannot provide services even if they are idle, and improve the usage rate of the session object, thereby significantly reducing call loss rate, improving the success rate of database response, that is, providing a more stable connection scheme for the database.
In a specific implementation process, please continue to refer to fig. 2, after S206, the method for allocating session objects by a database according to the embodiment of the present disclosure further includes S208: the database sets the session object allocated to the application as unallocated.
Specifically, since the session object allocated to the application 110 by the database 100 is bound to the application 110 and is also bound during the process of accessing the database by the application 110, if the session object is allocated to another application, an error may occur in the process of accessing the database 100 by the application 110 or an error may occur in the process of accessing the database 100 by another application, and thus the database 100 is required to set the session object allocated to the application 100 as unallocated.
If there are other applications that need to access the database 100, the database 100 only needs to re-execute the method for allocating session objects to the database provided in this embodiment from S202, which is not described herein again.
Referring to fig. 2, unlike the first embodiment described above, the method for allocating session objects by using a database according to the second embodiment of the present disclosure further includes, after S208, S210: and the database marks the unallocated session objects to identify the session objects occupied by the current application.
Specifically, if a single sub-location point, that is, a certain logical data source, appears as a hot spot, that is, when the access amount to the logical data source is large, the hot spot may be spread to other logical data sources under the same database, because the database may allocate assignable session objects to the logical data source at the hot spot, the session objects that the database allocates to applications accessing other logical data sources are greatly reduced, and therefore, tagging may be performed on non-assignable session objects, specifically, tagging may be performed on the use of each session object, for example, the session object occupied by the current ID may be identified by using the application ID, so that it is ensured that one application occupies at most one session object to access the logical data source at the hot spot, thereby avoiding spreading of the hot spot.
The other steps in the second embodiment have been described in detail in the first embodiment, and are not described herein again.
Unlike the first embodiment described above, the method for allocating session objects by a database provided in the third embodiment of the present specification further includes, before S202, S200: when a server loading the database is started, the database sets all the session objects to be in an assignable state, so that the session objects are assigned to the applications needing to access the database.
Specifically, to improve the automation of the server and ensure that the database 100 can provide a more stable connection scheme as soon as possible after the server is started, the database 100 sets all session objects to an assignable state at the time of starting the server loaded with the database 100, thereby assigning session objects to applications that need to access the database. This enables sharing of session objects in the same database to avoid situations where the session objects of one logical data source in the database are fully occupied and the session objects of other logical data sources cannot provide services even if they are idle.
Other steps in the third embodiment have already been described in detail in the first embodiment, and are not described herein again.
In a specific implementation, for any of the three embodiments described above, the database 100 allocates the session object to the application 110 at the granularity of a single service on a single server.
The foregoing describes certain embodiments of this specification. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
In a second aspect, based on the same inventive concept, an embodiment of the present specification provides a database, please refer to fig. 3, fig. 3 is a block diagram of the database provided in the embodiment of the present specification, as shown in fig. 3, including:
a receiving unit 301, configured to receive an access request of an application;
an allocating unit 302, configured to respond to the access request, allocate a session object to the application from all allocable session objects of the application;
and a data transfer unit 303, configured to transfer the data in the corresponding logical data source to the application through the allocated session object.
In an optional manner, the database further includes a first setting unit 304, and the first setting unit 304 is configured to, when a server loading the database is started, set all session objects to an allocable state by the database, so as to allocate the session objects for applications that need to access the database.
In an alternative, the database further includes a second setting unit 305, and the second setting unit 305 is configured to, after allocating a session object to an application from all available session objects of the database, set the session object allocated to the application to a non-allocable state by the database.
In an optional manner, the database further includes a marking unit 306, and the marking unit 306 is configured to mark the session object set in the unallocated state to identify the session object occupied by the current user.
In an alternative, the database allocates session objects for applications at the granularity of a single service on a single server.
In a third aspect, based on the same inventive concept as the method for allocating session objects based on a database in the foregoing embodiments, referring to fig. 4, fig. 4 is a schematic structural diagram of the server provided in this embodiment, as shown in fig. 4, including a memory 604, a processor 602, and a computer program stored in the memory 604 and being executable on the processor 602, where the processor 602, when executing the program, implements the steps of any one of the foregoing methods for allocating session objects based on a database.
Where in fig. 4 a bus architecture (represented by bus 600) is shown, bus 600 may include any number of interconnected buses and bridges, and bus 600 links together various circuits including one or more processors, represented by processor 602, and memory, represented by memory 604. The bus 600 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 606 provides an interface between the bus 600 and the receiver 601 and transmitter 603. The receiver 601 and the transmitter 603 may be the same element, i.e., a transceiver, providing a means for communicating with various other apparatus over a transmission medium. The processor 602 is responsible for managing the bus 600 and general processing, and the memory 604 may be used for storing data used by the processor 602 in performing operations.
In a fourth aspect, based on the same inventive concept as the method for allocating session objects by a database in the foregoing embodiments, the present specification embodiment further provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of any one of the methods for allocating session objects by a database.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.