C0reFast记事本

to inspire confidence in somebody.

在PHP中,有很多内置的函数,这些函数包括绝大部分的功能,还有一些函数,是PHP的扩展提供的,只有安装了扩展并开启,函数才可以被使用,这些函数的实现,都是用C来实现的,因此有着最好的效率。

在某些情况下,可能要对这些用C实现的函数进行一些额外的更改,比如说,对其进行一个伪实现,或者,在调用之前检查是否满足特定的情况,也就是说,对这些函数进行Hook。
比较暴力的办法,就是找到需要伪实现或者Hook的函数的源代码,直接把对应的源代码修改后重新编译,这样虽然能解决问题,但是相对的,非常麻烦,也不好移植。

下面就是另一个办法,我们可以自己新建一个扩展,然后,在扩展中找到对应的函数实现,然后直接把这个函数实现替换成自己的。

阅读全文 »

由于工作中某个需求,需要使用Cgroups对某个进程的IO进行限制。所以,需要在Cgroup的blkio子系统中进行配置,我们限制的是读取磁盘的iops,所以,需要在blkio.throttle.write_iops_device中写入该限制。

echo "8:0 10" > /cgroup/blkio/test/blkio.throttle.read_iops_device

这里,对sda的read iops进行了限制,上限为10次IO操作每秒。

阅读全文 »

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in trobuleshooting or you can ask me on GitHub.

Quick Start

Create a new post

$ hexo new "My New Post"

More info: Writing

Run server

$ hexo server

More info: Server

Generate static files

$ hexo generate

More info: Generating

Deploy to remote sites

$ hexo deploy

More info: Deployment

0%