西维蜀黍

【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.

  ...


【IoT】Service Interaction in ioT

Exogenous Coordinnation

Properties

  • Separation between control flows and data flows
  • Use a (exogenous) coordinator to coordinate mutiple services in order to performan service composition

Centralized control flows & Central data flows

Properties

  • Centralized control flows
  • Centralized data flows
  ...


【IoT】Mobile Crowd Sensing

Participants

Participatory participants - assuming the active involvement of participants in choosing to contribute data

Opportunistic participants - refer to autonomous data collection, not requiring explicit user interaction

  ...


【Redis】Redis 入门

关于Redis

  • 完全基于内存,绝大部分请求是纯粹的内存操作,非常快速。数据存在内存中,类似于HashMap,HashMap的优势就是查找和操作的时间复杂度都是O(1);
  • 数据结构简单,对数据操作也简单,Redis中的数据结构是专门进行设计的;
  • 采用单线程,避免了不必要的上下文切换和竞争条件,也不存在多进程或者多线程导致的切换而消耗 CPU,不用去考虑各种锁的问题,不存在加锁释放锁操作,没有因为可能出现死锁而导致的性能消耗;
  • 使用多路I/O复用模型,非阻塞IO。
  ...


【Database】Transactions - Isolation Levels

Isolation Levels

Transaction isolation is one of the foundations of database processing. Isolation is the I in the acronym ACID; the isolation level is the setting that fine-tunes the balance between performance and reliability, consistency, and reproducibility of results when multiple transactions are making changes and performing queries at the same time.

Although some database management systems offer MVCC, usually concurrency control is achieved through locking. But as we all know, locking increases the serializable portion of the executed code, affecting parallelization.

The SQL standard defines four Isolation levels:

  • READ_UNCOMMITTED
  • READ_COMMITTED
  • REPEATABLE_READ
  • SERIALIZABLE
  ...


【Database】Transactions - Consistent Anomalies

Background

If transactions are executed serially, i.e., sequentially with no overlap in time, no transaction concurrency exists. However, if concurrent transactions with interleaving operations are allowed in an uncontrolled manner, some unexpected, undesirable results may occur, such as:

  • Lost update problem
  • The dirty read (temporary update) problem
  • dirty write
  • Non-repeatable read / Read Skew
  • Phantom reads
  • Write Skew
  ...


【Database】Concurrency Control

Why is concurrency control needed?

If transactions are executed serially, i.e., sequentially with no overlap in time, no transaction concurrency exists.

However, if concurrent transactions with interleaving operations are allowed in an uncontrolled manner, some unexpected, undesirable results may occur, such as:

  • The lost update problem
  • The dirty read problem
  • The incorrect summary problem
  ...