The following articles mainly describe the basic operating principles of the IBM DB2 connection concentrator. If you are curious about the basic operating principles of the IBM DB2 connection concentrator, the following articles will unveil its secrets. The following is a detailed description of the article. I hope you can learn from it.
1. Basic Principles
Since DB2 V8, the DB2 instance has a feature called the IBM DB2 connection concentrator, which can be used to optimize database connections. By default, MAX_CONNECTIONS and MAX_COORDAGENTS are consistent during instance creation. At this time, each coordination proxy serves only one connection.
For example, if there are 1000 connections, there will be 1000 coordinated proxies. This is a huge burden on the server, because every proxy consumes a certain amount of resources. When we set the value of MAX_CONNECTIONS to be greater than that of MAX_COORDAGENTS, the DB2 connection concentrator is activated. It allows multiple connections to correspond to one proxy.
The function of the connection concentrator is similar to that of the Connection Pool in DB2 CONNECT. However, the advantage of the IBM DB2 connection concentrator over the connection pool is that it can reuse external connections, that is, Multiple Queuing applications can reuse an existing connection, the connection pool needs to be deleted before a new connection is established to serve a new application.
In the connection concentrator, each coordination proxy does not only serve one connection. When an external connection is disconnected, the Coordination proxy is allocated to other connections. In this way. At the same time, it allows more connections to the database, reduces the memory consumption of each connection, and avoids the system overhead caused by frequent deletion and Agent creation. The working principle of the connection concentrator is as follows:
First, set MAX_CONNECTIONS to be greater than MAX_COORDAGENTS to activate the connection concentrator. In the connection concentrator, the proxy is divided into logical proxy and work proxy. The logical proxy corresponds to an external application and does not correspond to a specific engine allocation unit (EDU ). A work agent is a specific engine allocation unit, just as defined previously. When the logical proxy is more than the working proxy, the IBM DB2 connection concentrator is activated. When multiple connections are connected to the server at the same time, the connections are allocated to each logical proxy. The logical proxy then requests the service of the Work proxy.
For example, a proxy pool is a hotel, and there are usually more customers than waiters in the hotel. At the beginning, there were no customers (equivalent to external applications. Some on-duty attendants are on standby in the hotel (equivalent to the idle proxy NUM_INITAGENTS created in the proxy pool when the instance is started ). Once an application request (customer) is sent, the scheduler (equivalent to the foreman) arranges the waiter to start his work, and the waiter starts to get up and greet the customer. In this case, the waiter's role is equivalent to coordinating the proxy.
After receiving the customer, they will send the menu to the chefs and workers (equivalent to sub-agents ). When there are more and more customers, the number of employees on duty exceeds the original number. The server generates a new proxy to serve these applications. It is like calling more waiters from the Employee dormitory to work. When the number of waiters reaches a certain number (MAX_COORDAGENTS), all the waiters in the hotel are working, and no other waiters are working.
New customers (external applications) can only wait in their seats. MAX_CONNECTIONS is equivalent to the total number of dining seats in the hotel. When the number of customers (external applications) reaches this value, the customers can only leave (equivalent to not connecting to the database ).
It should be noted that MAX_CONNECTIONS does not refer to the active connections that are connected to the instance at the same time, because some connections are waiting to coordinate the proxy service even if they are connected to the instance, the number of active connections is equal to the number of coordinated proxies. After a coordination agent processes an application, it is allocated to other waiting applications, which is equivalent to serving other waiting customers.
There are also some seats in the hotel that are specially prepared for the waiter's rest (This number is equivalent to NUM_POOLAGENTS ). As the number of customers gradually decreases, some waiters (Coordination Agents) have nothing to do and return to these seats (instead of idle agents ). When these seats are also full, there will be no available seats for the rest when the waiter (Coordination Agent) returns to rest (assuming the waiter cannot sit in the dining seat ).
These waiters only return to the Employee dormitory (equivalent to deleting the proxy)
The above content is an introduction to the IBM DB2 connection concentrator. I hope you will get some benefits.