西维蜀黍

【Engineering】WebSocket

WebSocket

WebSocket is a computer communications protocol, providing a simultaneous two-way communication channel over a single Transmission Control Protocol (TCP) connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011. The current specification allowing web applications to use this protocol is known as WebSockets.

  ...


【Distributed System】Handle Conflicts - Version Vector/ 向量时钟(Vector Clock)

Version Vector/ 向量时钟(Vector Clock)

A version vector is a data structure used to track changes in distributed systems, particularly for conflict resolution in eventual consistency models.

🛠️ Used in:

  • Distributed databases (e.g., DynamoDB, Riak, CRDTs)
  • File synchronization (e.g., Dropbox, Git)
  • Conflict resolution in replicated systems
  • Event ordering & causality tracking
  ...


【Distributed System】Handle Conflicts - 时间戳(Lamport Timestamp)

The Lamport timestamp algorithm is a simple logical clock algorithm used to determine the order of events in a distributed computer system. As different nodes or processes will typically not be perfectly synchronized, this algorithm is used to provide a partial ordering of events with minimal overhead, and conceptually provide a starting point for the more advanced vector clock method. The algorithm is named after its creator, Leslie Lamport.

Distributed algorithms such as resource synchronization often depend on some method of ordering events to function. For example, consider a system with two processes and a disk. The processes send messages to each other, and also send messages to the disk requesting access. The disk grants access in the order the messages were received. For example process A sends a message to the disk requesting write access, and then sends a read instruction message to process B. Process B receives the message, and as a result sends its own read request message to the disk. If there is a timing delay causing the disk to receive both messages at the same time, it can determine which message happened-before the other: A happens-before B if one can get from A to B by a sequence of moves of two types: moving forward while remaining in the same process, and following a message from its sending to its reception. A logical clock algorithm provides a mechanism to determine facts about the order of such events. Note that if two events happen in different processes that do not exchange messages directly or indirectly via third-party processes, then we say that the two processes are concurrent, that is, nothing can be said about the ordering of the two events.[1]

Lamport invented a simple mechanism by which the happened-before ordering can be captured numerically. A Lamport logical clock is a numerical software counter value maintained in each process.

Conceptually, this logical clock can be thought of as a clock that only has meaning in relation to messages moving between processes. When a process receives a message, it re-synchronizes its logical clock with that sender. The above-mentioned vector clock is a generalization of the idea into the context of an arbitrary number of parallel, independent processes.

  ...


【Architectural Pattern】Overall

From Mud to Structure (High level decompositions)

  • Layers
  • Pipes and Filters
  • Blackboard

Distributed Systems

  • Broker

Interactive Systems

  • MVC (Model-view-controller)
  • Presentation-Abstraction-Control

Adaptable Systems

  • Microkernel
  • Reflection
  ...


【Distributed System】Observability

Observability

In software engineering, more specifically in distributed computing, observability is the ability to collect data about programs’ execution, modules’ internal states, and the communication among components. To improve observability, software engineers use a wide range of logging and tracing techniques to gather telemetry information, and tools to analyze and use it. Observability is foundational to site reliability engineering, as it is the first step in triaging a service outage. One of the goals of observability is to minimize the amount of prior knowledge needed to debug an issue.

  ...


【Database】Overview

  ...


【ClickHouse】学习

Install

Ubuntu

# install
sudo apt install clickhouse-server clickhouse-client

sudo service clickhouse-server start
sudo service clickhouse-server status

# connect
# 1. Download the binary
curl https://clickhouse.com/ | sh

# 3. Start the client
# Use the clickhouse-client to connect to your ClickHouse service. Open a new Terminal, change directories to where your clickhouse binary is saved, and run the following command:
./clickhouse client --host 192.168.18.247
# You should see a smiling face as it connects to your service running on localhost:
my-host :)

What Is ClickHouse?

ClickHouse® is a high-performance, column-oriented SQL database management system (DBMS) for online analytical processing (OLAP).

  ...


【InfluxDB】学习

InfluxDB

InfluxDB 2.7 is the platform purpose-built to collect, store, process and visualize time series data. Time series data is a sequence of data points indexed in time order. Data points typically consist of successive measurements made from the same source and are used to track changes over time. Examples of time series data include:

  • Industrial sensor data
  • Server performance metrics
  • Heartbeats per minute
  • Electrical activity in the brain
  • Rainfall measurements
  • Stock prices
  ...


【Distributed System】消息队列 - 延时队列(Delay Queues)

延时队列(Delay Queues)

Delay queues let you postpone the delivery of new messages to consumers for a number of seconds, for example, when your consumer application needs additional time to process messages. If you create a delay queue, any messages that you send to the queue remain invisible to consumers for the duration of the delay period.

  ...


【PVE】软路由在 PVE 中安装 OpenWrt

  ...