亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

64位中使用AWE分配內(nèi)存

系統(tǒng) 1743 0

We have already talked about Windows AWE mechanism on 32 bit and how SQL Server utilizes it. Today I would like to go over AWE & related mechanism on 64 bit platforms.

我們已經(jīng)談過windows AWE 在32bit 中sql server 如何利用。下面是AWE在64位環(huán)境的相關(guān)性
?
To some people it comes as a surprise that AWE mechanism is still present and actually could be useful on 64 bit platforms. As you remember the mechanism consists of two parts allocating physical memory and mapping it to the given process's VAS. The advantage of allocation mechanism is that once physical memory is allocated operating system can't reclaim it until either the process is terminated or the process frees memory back to the OS. This feature allows an application to control and even avoid paging altogether. Advantage of mapping/unmapping mechanism is that the same physical page could be mapped into different VAS's regions. As you imaging unmapping is not necessary on 64 bit platforms since we have enough VAS to accommodate all of existing physical memory.
?
對(duì)于有些人會(huì)很驚奇AWE機(jī)制任然存在并且在64位中是可用的。這個(gè)機(jī)制分為2部分分配內(nèi)存和映射到給定的VAS中。這種分配機(jī)制的好處是不會(huì)被系統(tǒng)回收,直到進(jìn)程終止或者進(jìn)程內(nèi)存被釋放會(huì)操作系統(tǒng)。這特性允許應(yīng)用程序控制并且避免分頁。映射和非映射機(jī)制的好處是相同的物理頁可以被映射到不同VAS空間。你可以想象在64bit中非映射是沒有必要的,因?yàn)?4bit 有足夠的vas容納所有物理內(nèi)存。
?

From Operating System theory, OS implements a page table entry, PTE, to describe a mapping of a page in VAS to physical page. Internally physical page is described by page frame number, PFN. Given PFN one can derive complete information about physical page it represents. For example PFN shows to which NUMA node the particular page belongs. OS has a database, collection of PFNs that it manages.??If page in VAS is committed, it has PTE which might or might not point to given PFN.??Conceptually, page that PTE represents can be either in memory or not, for example swapped out to disk. In the former case it is bound to a given PFN and in latter it is not. In its turn, once a physical page is bound to page in VAS, its PFN points back to PTE.

來自操作系統(tǒng)的理論,操作系統(tǒng)引入一個(gè)頁表項(xiàng),PTE,描述了一個(gè)在VAS中的頁到物理頁的映射。物理頁被頁幀號(hào)描述,PFN。給定的PFN可以導(dǎo)出所有它代表的物理頁。例如PFN顯示了指定的物理也屬于那個(gè)NUMA節(jié)點(diǎn)。OS有一個(gè)數(shù)據(jù)庫收集了PFN并且管理它。如果頁在VAS中已經(jīng)被提交了,PTE可能指向了一個(gè)給定的PFN。理論上PTE上的頁可能在內(nèi)存上也可能沒有,如切換到了磁盤上。先前的例子頁綁定了一個(gè)PFN,并且之后不綁定了。一旦物理頁被綁定到VAS中,PFN就反向指向到PTE。
?

When OS commits, frees, pages out/in a given PTE or needs to derive some information about it, for example NUMA residency, it has to acquire process's working set lock - to guarantee stability of PTE to PFN binding. This lock is a rather expensive and might hurt scalability of the process. Latter versions of Windows made this lock as light as possible but avoiding still will benefit application's scalability..

當(dāng)OS提交,釋放,切換一個(gè)給定的PTE或者取一些頁的信息。比如NUMA位置,頁不得不請(qǐng)求進(jìn)程工作集鎖,來保證PTE到PFN之間的穩(wěn)定性。這個(gè)鎖定比較昂貴并且可能會(huì)損害進(jìn)程的擴(kuò)展性。之后的windows版本會(huì)使這個(gè)鎖越來越輕量但是不能保證會(huì)對(duì)程序的擴(kuò)展性有好處。
?

When allocating physical pages utilizing AWE mechanism we are given a set of PFN entries directly from PFN database - remember that you should not manipulate or modify set of entries you get back??nor can you rely on values you get back. OS is required to take a PFN database lock when allocating PFN entries. Using AWE map mechanism you can map allocated PFN entries to the process's VAS. When mapping occurs PTEs are allocated, bound to PFNs and marked as locked. In this case OS needs to acquire process's working set lock only ones. When mapping regular pages, OS does it on demand and hence will have to acquire both working set and PFN database lock for every page. Since pages are locked in memory, OS will ignore these PTEs during??paging process.

當(dāng)物理內(nèi)存通過AWE分配的時(shí)候,我們獲取的PFN項(xiàng)直接來至于PFN數(shù)據(jù)庫——記住你不能刪除或者修改你獲取的項(xiàng),也不能依賴你獲取的值。當(dāng)PFN被分配的時(shí)候,OS會(huì)請(qǐng)求鎖定PFN數(shù)據(jù)庫。使用AWE映射機(jī)制你可以把PFN映射到進(jìn)程的VAS中。當(dāng)映射發(fā)生PTE就會(huì)被分配,綁定到PFN并且標(biāo)記被鎖定。這個(gè)時(shí)候OS只需要獲取進(jìn)程的工作集鎖。當(dāng)映射常規(guī)也的時(shí)候,OS按需求,并且會(huì)請(qǐng)求工作集鎖和PFN數(shù)據(jù)庫鎖。因?yàn)轫撛趦?nèi)存中是鎖定的,在分頁進(jìn)程的時(shí)候OS會(huì)忽略這些PTE。
?

