Linux RCHAR是否包含读取字节(proc/<;pid>;/io)?

Linux RCHAR是否包含读取字节(proc/<;pid>;/io)?,linux,io,linux-kernel,procfs,monetdb,Linux,Io,Linux Kernel,Procfs,Monetdb,我阅读proc//io来测量SQL查询的io活动,其中是数据库服务器的PID。我读取每个查询前后的值以计算差异,并获得请求导致读取和/或写入的字节数 据我所知,READ\u BYTES字段统计实际磁盘IO,而RCHAR包含更多,如linux页面缓存可以满足的读取(请参阅以获取说明)。 这导致了一个假设,RCHAR应该得出一个等于或大于READ_BYTES的值,但我的结果与这个假设相矛盾 我可以想象Infobright ICE的结果会有一些小的块或页面开销(值为MB): 但我完全无法理解Monet

我阅读
proc//io
来测量SQL查询的io活动,其中
是数据库服务器的PID。我读取每个查询前后的值以计算差异,并获得请求导致读取和/或写入的字节数

据我所知,
READ\u BYTES
字段统计实际磁盘IO,而
RCHAR
包含更多,如linux页面缓存可以满足的读取(请参阅以获取说明)。 这导致了一个假设,
RCHAR
应该得出一个等于或大于
READ_BYTES
的值,但我的结果与这个假设相矛盾

我可以想象Infobright ICE的结果会有一些小的块或页面开销(值为MB):

但我完全无法理解MonetDB的IO计数器(值为MB):

我认为
RCHAR
包括
READ_字节
的假设是错误的吗?有没有办法欺骗MonetDB可以使用的内核计数器?这是怎么回事

我可以补充一点,即在每次查询之前清除页面缓存并重新启动数据库服务器。
我在Ubuntu 11.10上,运行内核3.0.0-15-generic。

我只能想到两件事:

1:

我读了“导致从存储层获取”以包括readahead,随便什么

2:

请注意,这并没有说明“通过内存映射文件访问磁盘”。我认为这是更可能的原因,您的MonetDB可能会将其数据库文件映射出来,然后对其执行所有操作


我不太确定如何在mmap上检查已使用的带宽,因为它的性质。

您还可以阅读Linux内核源代码文件:

非常感谢。事实上,他们说,他们使用内存映射文件。
        Query        RCHAR   READ_BYTES
tpch_q01.sql|    34.44180|    34.89453|
tpch_q02.sql|     2.89191|     3.64453|
tpch_q03.sql|    32.58994|    33.19531|
tpch_q04.sql|    17.78325|    18.27344|
        Query        RCHAR   READ_BYTES
tpch_q01.sql|     0.07501|   220.58203|
tpch_q02.sql|     1.37840|    18.16016|
tpch_q03.sql|     0.08272|   162.38281|
tpch_q04.sql|     0.06604|    83.25391|
1446 read_bytes
1447 ----------
1448
1449 I/O counter: bytes read
1450 Attempt to count the number of bytes which this process really did cause to
1451 be fetched from the storage layer.
1411 rchar
1412 -----
1413
1414 I/O counter: chars read
1415 The number of bytes which this task has caused to be read from storage. This
1416 is simply the sum of bytes which this process passed to read() and pread().
1417 It includes things like tty IO and it is unaffected by whether or not actual
1418 physical disk IO was required (the read might have been satisfied from
1419 pagecache)
struct task_io_accounting {
#ifdef CONFIG_TASK_XACCT
  /* bytes read */
  u64 rchar;
  /*  bytes written */
  u64 wchar;
  /* # of read syscalls */
  u64 syscr;
  /* # of write syscalls */
  u64 syscw;
#endif /* CONFIG_TASK_XACCT */

#ifdef CONFIG_TASK_IO_ACCOUNTING
  /*
   * The number of bytes which this task has caused to be read from
   * storage.
   */
  u64 read_bytes;

  /*
   * The number of bytes which this task has caused, or shall cause to be
   * written to disk.
   */
  u64 write_bytes;

  /*
   * A task can cause "negative" IO too.  If this task truncates some
   * dirty pagecache, some IO which another task has been accounted for
   * (in its write_bytes) will not be happening.  We _could_ just
   * subtract that from the truncating task's write_bytes, but there is
   * information loss in doing that.
   */
  u64 cancelled_write_bytes;
#endif /* CONFIG_TASK_IO_ACCOUNTING */
};