PTE写作模板
第一段四句:
Nowadays, an increasing number of people are concerned about 题目关键词 all over the world.
However,whether 辩论两边观点(单边观点也行) is a controversial issue.
From my perspective, it exerts an adverse/ a profound impact on (government, environment,关键词涉及的人事物都可以)
Therefore, sb should pay more attention to … rather than …
第二段三句:
To begin with, it is undeniable that… plays a significant role in…, such as…
That is,… (改写第一句话)
As a result,… (表结果,可以跟给的例子有关,没关也行), which will lead to…
第三段四句:
englis diary
1 | gpt prompt: |
day 1
Today, I am preparing to write an article to improve my English level, I hope it will have a positive effect on my English level. The main reason is that I will have a PTE exam in a few weeks. The PTE exam is divided into listening, reading, speeking, and writing parts, I feel week in all parts. I want to achieve a good score because I intend to work in Australia. My goal is to score at least 65 points in all parts, which would classify my English as proficient. It’s a big challege for me because I haven’t been lerning English since I graduated from university. I look forward to having a life of freedom, but I find myself working from home every day. Moreover I’m concerned that if I don’t take this seriously, I might lose my job by the time I turn 35. Therefore, I’m exploring solutions to potentially move to Australia.
I’ve writen down some words and handled them over to ChatGPT for sentence optimization, this way, I aim to enhance my ability to express myself in English. Effective communication requires a long grasp of expression. For instance, the ability to quickly organize sentences on the spot, without prolonged pauses for thought.
I’ve acquired 200 new words, I plan to learn an aditional 200 every day. This is primarily to improve my ability to pronounce them quickly, as I might encounter them in the reading section of the PTE exam, allowing me to read more fluently.
stun udp
1 | https://cloud.tencent.com/developer/article/2215771 |
p2p server
需要通过stun穿透协议定时与穿透服务通信,即在定时器线程里面发送SStunLogin,再在epoll里面udp接收SStunLoginResponse表示登录成功,同时epoll里面udp需要解析SStunTransfer穿透命令,收到穿透命令后需要回复对方一个字节的包。
一个字节的穿透包不一定能发出去,比如当p2p client发起打洞标记时请求的p2p server port和p2p server外部端口对不上,那打的标记就没用,或者p2p client不是严格意义上的nat 3网络(外部端口会隔段时间变化),或者是nat 4对称型网络,基本打洞不成功。
1 | // 定时器线程:每隔30秒发送STUN登录请求 |
boost asio使用
1 | https://www.boost.org/doc/libs/1_71_0/doc/html/boost_asio/reference.html |
知识点
1 | # https://sourceforge.net/projects/boost/ |
ibevent是基于Reactor(反应器模式)。boost.asio是基于Proactor(主动器模式)。
io_context类似于reactor或iocp,有两个重要的命名空间boost::asio和boost::asio::ip
boost::asio下的io函数有connect、accept、read_some、write_some,异步io加个async即可。
boost::asio::ip主要有ip地址ip::address,端点ip::tcp::endpoint\ip::udp::address,sockect:ip::tcp::socket\ip::udp::socket.
套接字控制:set_option\get_option\io_control
1 | // TCP套接字可以重用地址 |
dsn服务器搭建
命令记录
1 | yum -y install dnsmasq |
mysql 索引

MySQL 体系结构
- 连接层
最上层是一些客户端和链接服务,主要完成一些类似于连接处理、授权认证、及相关的安全方案。服务器也会为安全接入的每个客户端验证它所具有的操作权限。 - 服务层
第二层架构主要完成大多数的核心服务功能,如 SQL 接口,并完成缓存的查询, SQL 的分析和优化,部分内置函数的执行。所有跨存储引擎的功能也在这一层实现,如过程、函数等。 - 引擎层
存储引擎真正的负责了 MySQL 中数据的存储和提取,服务器通过 API 和存储引擎进行通信。不同的存储引擎具有不同的功能,这样我们可以根据自己的需要,来选取合适的存储引擎。 - 存储层
主要是将数据存储在文件系统之上,并完成与存储引擎的交互。
show create table account,查看建表语句,engine指定存储引擎。show engins查询支持的引擎。
InnoDB
redis多级缓存

传统的缓存策略一般是请求到达 Tomcat 后,先查询 Redis ,如果未命中则查询数据库,存在下面的问题:
- 请求要经过 Tomcat 处理, Tomcat 的性能成为整个系统的瓶颈
- Redis 缓存失效时,会对数据库产生冲击
多级缓存方案
用作缓存的 Nginx 是业务 Nginx ,需要部署为集群,再有专门的 Nginx 用来做反向代理(proxy_pass+upstream配置):
缓存在日常开发中启动至关重要的作用,由于是存储在内存中,数据的读取速度是非常快的,能大量减少对数据库的访问,减少数据库的压力。我们把缓存分为两类:
- 分布式缓存,例如 Redis :
- 优点:存储容量更大、可靠性更好、可以在集群间共享.缺点:访问缓存有网络开销
- 场景:缓存数据量较大、可靠性要求较高、需要在集群间共享
- 进程本地缓存,例如 HashMap 、 GuavaCache :
- 优点:读取本地内存,没有网络开销,速度更快·缺点:存储容量有限、可靠性较低、无法共享
- 场景:性能要求较高,缓存数据量较小
redis集群
单点redis问题
- 数据丢失,实现redis持久化
- 并发能力,主从集群,读写分离
- 故障恢复,哨兵机制,健康监测,自动恢复
- 存储能力,分片集群,插槽机制实现动态扩容
redis持久化
rdb,redis数据备份文件,实现持久化。
save命令开启,主进程阻塞完成。bgsave后台完成。停机时自动执行rdb。
redis.conf可以配置,save 900 1表示900秒内,如果至少一个key被修改,则执行bgsave,如果是save “”,则表示禁用rdb。dbfilename和dir也可以配置文件名和目录,rdbcompression可以配置是否压缩,但会消耗cpu。

bgsave开始时会fork主进程得到子进程,子进程共享主进程的内存数据,完成fork后读取内存数据写入rgb文件。fork采用copy-on-write技术,读操作访问共享内存,写操作拷贝数据执行写操作,所以极端情况所有数据都被修改了,可能内存会翻倍。
日常开发工具
在 CentOS 系统上安装 Google Chrome 浏览器,可以按照以下步骤进行:
添加 Google Chrome 的 YUM 源
在终端中输入以下命令:
sudo tee /etc/yum.repos.d/google-chrome.repo <<-‘EOF’
[google-chrome]
name=google-chrome - $basearch
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
EOF
安装 Google Chrome
输入以下命令进行安装:
yum -y install google-chrome-stable –nogpgcheck
启动 Google Chrome
在终端中输入以下命令启动 Google Chrome 浏览器:
google-chrome
这样就可以在 CentOS 系统上安装和使用 Google Chrome 浏览器了,输入法安装:https://www.google.cn/intl/zh-CN/inputtools/chrome/index.html。