On 64 bit platforms it is better to refer to such pages as locked pages - please don't confuse them with pages locked through VirtualLock API. As described above locked pages have two major properties - they are not considered for paging by OS and during allocation they acquire both working set and PFN database lock only ones.?

在64bit平臺(tái)上, 這些頁被鎖定會(huì)更好——不要喝通過VirtualLock API混淆。頁鎖定有2個(gè)主要的屬性——他們不會(huì)被OS分頁并且在分配的時(shí)候只會(huì)請(qǐng)求工作集鎖和PFN鎖的一個(gè)。
?

The first property has implicit implication on high end hardware such as NUMA. It provides explicit memory residency. Remember that OS commits a page on demand. To allocate physical memory, it will use a node on which a thread touching memory is running.??Latter on, the page can be swapped out by OS. Next time it will be brought up into memory, OS will again allocate physical page from the node a thread touching memory is running on. In this case a node could be completely different??from original one. Such behavior makes hard for applications to rely on page's NUMA residency. Locked pages solve this problem by removing themselves from paging altogether.??Moreover Windows 2003 SP1 introduced a new API - QueryWorkingSetEx. It allows to query extended??information about PTE's PFN.??In order to find out real page residency you should use this API. When pages are locked you need to it only ones. Otherwise you will have to do it periodically since residency of the page can actually change.

?第一個(gè)屬性隱約的涉及到了高端的硬件如NUMA。它提供了顯示的內(nèi)存位置。記住OS按需求提交了頁。分配內(nèi)存的時(shí)候會(huì)在線程觸及到的內(nèi)存節(jié)點(diǎn)中分配內(nèi)存。
?

The second property - taking both working set and PFN's database lock only ones enables applications to perform faster and better scalable ramp up.

?第二個(gè)屬性——只要獲取工作集鎖和PFN數(shù)據(jù)庫鎖一個(gè),可以讓應(yīng)用程序運(yùn)行的更快并且有更好的擴(kuò)展性。
?

On NUMA SQL Server' Buffer Pool marks each allocated page with its node residency. It leverages QueryWorkingSetEx to accomplish it.??Once page is allocated it calls the API to find??out page residency.???It does it only once. Therefore enabling locked pages for SQL server on 64 bit platform??will improve SQL Server ramp up time and will improve performance & scalability over longer period of time. When running SQL Server with locked pages enabled you shouldn't be worried about overall system performance due to memory starvation - SQL Server participates in OS's paging mechanism by listening on OS's memory notification API's and shrinks its working set accordingly.

?在NUMA SQL Server buffer pool 中標(biāo)記了每個(gè)分配也的節(jié)點(diǎn)位置。使用QueryWorkingSetEx來完成。一旦頁分配,就會(huì)調(diào)用api查找出頁所在節(jié)點(diǎn),只運(yùn)行一次。因此SQL Server 64位平臺(tái)會(huì)提高SQL Server 加速并且會(huì)提高性能和可擴(kuò)展性。當(dāng)運(yùn)行sql server鎖定頁你不需要擔(dān)心因?yàn)閮?nèi)存不足引起的性能問題——sql server 會(huì)監(jiān)聽OS內(nèi)存通知api參與分頁并且壓縮工作集。
?

Let us summarize now - on 64 bit platform, locked pages, awe mechanism, enable better application's scalability and performance both during ramp up time and over long period of time. However, keep in mind that an application is still required to implement a way of responding to memory pressure to avoid starving the whole system for memory.

總結(jié)一下:在64位的平臺(tái)上,鎖定頁,AWE分配機(jī)制,可以讓應(yīng)用程序有更好的擴(kuò)展性和性能。但是記住一個(gè)應(yīng)用程序也要增強(qiáng)相應(yīng)內(nèi)存壓力的能力來避免整個(gè)系統(tǒng)的內(nèi)存不足。

64位中使用AWE分配內(nèi)存


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 可以免费观看一级毛片黄a 可以直接看的毛片 | 毛片免费全部免费观看 | 香蕉网站在线 | 久久精品国产欧美成人 | 国产中文字幕免费观看 | 中文字幕在线高清 | 久久爱www人成 | 在线视频日韩精品 | 亚洲视频一区二区三区四区 | 99热这里只有精品69 | 久久久久综合国产 | 视频一区久久 | 久久精品国产99精品最新 | 一本到在线观看视频不卡 | 久草视频免费在线播放 | 一区二区三区乱码 | 亚洲人成在线免费观看 | 国产欧美在线观看一区二区 | 四虎久久影院 | 欧美真人视频一级毛片 | 国产人做人爱免费视频 | 日本一级毛片在线播放 | 亚洲综合在线另类色区奇米 | 国产久7精品视频 | 亚洲精品成人一区二区aⅴ 亚洲精品成人一区二区www | 水浒传删减剧情在线观看 | 成人午夜在线 | 久久黑丝| 四虎影院地址 | 天天搞夜夜操 | 狠狠色丁香婷婷综合久久来 | 亚洲一区三区 | 久久久久无码国产精品一区 | 最近中文字幕无吗高清视频 | 天天色综合色 | 日韩欧美三区 | 国产精品久久久久久久久免费 | 麻豆国产原创最新在线视频 | 视频二区 中文字幕 欧美 | 老子影院午夜伦不卡 | 精品无人区乱码一区二区三区手机 |