了解操作系统资源

来源:互联网 发布:c语言求逻辑表达式格式 编辑:程序博客网 时间:2024/06/08 09:52

使用操作系统缓存

在unix系统上 数据库文件放在unix上 默认的所有的数据库io都是通过文件系统io 这会消耗系统资源 对性能并没有帮助 在一些unix上可以使用直接io 这会保持cpu资源 可以让操作系统缓存致力于非数据库活动。

在windows上并不存在这样的问题 所有的数据库请求忽略了操作系统的缓存。

尽管操作系统缓存因为oraclebuffer cache块的存在而显得多余 但是在一些情况下oracle不适用buffer cache  。下面的情况 使用直接路径io会忽略操作系统缓存 或是使用裸设备也不会使用操作系统缓存 这些情况也许比起使用操作系统缓存更加糟糕。

filesystemio-options初始化参数

使用这个参数来启用和禁用异步io或是直接路径io。这个参数是平台相关的 并且默认的值对特定平台是最好的。可以动态修改这个参数

FILESYTEMIO_OPTIONS can be set to one of the following values:

  • ASYNCH: enable asynchronous I/O on file system files, which has no timing requirement for transmission.

  • DIRECTIO: enable direct I/O on file system files, which bypasses the buffer cache.

  • SETALL: enable both asynchronous and direct I/O on file system files.

  • NONE: disable both asynchronous and direct I/O on file system files.

监控操作系统cpu使用率

Use the V$OSSTAT or V$SYSMETRIC_HISTORY view to monitor system utilization statistics from the operating system. Useful statistics contained inV$OSSTAT andV$SYSMETRIC_HISTORY include:

  • Number of CPUs

  • CPU utilization

  • Load

  • Paging

  • Physical memory

unix上面使用sar -u可以看到cpu的使用率

检查内存管理

在unix上使用sar 或 vmstat来监控叶交换的情况 在unix上进程空间太大导致页表变的很大 在windows上这不是问题

检查io管理

抖动时io管理的一个问题。当你的进程有cpu时间的时候 操作系统分配给你固定的时间段 如果进程花费时间段德大部分时间来确认所有需要的部分都在系统中 那么进程可能只用一半的时间来真正的干活。

一个过渡的io系统很可能磁盘队列长度超过2.或是磁盘响应时间在20到30ms

检查网络

检查client/server的往来次数 在处理信息的时候有额外的消耗 当一个应用产生了很多的消息需要被发送到网络上 发送消息的延时可能有额外的cpu消耗。为了避免这个问题 要批量发送消息 而不是有很多往来次数。可以使用向量插入 向量获取

进程管理检查

调度和转换

上下文切换对大的sga消耗很大。在windows上上下文切换不是问题。oracle对上下文切换有几个特点。下面会讨论

post-wait驱动

oracle进程需要可以通知别的进程同时也要能等待被通知。通常这种post-wait机制在unix上用信号量来实现。但是这些可能导致资源紧张。因此一些平台提供了post-wait驱动 典型的是一个内核设备驱动.,是一个轻量级的实现post-wait借口的实现。

 

9.4.4.2.2 Memory-mapped System Timer

Oracle often needs to query the system time for timing information. This can involve an operating system call that incurs a relatively costly context switch. Some platforms implement a memory-mapped timer that uses an address within the processes virtual address space to contain the current time information. Reading the time from this memory-mapped timer is less expensive than the overhead of a context switch for a system call.

9.4.4.2.3 List I/O Interfaces to Submit Multiple Asynchronous I/Os in One Call

List I/O is an application programming interface that allows several asynchronous I/O requests to be submitted in a single system call, rather than submitting several I/O requests through separate system calls. The main benefit of this feature is to reduce the number of context switches required.

 

0 0
原创粉丝点击