Leo Huang wrote:

> The result is followed:
> OS Clients Result(queries per second) TPS(got from
> iostat)
> FreeBSD6.1 50 516.1 about 2000
> Debian3.1 50 49.8 about 200

> I know that MySQL uses fsync() to flush both the data and log files at

I tried to see the effects from fsync() with this little program:


#define BUF_SIZE 512
#define COUNT 50000

int main() {
int fd;
char buf[BUF_SIZE];
int i;

fd = open("test.file", O_CREAT|O_TRUNC|O_WRONLY, 0600);
if (fd < 0) {
printf("cannot open\n");

for (i = 0; i < COUNT; i++) {
if (write(fd, buf, BUF_SIZE) != BUF_SIZE) {
printf("error writing\n");
if (fsync(fd) < 0) {
printf("error in fsync\n");


return 0;

But I see strange results with iostat. It shows 16KB transactions, ~2900
tps and 46 MB/s. On the other hand, the program runs for ~36 seconds,
which gives ~1390 tps (this is a single desktop drive). Since 36 seconds
of 46MB/s would result in a file 1.6 GB in size, while it's clearly
50000*512=25MB, iostat is lying.

I think it's a too valuable tool to be lying. For what it's worth, gstat
is also lying in the same way.
freebsd-fs@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"