Dbtwin DatabaseCluster
The database extender dbtwin allows connections to N databases at the same time and is managed by the dbtwin gateway. For the client, dbtwin shields the next n databases. It only shows a virtual database service represented by the dbtwin gateway, to connect to a client, you only need to connect to the virtual IP address and port to perform operations just like accessing a common database. DbtwinDatabase ClusterShows the principle structure:
20130312210124. PNG (27.47 K) 21:05:42
The biggest feature of dbtwin is its ability to concurrently process transactions that access the database: When dbtwin gateway receives transaction operations such as insertion, modification, and update, it also sends the transaction to the N connected databases, so that the data in the N databases is updated at the same time; because at any time, the data of the N databases connected after the dbtwin gateway is completely consistent. Therefore, when the dbtwin gateway receives the query operation, the entire database system can implementServer Load balancer(Load Balance) to dynamically share the customer's access load and improve the response capability of the entire system.
Dbtwin implementation principle
Dbtwin is a middleware service software that works on the TDS layer of Microsoft's dedicated database protocol, as shown in:
20130312210230. PNG (19.52 K) 21:05:42
TDS (tabular data stream table data stream) is an undisclosed protocol used by the Microsoft database client to communicate with the SQL Server server. dbtwin works on this layer. Therefore, dbtwin supports all SQL Server client data components. 1433 is the default service port of Microsoft SQL Server. 8106 is the default service port of the dbtwin database cluster, in addition, 8105, 8107, 8108, and 8109 are fixed working ports of dbtwin or its agent software. Therefore, you must avoid selecting these ports when selecting ports, to avoid port conflict.
Transactions are a basic but important concept in the database system. dbtwin always checks transactions from the client. Once a customer transaction request is received, dbtwin sends the transaction to each database in the cluster at the same time, and ensures that all the cluster databases are either committed or rolled back, this ensures that the data image of each cluster database is always in the consistent state, while maintaining transparent and seamless connection to the database client.
Batch Processing is also an important concept in the database system. dbtwin performs load balancing in batches. That is to say, every time dbtwin receives a request from the client, this request is actually a batch processing. At this time, dbtwin checks the syntax of this batch processing and determines whether load balancing is enabled, if you can perform load balancing, dbtwin willAlgorithmSelect a cluster database to execute the batch processing. If the batch processing cannot be load balancing, dbtwin sends the Batch Processing request to all cluster databases at the same time.
Before the dbtwin cluster is started, you can use the PRT advanced synchronization tool for data synchronization or the backup/restore Command provided by SQL Server. When dbtwin is running, if a database is offline, dbtwin can repair the cluster in two ways. One is timed and automatic, this method is pre-configured for Database Synchronization at a certain time and the restart of the dbtwin gateway. It is suitable for systems that perform batch processing at night. Another method is manual synchronization, which is caused by random errors, such as network errors and server restart. Either way, during the synchronization process, the Client Always accesses the dbtwin cluster system, which greatly improves the availability of the entire database system.
How meobius works
20130312210726. PNG (38.27 K) 21:07:28
The preceding workflow is as follows:
When the proxy on server a (virtual host) receives the query request:
1. A proxy A can be directly sent to the local database engine a, so that the local engine a can query select * from T and return the result to the client.
2. or, proxy a first converts the request to sp_remote '192 in this form. 168.1.2 ', 'sa', '123', 'select * from t', and then send it to the local database engine A. When the local engine a is executing, run the query by remotely accessing database engine B with the IP address 192.168.1.2. The query result is returned to the client through engine A and proxy A on server.
Product comparison
To better illustrate the problem, we still put the two schematics together, as shown below:
Both.png (56.33 K) 21:17:55
Next, let's perform a test:
Test Method:Use the query analyzer to log on to a VM connected to a dbtwin cluster or a friend, and then execute the select * from t statement for 100 times..
Observation method:When executing the statement, observe the CPU and nic speed of the two machines to know which machine is executing the current statement.
TestTest result:
1. For a dbtwin cluster, N execution results will come from database A, and (100-N) results will come from database B. N is a number within and is dynamic.
2. For meobius, 100 results will all come from the same database server, either from database a or from database machine B, both of which must be the first.
Analysis summary:
1. Because the database connection is a persistent connection, the test results of dbtwin meet the expectations of Server Load balancer, while the test results of meobius do not meet the expectations of Server Load balancer. In practical applications, the meobius cluster may have such a scenario: the CPU of database a is 100%, while that of database B is 0%, in this case, Server Load balancer does not work, and database machine A, that is, the virtual host, becomes the performance bottleneck of the entire cluster, while the dbtwin cluster does not.
2. dbtwin is Binary compatible with any client of SQL Server. You do not need to modify the client system. You only need to modify the IP address and port number in the connection string of the client to connect to the database, you can access the database immediately. For example, create/drop/alter database, updatetext, writetext, truncate table, select into, etc.Source codeMake any manual modifications (in most cases, the customer's system has no sourceCode). Therefore, the implementation time of dbtwin is very short. It does not need to study the internal logical relationships such as the structure of the customer's application system. Generally, when the customer system is idle at night, it takes one or two hours to get online, then, observe that the installation will be okay in 2 to 3 days, and there is no need to debug and install it for a long time. The meobius cluster is not compatible with the preceding SQL statements. It requires manual processing by technicians. Therefore, it takes a long time to be familiar with the customer system, and some of them cannot be solved even if the time is longer, this will bring unpredictable risks to the system.