Introduction

This post mainly covers the mechanisms and syntax of Docker healthcheck and Docker Compose's depends_on. This post can be viewd as a cheat sheet.

healthcheck Mechanism

When a container has a healthcheck specified, it has a health status in addition to its normal status. This status is initially starting. Whenever a health check passes, it becomes healthy (whatever state it was previously in). After a certain number of consecutive failures, it becomes unhealthy.

Read more »

问题

最近外网爆出了 Intel 13、14 代 i9 打游戏会报显存错误。这个也许只是 CPU 不稳定导致的短时运算错误,不足为惧[1]。但是,B站上有人讨论很多 14 代 i9 在待机模式下蓝屏,甚至 13700K 也出现了这种现象。如果消息准确,那么使用了半年的 14代 i9 就出现了“缩缸”现象(硬件损坏导致的永久性能损失)。理论上,CPU 的寿命至少是 10 年,而且大部分 CPU 都是不用了、而不是用坏了。我的 CPU 就是 13700K,这让我非常警惕。

对于这个问题的讨论有两点需要厘清:

  1. 软件报错,比如游戏、压测工具和渲染工具。这一点占据了极大比例的流量。目前,无论是 Intel 官方还是第三方网站、博主,给出的解决方案都是限制功耗和降频,使得软件不会报错。Intel 把锅甩给主板厂商,要求它们按照 Intel 标准来设置 BIOS。目前来看,这个所谓的 Intel 标准电压更高、频率更低,跑分更差。要注意,频率降低等于消费者吃亏。因此,Intel 和主板厂商都有责任
  2. CPU“缩缸”,这是产品缺陷。这一点只占据很小比例的流量。显然,Intel 永远不会承认这一点。也许从 23 年 6 月 Intel 质保政策开始收紧时[2],Intel 已经知道了这一事实。

我是在 23 年初配的电脑,轻度办公、写一写代码,基本没玩过 3A 大作。最近,我用 CPU-Z 和 R23 测试了性能,和网上的结果[3][4]差不多。因此,我的 13700K 应该没有“缩缸”。

话说回来,我倒不是很关心降频,我更关心 CPU 寿命。目前自动核心电压为 1.38 V,R23 跑一次就 100 度。这样的配置,迟早要“缩缸”。因此,本文主要记录我是如何给 CPU 降压的,以及在研究过程中发现的各种问题。

Read more »

Preface

Metabase is an open-source data analysis tool that is easy to operate and can connect to various data sources. Although its data analysis capabilities are not as powerful as Excel, Metabase is sufficient for daily use. Moreover, I am more capable of writing SQL than clicking Excel sheets, so Metabase is a good choice for me.

Read more »

For developers, installing MySQL isn't difficult, but it often involves several steps. I've documented a Docker Compose template that can directly launch a pre-configured MySQL container for development.

Docker compose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
version: '3'
services:
mysql:
image: mysql:5.7
container_name: mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: '123456'
ports:
- 43306:3306
volumes:
- mysql_data:/var/lib/mysql
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --character-set-client-handshake=FALSE
healthcheck:
test: out=$$(mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD); echo $$out | grep 'mysqld is alive' || { echo $$out; exit 1; }
start_period: 0s
interval: 5s
timeout: 3s
retries: 2

volumes:
mysql_data:
external: true

Configuration Explanation

Read more »

Introduction to Glances

There are many configurable widgets in Dashy, among which the most practical one is resource monitoring. Displaying CPU usage on the panel is not useful for me —— I am more concerned about which program is causing high CPU usage. However, the Glances software on which this feature depends is very practical.

Glances is similar to the top command, which can display system resource usage. However, it is better in the following aspects:

  • More comprehensive and user-friendly data display;
  • It can display the resource usage of each container —— in this respect, it surpasses Portainer. Portainer can only display the resource usage of one container in chart form.
  • It can run in server mode. We can monitor resource usage through a browser, which is very convenient.

image-20240408112645115

Glances is relatively lightweight, only displaying the current resource situation without recording historical data. And what I need is precisely this kind of lightweight yet comprehensive resource monitoring software.

Read more »

Preface

Dashy is an open-source customizable dashboard software that requires self-deployment. My use case is to place links of frequently visited websites. This post mainly documents some problems encountered during installation and usage.

Installation

Read more »

Preface

Recently, I've been using Python to write web crawlers for downloading manga (see previous posts on LANraragi). A typical page of a manga like this:

image-20240329132644183

All the data on this webpage can be retrieved using BeautifulSoup, and only one communication is needed per page. However, downloading images is different: each image requires a separate communication, and the response body is often quite large. Obviously, images don't need to be downloaded sequentially, otherwise, it would waste a lot of time.

AIOHTTP is an asynchronous HTTP client/server module, which is very suitable for this scenario. Through asynchronous programming, it can maximize the performance of the network (and the server). This article focuses on introducing the basic usage of AIOHTTP, without going into details about how it works.

Read more »

Problem

Problem Source:889. Construct Binary Tree from Preorder and Postorder Traversal(Daily Challenge)

Problem Description

Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and postorder is the postorder traversal of the same tree, reconstruct and return the binary tree.

If there exist multiple answers, you can return any of them.

Read more »
0%