NoSQL
Not Only Database -- More than traditional database
Nosql:
Represented in JSON; Not requiring a schema;
In computer science, ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties of database transactions. In the context of databases, a single logical operation on the data is called a transaction.
no sql uses
$m = new MongoClient();
$db = $m->admin;
$collection = $db->comments;
$document = array(
"newsid" => $newsid,
"content" => $comment,
"username" => $username,
"userid" => $_SESSION["myid"]
);
$collection->insert($document);
Eventual consistency:
I tell you that it's going to rain tomorrow.
Your neighbor tells his wife that it's going to be sunny tomorrow.
You tell your neighbor that it is going to rain tomorrow.
Eventually, all of the servers (you, me, your neighbor) know the truth (that it's going to rain tomorrow), but in the meantime the client (his wife) came away thinking it is going to be sunny, even though she asked after one of the servers knew the truth.
As opposed to Strict Consistency / ACID compliance:
Your bank balance is $50.
You deposit $100.
Your bank balance, queried from any ATM anywhere, is $150.
Your daughter withdraws $40 with your ATM card.
Your bank balance, queried from any ATM anywhere, is $110.
At no time can your balance reflect anything other than the actual sum of all of the transactions made on your account to that exact moment.
The reason why so many NoSQL systems have eventual consistency is that virtually all of them are designed to be distributed, and with fully distributed systems there is super-linear overhead to maintaining strict consistency (meaning you can only scale so far before things start to slow down, and when they do you need to throw exponentially more hardware at the problem to keep scaling).
我上网看了non-sql是eventual consistency。就是有可能不一致的。
edwardzeng 14:33:17
这不一致不是会产生一点问题吗?即使是social media或者gaming
潘驴邓小前男友 14:33:18
不一定
潘驴邓小前男友 14:33:39
no sql可以达到strong consistency
潘驴邓小前男友 14:33:56
比如amazon的dynamodb就可以
edwardzeng 14:34:16
就是自己加点mechnism吗?
潘驴邓小前男友 14:34:26
(consistency 分很多种,什么read your write啦
潘驴邓小前男友 14:35:15
对
潘驴邓小前男友 14:35:25
看consensus protocol
潘驴邓小前男友 14:36:16
就是在数据库上加一层协议
潘驴邓小前男友 14:36:37
另外,eventual consistensy并不会出现大问题
潘驴邓小前男友 14:37:06
比如你在一台电脑上看到某条微博五十个赞,另外一台电脑上看某条微博七十个赞
潘驴邓小前男友 14:37:23
这些用户不是很在意……
潘驴邓小前男友 14:37:46
eventual consistensy意思是,at the end of day,我们看到的都是一样的结果
潘驴邓小前男友 14:38:39
比较有名的eventual consistency的系统就是dns服务器……