C # Upgrade with NewSQL -- TiDB entry,

Source: Internet
Author: User
Tags cockroachdb

C # Upgrade with NewSQL -- TiDB entry,
I. background

During the previous attempt to CockroachDB (the portal here: http://www.cnblogs.com/Zachary-Fan/p/cockroachdb_net_csharp.html), it was found that migrating from a conventional RDBMS was almost impossible, so I started to look at NewSQL, which has been quite popular in the past two years. It is also a product made by Chinese people. It is no less popular than CockroachDB-TiDB.


Ii. What is TiDB?

TiDB (https://www.pingcap.com/index-zh) is also inspired by Google Spanner/F1 papers, to achieve automatic horizontal scaling, strong consistency of distributed transactions, based on Raft algorithm of multi Copy Replication and other important NewSQL features. It is similar to CockroachDB in terms of its external functions. The biggest difference lies in itsFully compatible with the MySQL protocol and supports the syntax of most MySQL databases, including cross-row transactions, JOIN queries, and subqueries.(It looks nice to use it ).


Iii. Environment deployment

Official documentation (https://www.pingcap.com/docs-cn) to write very detailed, according to The done just fine. I deployed CentOS directly using Binary. Then you can use any client that can connect to Mysql to connect. The default port is 4000, and there is a built-in "test" database. By default, the root account can be connected without a password. The author uses DBeaver for connection, such as 1:

 

 


Iv. Practice

As in the previous article, we have created a table to be tested in the test database directly, and then referenced the MySql official DLL released by Oracle on Nuget to test the table directly, the usage is the same as that of MySql. The Code is as follows:

Using (var conn = new MySqlConnection (connectionString ))

{

Using (var cmd = conn. CreateCommand ())

{

Cmd. Connection = conn;

Cmd. CommandText = "SELECT id, balance FROM accounts ";

Cmd. CommandType = CommandType. Text;


Using (var reader = cmd. ExecuteReader ())

{

While (reader. Read ())

{

Console. WriteLine (@ "reader [id] is {0}", reader ["id"]);

Console. WriteLine (@ "reader [balance] is {0}", reader ["balance"]);

}

}

}

}

V. Performance Testing

Good test environment and the previous article, the client machine is a 4-core i5-4300U, the database machine is 8-core Xeon (R) E5630. The results contain the test results of the previous article for reference. The Join test is added. The result is shown in 1 (click to view the big picture ).

 

 

Note that,The consumption of resources in distributed databases is measured in several orders of magnitude in a single database.Where CockroachDB and TiDB cannot run becauseCPU Full. However, it is worth noting that the comprehensive results of TiDB are better than those of Cockroach (In addition to persistent connections and a small amount of data). Due to insufficient hardware resources, I will continue to test the performance in this distributed mode, mainly to verify that the CPU does not reach the bottleneck, performance differences from traditional single relational databases are coming soon ~


Vi. Conclusion

We have tried to compare the two pieces of data marked as Google Spanner/F1. We are delighted that our TiDB is superior in both functionality and quality than CockroachDB, it is worth looking forward. In addition, I just got B round of financing in June this year. I hope it will be better and better.

Original article: http://www.cnblogs.com/Zachary-Fan/p/tidb_net_csharp.html

 

. NET community news, deep good article, welcome to visit the public number article summary http://www.csharpkit.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.