Return of Sharding-Sphere — A New Era for Sharding-Sphere 3.X

Apache ShardingSphere
6 min readMay 28, 2018

--

After a series of important changes, such as name change, launch of new official website and copyright transfer, Sharding-Sphere finally steps into a new stage. Sharding-Sphere 3.X come into our sight as expected now.

From Sharding-JDBC to Sharding-Sphere, old friends have been always with us and new friends steadily join us. In order that you would understand Sharding-Sphere better, today I’d like to expand 4 questions in detail for all the friends:

1. What is Sharding-Sphere?

2. What are Sharding-JDBC, Sharding-Proxy and Sharding-Sidecar?

3. What are the features of Sharding-Sphere?

4. What are the new functions of Sharding-Sphere 3.X?

Now let’s begin.

1. What is Sharding-Sphere?

Sharding-Sphere is an open-sourced distributed database middleware solution suite, which consists of Sharding-JDBC, Sharding-Proxy and Sharding-Sidecar. Those three subprojects are suitable for various scenarios, such as Java homogeneous & heterogeneous languages, container and cloud native, and provide consistent functions including data sharding, read-write splitting, orchestration and B.A.S.E transaction.

As a Relational Database Middleware, Sharding-Sphere reuses original capacities of database (like compute and storage) and makes it simpler and more efficient on distributed environment. It coexists with rather than excludes NoSQL and NewSQL, which are valuable as advanced exploration of technology. As cornerstone of core business in enterprises, relational database still possesses a huge market and has a brighter future. Sharding-Sphere grasps the opportunity and concentrates in the development based on relational database. Its architecture is as follows:

2. What are Sharding-JDBC, Sharding-Proxy and Sharding-Sidecar?

Sharding-JDBC, Sharding-Proxy and Sharding-Sidecar compose Sharding-Sphere. They are positioned for different scenarios, and you can also use two of them together for a better performance.

2.1 Sharding-JDBC

Sharding-JDBC is positioned as a lightweight Java framework that provides Sharding service in the JDBC layer. It directly connects to databases to provide services in the form of jar with no additional deployment and dependencies and it can be understood as an enhanced version of the JDBC driver, fully compliant with JDBC and various ORM frameworks. Its architecture is as follows:

2.2 Sharding-Proxy

Sharding-Proxy is positioned as a transparent database proxy, providing a database server that encapsulates database binary protocol to support heterogeneous languages. Underlying database sharding has been hidden by Sharding-Proxy, you can operate the sharding just like use a simple database. At present, we provide Sharding-Proxy for MySQL, and you can use any clients compatible with MySQL protocol (such as MySQL Command Client, MySQL Workbench, etc.) to visit Sharding-Proxy and manipulate data through DDL/DML operation. Its architecture is as follows:

2.3 Mixed scheme of Sharding-JDBC & Sharding-Proxy

To get a better performance and friendly interaction, you can adopt the mixed scheme of Sharding-JDBC and Sharding-Proxy.

Sharding-JDBC is used in production environments to directly connect to databases to get the best performance; MySQL command line or UI client is used to connect Sharding-Proxy to simply query data or to perform various DDL statements. Sharding-JDBC and Sharding-Proxy share the same registry center, which is managed by Sharding-Administrator and can automatically push configuration changes to JDBC and Proxy. If the number of connections increases sharply due to too much sharding databases, you can directly use Sharding-Proxy to effectively control the number of connections. Its architecture is as follows:

2.4 Sharding-Sidecar

Sharding-Sidecar is the third subproject of Sharding-Sphere, which is being incubated at present. It is positioned as a cloud native database proxy which must run in Kubernetes or Mesos environment. It can mesh interactions between applications and databases in a center-less and non-intrusive way and can support any languages. We call it as Database Mesh.

Database Mesh emphasizes how to connect distributed data-access-layer with databases. It pays more attention to interaction, which means the messy interaction between applications and databases will be effectively orchestrated. By using Database Mesh, applications and databases will form a large grid system, where they just need to be put in the right position accordingly. Its architecture is as follows:

3. What are the Features of Sharding-Sphere

3.1 Data Sharding

Data sharding is an effective solution to solve the performance problems of relational database due to mass data processing. As a distributed database middleware, it aims at eliminating the influences caused by sharding and making user use sharding databases like a single database.

3.2 Read-write splitting

For some systems with huge concurrent query requests and less update requests, user could split single database to master database and slave database; master database deals with DML operations, while slave database deals with DQL operation. The target of this feature is to let user use complicated databases like a single database.

3.3 B.A.S.E Transaction

For distributed database, obvious defects exist in strongly consistent distributed transaction. Sharding-Sphere supports Best-Effort-Delivery transaction now and will support TCC in the near future. If users do not want to use B.A.S.E transaction, Sharding-Sphere also supports weak XA.

3.4 Orchestration

We provide registry center, dynamic configuration, disabling databases and APM features.

4. What are the new functions of Sharding-Sphere 3.X?

(1) Sharding-Proxy for MySQL is on, supporting basic SQL like DML, DDL, DAL and DQL. Underlying database sharding have been hidden, you can operate the sharding just like use a simple database.

(2) Support OR SQL sentence. Eg: select * from t_order where (id>10 and id<20) or status=‘init’.

(3) Support batch inserts. Eg: insert into t_order(order_id, user_id, status) values (1, 2, ‘init’), (2, 3, ‘init’), (3, 4, ‘init’).

(4) Optimize the support for INSERT SQL, mainly including inserting without specifying columns. Eg: insert into t_order values(1, 2,‘init’).

(5) Add SQL cache from parsing engine and improve parsing performance.

(6) Sharding-JDBC supports InlineExpression placeholder like $->{}.

Tips:

① You can add Maven dependencies when using Sharding-JDBC:

② You can download Sharding-Proxy here:

https://github.com/sharding-sphere/sharding-sphere-doc/raw/master/dist/sharding-proxy-3.0.0.M1.tar.gz

③ Download command of DOCKER is:

docker pull shardingsphere/sharding-proxy

Conclusion

Since open sourced in 2016, Sharding-Sphere has been acknowledged by many enterprises and individuals. At current, we have got 4400+ stars and 1700+ forks in Github, and 60+ companies and enterprises successfully use it to develop their businesses. In addition, more and more enterprises and individuals have joined us to contribute code to Sharding-Sphere.

We will continue optimizing the current functions and develop more new features of Sharding-Sphere; at the same time, we will do our best to implement Sharding-Sidecar to be a pure cloud native database middleware.

Hope you could join us. Thank you!

Sharding-Sphere, consisting of three independent products, namely Sharding-JDBC, Sharding-Proxy, and Sharding-Sidecar, is an ecosystem of open source distributed database middleware solutions. They all provide standardized data sharding, read-write splitting, flexible transactions and data management functions, which can be applied to various application scenarios such as Java isomorphic and heterogeneous languages, containers and cloud natives.

For more information, you could visit our new website:

http://shardingsphere.io/

or Twitter: @ShardingSphere

If you like it, please give us a star on Github as encouragement.

The project address:

https://github.com/sharding-sphere/sharding-sphere/

https://gitee.com/sharding-sphere/sharding-sphere/

Thank you very much.

--

--

Apache ShardingSphere
Apache ShardingSphere

Written by Apache ShardingSphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database. https://linktr.ee/ApacheShardingSphere

No responses yet