发新话题
打印

问一个磁盘阵列内部FC-AL架构的性能问题

引用:
原帖由 diy99 于 2006-11-13 17:52 发表
我同意关闭磁盘的缓存会影响一些性能,但是不关闭则会影响数据的安全.一般来说,盘阵的cache收到hostdata,它就返回success,然后在后台flushdata,当磁盘的缓存收到data,它就会返回Success.盘阵收到sucess,盘阵的ca ...
Scsi命令 cdb[0] = 0x2a 写命令. cdb[1]有一位Force Unit Access,FUA为1,磁盘缓存关闭,write through. FUA为0,磁盘缓存打开,write back. 所以每一个写命令都可以选择writethrough or write back
受教了,请教diy兄,scsi命令一般都是WB模式还是WT模式?  WB模式会丢失数据,那么如果是一个银行客户,我存入了10w元,此时数据库将数据提交给了磁盘,磁盘返回成功,此时突然磁盘掉电,那么这10w元的数据就没有更新,重启服务后,发现我账户中还是原来的数目,怎么办?
那这是不是说,象银行这种应用,必须为WT模式是么?

或者是人为的分析数据库的日志,然后进行恢复?

实际中各位版主和大侠做项目的时候都考虑过这一点么?请赐教一二。

[ 本帖最后由 myprotein 于 2006-11-14 08:59 编辑 ]
http://space.doit.com.cn/35700
存储界的首本个性之作《大话存储-网络存储系统原理精解与最佳实践》,将于9月初由清华大学出版社隆重出版!敬请关注!

TOP

引用:
原帖由 myprotein 于 2006-11-14 08:57 发表


受教了,请教diy兄,scsi命令一般都是WB模式还是WT模式?  WB模式会丢失数据,那么如果是一个银行客户,我存入了10w元,此时数据库将数据提交给了磁盘,磁盘返回成功,此时突然磁盘掉电,那么这10w元的数据 ...
终于明白了吧!

TOP

引用:
原帖由 myprotein 于 2006-11-14 08:57 发表


受教了,请教diy兄,scsi命令一般都是WB模式还是WT模式?  WB模式会丢失数据,那么如果是一个银行客户,我存入了10w元,此时数据库将数据提交给了磁盘,磁盘返回成功,此时突然磁盘掉电,那么这10w元的数据 ...
这种情况肯定是不允许发生的,各厂商的磁盘阵列的微码和硬盘的微码都已经考虑这一点。作项目的时候可能会考虑这些东西吗?

TOP

引用:
原帖由 nfdx 于 2006-11-14 09:19 发表



终于明白了吧!
糊涂着呢。nfdx兄前面的帖子中说磁盘缓存都是WB模式,此时又说 这种情况不会发生,真不懂nfdx兄到低想要表达什么观点。

到这里又引发了一个问题,就是写cahce的问题,读cache,前面讨论过了,各个磁盘都以cache的速度向外传输数据流,从而达到fcal环的带宽,这是读,那么写就远远小于读的速度了。

所以分析一下,写的时候,到低是cache的WB模式,还是WT模式。那么各个厂家又是怎么实现的,既然WB模式会造成很大的灾难,那么做项目的时候为什么不考虑呢?nfdx兄说不用考虑,那么您的根据何在?
http://space.doit.com.cn/35700
存储界的首本个性之作《大话存储-网络存储系统原理精解与最佳实践》,将于9月初由清华大学出版社隆重出版!敬请关注!

TOP

引用:
原帖由 myprotein 于 2006-11-14 09:53 发表


糊涂着呢。nfdx兄前面的帖子中说磁盘缓存都是WB模式,此时又说 这种情况不会发生,真不懂nfdx兄到低想要表达什么观点。

到这里又引发了一个问题,就是写cahce的问题,读cache,前面讨论过了,各个磁盘都 ...
磁盘缓存(cache),通常有如下作用:
1)prefetch(预读),通过预测提前读取盘片数据到cache,从而减少机械读写磁盘的频度。
2)缓存数据,将数据暂存到cache中,然后在某个时间时批量的写入盘片,这在提供Queue能力的磁盘中用的相当广泛;当然,这会带来安全隐患,就是突然掉电丢失数据的问题,对此硬盘厂商会将缓存数据写入到某个暂存区域(即使掉电数据也不丢失),等下次启动时再将它写入cache。
3) 用于LRU算法中,可以将频繁访问的数据暂存起来,提高I/O的命中率。
  现在磁盘缓存的大小通常为2MB和8MB,在服务器或者特殊领域,甚至达到16MB、64MB等。
  理论上,缓存的容量越大,性能应该越好;但实际上,缓存的算法设计才是真正的核心,只有在硬盘的Firmware中采用高效的算法才能保证更好的性能。

  至于数据的可靠性,单单磁盘是不能全部cover的!从而才基于磁盘的RAID技术,基于控制控制器的NVRAM,基于路径的Multipath,基于主机和应用的Cluster,基于数据库操作的Transaction....

TOP

引用:
原帖由 rechardluo 于 2006-11-14 11:08 发表

