• 1. 异步处理 在分布式系统中的优化作用QCon Beijing / 2015.04
  • 2. 异步处理单机数据库时代Database ServerClient
  • 3. 异步处理单机数据库时代 DbConnection conn = new DbConnection(IPAddress); DbResult res = conn.exec(Query); res.display();
  • 4. 异步处理大数据时代Database 1ClientDatabase 2
  • 5. 异步处理代码写法1: 串行同步 DbResult res1 = conn1.exec(Query1); DbResult res2 = conn2.exec(Query2, res1); res2.display();
  • 6. 异步处理代码写法2: 并行同步 DbResult (res1, res2) = ExecParallelQuery(conn1, Query1, conn2, Query2); formatAndOutput(res1, res2);
  • 7. 异步处理串行还是并行?函数调用把并行处理的可能性大大降低: function getResult() { DbConnection conn = new DbConnection(IPAddress); DbResult res = conn.exec(Query); return res; }
  • 8. 异步处理代码写法3: 异步DbConnection conn = new DbConnection(IPAddress); Future res = conn.asyncExec(Query);
  • 9. 异步处理异步写法不怕函数调用function getResult1() { DbConnection conn = new DbConnection(IPAddress); Future res = conn.asyncExec(Query); yield return res; }
  • 10. 异步处理异步写法有传染性function getResult1() { DbConnection conn = new DbConnection(IPAddress); Future res = conn.asyncExec(Query); yield return res; } function getResult2() { DbResult res1 = waitFor(getResult1()); yield return res1; }
  • 11. 异步处理Facebook 全异步写法PHP 加入 yield 和 generator 功能 组成 Distributed Query执行 Distributed Query
  • 12. 异步处理实例IdList friends = waitFor(getFriends(myId)); yield return getTaoBaoBuyers(friends); 找出朋友中在淘宝上买过东西的人:找出朋友中在淘宝上买过保时捷的人?
  • 13. 异步处理在写第一行代码时已经错了!IdList friends = waitFor(getFriends(myId)); yield return getTaoBaoBuyers(friends); 找出朋友中在淘宝上买过东西的人:找出朋友中在淘宝上买过保时捷的人:IdList buyers = waitFor(getPorscheBuyer()); yield return getFriends(buyers);
  • 14. 异步处理两行代码同时考虑呢?FriendsPorche BuyersSELECT * FROM friends f INNER JOIN porche_buyers b ON f.id = b.id
  • 15. 异步处理多机时代的数据库问题如何组成 Distributed Query如何执行 Distributed Query
  • 16. @ 阿里技术保障Q & A Thank you