Easy to learn distributed | Series 3 | distributed database.

We continue speaking distributed back to our entrepreneurial game.

Our business scale up, more and more loyal customer of. Many customers through our booking service to facilitate their travel.

That these old customers, our objective is: to continue to exceed customer expectations.

So, we have to build our customer database.

We want to record each customer's preferences Airlines, the preferred hotel. The next service, in order to better service customers directly.

How to do?

The easiest way, each with their own customer service sister small notebook to record the information the customer number, preferences and so on.

The notepad is our "customer database."

These data are recorded on a notepad, there will be a problem, as in the same customer, each customer can record a little sister. Is not it time-consuming and laborious, but also duplicate records, waste of resources.

How to do?

Still the same as before, split! Split level.

Then split a group called: customer information record group.

If the customer little sister to record customer information, put the information written on slips of paper, and then directly throw: customer information record group, so the group itself: remove duplicate, update information.

Of course, our customer information record set, you can use execl to record information on customers. Thus, also facilitate data processing.

Now our business structure is as follows:

 

 Some students said that the architecture diagram seems like with our IT software architecture diagram.

Yes. In fact, all of the IT software architecture, to comply with the business architecture design.

Technology is only a tool, is the core business.

Back to our customer information record group. The group also recorded a number of small sister, if we are to use their own excel, how to ensure everyone's information is not repeated, it is consistent?

This time, we will have on the database system. What is a database system, simply put, is recording data warehouse.

Well, we bought a computer, recruited a programmer, downloaded a mysql, wrote a simple program, to the sister group of records with customer information.

At first, the data is not, no problem.

When the data rises, a database supports no less than obvious. How to do?

Very simple, buy a few sets of databases. Money can solve the problem, not a problem.

So, now the question again, how these databases to maintain data consistency?

This is a distributed database problem to be solved. What is a distributed database?

In simple terms, it is composed of a "whole" with more than one database, data warehouse system to the outside world provide database services.

Some students will say, you have to very big amount of data in order to use a distributed database. You are a small company, this is not a waste?

It makes sense! In general, small companies do not have access is distributed. But we have dreams as entrepreneurs, we must plan ahead, standing next to see now! We have a chance to succeed!

Ma said: dream or have, in case it achieved?

So, call that programmers began to work!

First, we have to analyze the business.

In most cases the customer little sister, queries are more customer information, accounting for 80%. New and updated information of the situation is relatively small, accounting for 20%.

If the query and recorded in a database, often cause conflicts, resulting in "lock table."

Naturally, we can think of, it is not possible to separate the two libraries, one for recording and one for the query.

This is separate read and write, read and write separation is very important design principles. Can greatly improve the efficiency of queries. as follows:

 

Despite separate read and write way, but with the pressure on the database continues to grow, more and more prominent bottlenecks in the database.

 

Guess you like

Origin www.cnblogs.com/gyc567/p/11075381.html