CPC G06F 16/24532 (2019.01) [G06F 9/485 (2013.01); G06F 9/52 (2013.01); G06F 16/27 (2019.01)] | 20 Claims |
1. A method implemented in a server system for supporting end-to-end-connections from execution entities to a plurality of database instances based on a fixed number of a plurality of pool connections from said server system as a shared connection pool, each end-to-end connection containing a virtual connection from an execution entity to said server system and a physical connection of a plurality of physical connections from said server system to one of said plurality of database instances provided based on a corresponding pool connection, wherein each physical connection is established for communication at any time instance with only a single database instance of said plurality of database instances together implementing a distributed database, said method comprising:
maintaining a plurality of wait queues for said plurality of database instances, wherein each wait queue of said plurality of wait queues is used for queueing execution entities waiting for respective end-to-end connections to be allocated to a corresponding database instance of said plurality of database instances;
receiving a first request from a first execution entity for a first end-to-end connection to a first database instance;
allocating said first end-to-end connection based on a first virtual connection and a first physical connection of said plurality of physical connections, wherein said first execution entity sends database queries directed to said distributed database on said first virtual connection of said first end-to-end connection;
receiving a second request, at a second time instance, from a second execution entity for a second end-to-end connection to a second database instance, wherein said first end-to-end connection is continued to be allocated to said first execution entity at said second time instance;
if, at said second time instance, none of said plurality of physical connections is available for allocating said second end-to-end connection to said second database instance:
queueing said second execution entity in a second wait queue of said plurality of wait queues at a third time instance following said second time instance, said second wait queue being associated with said second database instance, wherein presence of said second execution entity in said second wait queue indicates that said second end-to-end connection is not yet allocated to said second execution entity and said second execution entity is seeking to establish connection with said second database instance;
upon said first execution entity releasing said first end-to-end connection after said third time instance, checking whether there are execution entities waiting in a first wait queue of said plurality of wait queues associated with said first database instance,
wherein said first end-to-end connection is released after said first execution entity receives responses to said database queries;
if there are execution entities waiting in said first wait queue, allocating an additional end-to-end connection based on said first physical connection to one of said execution entities waiting in said first wait queue to enable said one of said execution entities to continue processing the corresponding request to said first database instance; and
if there are no execution entities waiting in said first wait queue, terminating said first physical connection to said first database instance and then allocating said second end-to-end connection based on said first physical connection to said second database instance and removing said second execution entity from said second wait queue.
|