Skip to content

Instantly share code, notes, and snippets.

@earayu
earayu / kubeblocks_pg.txt
Created March 17, 2025 04:09
Install PostgreSQL on Kubernetes with KubeBlocks
# Install PostgreSQL on Kubernetes with KubeBlocks
## Introduction
Managing databases on Kubernetes has always been a challenge—until **KubeBlocks** arrived!
KubeBlocks provides a **unified API**, allowing you to manage **MySQL, PostgreSQL, MongoDB, Redis, Pulsar, ClickHouse**, and more in a consistent way without learning multiple database operation tools.
In this tutorial, we will focus on **PostgreSQL** and demonstrate how to install and connect to a PostgreSQL database on Kubernetes using KubeBlocks.
@earayu
earayu / gist:9a546949b45a76ee8822ca3a23e19eb3
Created March 15, 2025 02:18
Best kubernetes database operator: KubeBlocks
Best kubernetes database operator: KubeBlocks
https://github.com/apecloud/kubeblocks
docker run --network host --rm \
apecloud/customsuites:latest \
sysbench \
--db-driver=mysql \
--report-interval=1 \
--tables=40 \
--table-size=250000 \
--threads=4 \
--time=10 \
--mysql-host=127.0.0.1 \

考虑这个问题: 在Golang的函数中创建一个struct,然后将它return,这个struct的内存空间会被分配在哪里?return的时候会有哪些操作?是否会发生拷贝?

有关go内存是在堆上分配的,还是在栈上分配的,这个是在编译过程中,通过逃逸分析来确定的,其主体思想是: 假设有变量v,及指向v的指针p,如果p的生命周期大于v的生命周期,则v的内存要在堆上分配。 https://cloud.tencent.com/developer/article/1861199

小技巧:我们也可以在编译时,通过加上-m参数,来让编译器告诉我们,一个变量到底是分配在堆上,还是在栈上

@earayu
earayu / TodoListTemplate.md
Last active April 23, 2023 11:01
Todo list template

Template:

- [x] task1
- [ ] task2
- [x] task3
- [ ] task4

Effect:

  • task1
  • task2