西维蜀黍

【Distributed System】分布式理论 - BASE

BASE理论

eBay 的架构师 Dan Pritchett 源于对大规模分布式系统的实践总结,在 ACM 上发表文章提出 BASE 理论,BASE 理论是对 CAP 理论的延伸,核心思想是:即使无法做到强一致性(Strong Consistency),CAP 的一致性就是强一致性),但每个应用都可以根据自身的业务特点,采用适合的方式来达到最终一致性(Eventual Consitency)

  ...


【Distributed System】分布式理论 - CAP 理论(CAP Theorem)

背景

2000年7月,加州大学伯克利分校的Eric Brewer教授在ACM PODC会议上提出CAP猜想。2年后,麻省理工学院的Seth Gilbert和Nancy Lynch从理论上证明了CAP。之后,CAP理论正式成为分布式计算领域的公认定理。

  ...


【OOP】对象的深拷贝(Deep Copy)与浅拷贝(Shallow Copy)

数据类型

数据分为基本数据类型(String,Number,Boolean,Null,Undefined,Symbol)和对象数据类型。

  ...


【Distributed System】Data Flow - 远程过程调用(Remote Procedure Call, RPC)

什么是远程过程调用(Remote Procedure Call,RPC)

RPC 是**远程过程调用(Remote Procedure Call)**的缩写形式。

Birrell 和 Nelson 在 1984 发表于 ACM Transactions on Computer Systems 的论文《Implementing remote procedure calls》对 RPC 做了经典的诠释。RPC 是指计算机 A 上的进程,调用另外一台计算机 B 上的进程,其中 A 上的调用进程被挂起,而 B 上的被调用进程开始执行,当值返回给 A 时,A 进程继续执行。调用方可以通过使用参数将信息传送给被调用方,而后可以通过传回的结果得到信息。而这一过程,对于开发人员来说是透明的。

RPC 的主要好处有两个:

  • 程序员可以使用过程调用语义来调用远程函数并获取响应。
  • 简化了编写分布式应用程序的难度,因为 RPC 隐藏了所有的网络代码存根函数。应用程序不必担心一些细节,比如 socket、端口号以及数据的转换和解析。在 OSI 参考模型中,RPC 跨越了会话层和表示层。

RPC 使用的通信协议

RPC 可以灵活使用其所基于的协议,如果基于 HTTP,则与 Web Service 就没有什么区别了,如基于更底层的协议(如 TCP ),则会比 Web Service 相对更为高效。

  ...


【Network】GFW学习

GFW是啥

总的来说,GFW是一个分布式的入侵检测系统,并不是一个严格意义上的防火墙。不是说每个出入国境的IP包都需要先经过GFW的首可。做为一个入侵检测系统,GFW把你每一次访问facebook都看做一次入侵,然后在检测到入侵之后采取应对措施,也就是常见的连接重置。

  ...


【IoT】Why Cloud Computing is not enough for IoT

Basic Idea

In “A vision, architectural elements, and future directions”, it presents their vision of IoT and coin the term “cloud centric IoT” for a system offering data distribution and additional services in a cloud based layer.

In other words, a system uses Cloud as the proxy for all communications between things or as a data hub where IoT data are gathered and analysed.

Note that “cloud-based IoT” and “cloud centric IoT” are used interchangebly.

  ...


【Microservices】Orchestration and Choreography

Orchestration

Advantage

  • Easy to monitor the execution of workflows and handle task failures during workflow execution.

Disadvantage

  • May suffers from performance bottlenecks
    • all the data is indirectly passed between the services of the workflow resulting in unnecessary data-flows, consuming more bandwidth and hence weakening the performance of the workflow execution
  • Poor scalability
    • The overall performance of workflows reduces as the number of services and the volume of the data to be orchestrated in the workflow becomes larger.
  ...


【Architectural Pattern】Broker Pattern

Broker Pattern

A broker may be implemented in either a Pub/sub model or Point-to-point (P2P) model.

  • The publish-and-subscribe (pub/sub) model is intended for a one-to-many broadcast(Multicast) of information
  • The point-to-point (P2P) model is intended for a one-to-one communication (Unicast) between two specific applications.
  ...


【Paradigm】Internet of Things

Basic Idea

Things in IoT

  • Small gateway devices
  • Moderately powerful nodes
  • Cloud

IoT components

There are three IoT components which enables seamless ubicomp:

  • (a) Hardware—made up of sensors, actuators and embedded communication hardware
  • (b) Middleware—on demand storage and computing tools for data analytics
  • (c) Presentation—novel easy to understand visualization and interpretation tools which can be widely accessed on different platforms and which can be designed for different applications.
  ...


【IoT】IoT Protocols

  • CoAP
  • MQTT
  • AMQP
  • Websocket

CoAP

CoAP, representing Constrained Application Protocol, is a specialized Application Layer. Although application layer usually use HTTP to communicate between different nodes, the communication through HTTP has to have high computation complexity and energy consumption. Internet Engineering Task Force (ITEF) therefore designed CoAP and specified it in IETF RFC 7252 for constrained nodes and networks in the IoT. CoAP enables low-power compute-constrained devices to communicate between each other even through a constrained network with low bandwidth and low availability.

  ...