西维蜀黍

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


【Software Testing】Difference between Verification and Validation

Most people think verification and validation are exactly the same thing, but only different words. However, these two is not the same thing. I would like discuss both of them, especially the distinction between them.

Difference between Verification and Validation

  • Verification [Process-related]: a static practice of checking documents, design code and program

  • validation [Product-related]: a dynamic practice of validating and testing the actual product

    • validation will be done by testing
  ...


【Engineering】Data flow and Control flow

Background

A workflow can described from the control and data perspecitve respectively.

Data Flow and Control Flow

There are two types of messages: control messages and data messages, distinguished by their use at the recipients of the messages.

  • Control messages are mostly short messages that trigger state changes at the receiving services
  • Data messages are mostly large data packets that are given to the receiving services for processing.
  ...


【IoT】MQTT Protocol

Basic Idea

MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe-based messaging protocol.

MQTT vs HTTP

The publish/subscribe architecture which is used in MQTT is in contrast to HTTP with its request/response paradigm.

The difference to HTTP is that a client doesn’t have to pull the information it needs, but the broker pushes the information to the client, in the case there is something new. Therefore each MQTT client has a permanently open TCP connection to the broker. If this connection is interrupted by any circumstances, the MQTT broker can buffer all messages and send them to the client when it is back online.

  ...


【IoT】Node.js MQTT Demo

Setup MQTT Server

If you want to run your own MQTT broker (MQTT Server), you can use Mosquitto or Mosca, and launch it.

Take mosca as an example:

  ...