当然,这会带来安全隐患,就是突然掉电丢失数据的问题,对此硬盘厂商会将缓存数据写入到某个暂存区域(即使掉电数据也不丢失),等下次启动时再将它写入cache。
不好意思,luo兄这段话是搜索copy的还是自己写的?我同样搜索到过这段话,意思差不多,但是他是这么说的:“当然,这会带来安全隐患,就是突然掉电丢失数据的问题,对此硬盘厂商会(利用磁头的惯性)将缓存数据写入到某个暂存区域(即使掉电数据也不丢失),等下次启动时再将它写入cache。

注意括号中的话,利用磁头的惯性,我想这纯属无稽之谈,或者我才疏学浅,真不知道还可以有这种技术。

[ 本帖最后由 myprotein 于 2006-11-14 11:23 编辑 ]
http://space.doit.com.cn/35700
存储界的首本个性之作《大话存储-网络存储系统原理精解与最佳实践》,将于9月初由清华大学出版社隆重出版!敬请关注!

TOP

引用:
原帖由 myprotein 于 2006-11-14 11:19 发表


不好意思,luo兄这段话是搜索copy的还是自己写的?我同样搜索到过这段话,意思差不多,但是他是这么说的:“当然,这会带来安全隐患,就是突然掉电丢失数据的问题,对此硬盘厂商会(利用磁头的惯性)将缓存 ...
嗯!
俺也是google一把,顺便瞅瞅一些磁盘厂商的白皮书.
因为没有设计过磁盘机械控制的东西,不敢乱评别人设计的细节!

TOP

期待有位达人来给小弟解疑释惑
http://space.doit.com.cn/35700
存储界的首本个性之作《大话存储-网络存储系统原理精解与最佳实践》,将于9月初由清华大学出版社隆重出版!敬请关注!

TOP

我也google了一下,找到一篇比较透彻的.

Write Caching
Caching reads from the hard disk and caching writes to the hard disk are similar insome ways, but very different in others. They are the same in their overall objective: todecouple the fast PC from the slow mechanics of the hard disk. The key difference is thata write involves a change to the hard disk, while a read does not.


With no write caching, every write to the hard disk involves a performance hit whilethe system waits for the hard disk to access the correct location on the hard disk andwrite the data. As mentioned in the generaldiscussion of the cache circuitry and operation, this takes at least 10 millisecondson most drives, which is a long time in the computer world and really slows downperformance as the system waits for the [color=blue ! important][color=blue ! important]hard [color=blue ! important]disk. This mode of operation is called write-throughcaching. (The contents of the area written actually are put into the cache in case itneeds to be read again later, but the write to the disk always occurs at the sametime.)


When write caching is enabled, when the system sends a write to the hard disk, thelogic circuit records the write in its much faster cache, and then immediately sends backan acknowledgement to the [color=blue ! important][color=blue ! important]operating [color=blue ! important]system saying, in essence, "all done!" Therest of the system can then proceed on its merry way without having to sit around waitingfor the actuator to position and the disk to spin, and so on. This is called write-backcaching, because the data is stored in the cache and only "written back" to theplatters later on.


Write-back functionality of course improves performance. There's a catch however. Thedrive sends back saying "all done" when it really isn't done--the data isn't onthe disk at all, it's only in the cache. The hard disk's logic circuits begin to write thedata to the disk, but of course this takes some time. The hard disk is using a variant ofthat old "the check is in the mail" trick you might hear when you call someoneto remind them of that loan they were supposed to pay back three weeks ago. :^)


Now, this isn't really a problem most of the time, as long as the power stays on.Since cache memory is volatile, if the power goesout, its contents are lost. If there were any pending writes in the cache that were notwritten to the disk yet, they are gone forever. Worse, the rest of the system has no wayto know this, because when it is told by the hard disk "all done", it can'treally know what that means. So not only is some data lost, the system doesn't even knowwhich data, or even that it happened. The end result can be file consistency problems,operating system corruption, and so on. (Of course, this problem doesn't affect cachedreads at all. They can be discarded at any time.)


Due to this risk, in some situations write caching is not used at all. This isespecially true for applications where high data integrity is critical. Due to theimprovement in performance that write caching offers, however, it is increasingly beingused despite the risk, and the risk is being mitigated through the use of additionaltechnology. The most common technique is simply ensuring that the power does not go off!In high-end server environments, with their uninterruptiblepower supplies and even redundant powersupplies, having unfilled cached writes is much less of a concern. For added peace ofmind, better drives that employ write caching have a "write flush" feature thattells the drive to immediately write to disk any pending writes in its cache. This is acommand that would commonly be sent before the UPS batteries ran out if a powerinterruption was detected by the system, or just before the system was to be shut down forany other reason.

TOP

谢谢diy兄

那么目前不如银行,保险,股票等等业务都是关闭磁盘cache运行的么?有没有达人作项目的时候注意过这方面的问题?
http://space.doit.com.cn/35700
存储界的首本个性之作《大话存储-网络存储系统原理精解与最佳实践》,将于9月初由清华大学出版社隆重出版!敬请关注!

TOP

发新话题