锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲?V无码乱码国产精品,亚洲w码欧洲s码免费,亚洲精品午夜国产va久久http://www.tkk7.com/tinysun/category/43874.htmlzh-cnThu, 04 Feb 2010 22:28:58 GMTThu, 04 Feb 2010 22:28:58 GMT60CacheLookup Typa: None, NotInTTS, Found, FoundAndEmpty and EntireTable/ Loading pricedisctable is very slow http://www.tkk7.com/tinysun/archive/2010/02/04/311894.html浣曞厠鍕?/dc:creator>浣曞厠鍕?/author>Thu, 04 Feb 2010 02:31:00 GMThttp://www.tkk7.com/tinysun/archive/2010/02/04/311894.htmlhttp://www.tkk7.com/tinysun/comments/311894.htmlhttp://www.tkk7.com/tinysun/archive/2010/02/04/311894.html#Feedback0http://www.tkk7.com/tinysun/comments/commentRss/311894.htmlhttp://www.tkk7.com/tinysun/services/trackbacks/311894.html
Record Caching

Microsoft Dynamics AX database record caching is a performance-enhancing feature that helps avoid database access when it's not strictly necessary. Retrieving database records from memory instead of the database significantly speeds up data access. Caching can reduce the performance penalty for repetitively accessing the same database records.

For an in-depth look at caching and its affect on performance, see Greef, Pontoppidan, et al. 2006. Inside Microsoft Dynamics AX 4.0. 427-461. Redmond: Microsoft Press.

 Types of Caching

Caching is transparent to the application; however, it's important to know how caching works to optimize its performance in Microsoft Dynamics AX. Following are the types of caching:

  • Single-record

  • Set-based

Single-record caching has the following characteristics:

  • Defined at design time

  • Moves records to the cache based on the table's CacheLookup property and the type of SELECT statement that is used to retrieve the record

For more information about record caching, see Single-Record Caching.

Set-based caching has the following characteristics:

  • Defined either at design time or in X++ code

  • Moves sets of records to the cache

  • Implemented either through the table's CacheLookup property or in code by using the RecordViewCache class

1, Single-Record Caching

Record caching is enabled for a table when all the following statements are true:

  • The CacheLookup property on the table is enabled by setting it to one of the following values:

    • notInTTS

    • Found

    • FoundAndEmpty

  • The table's PrimaryIndex property is set to a unique index that exists on the table. The RecId index does not qualify as a caching index unless you set the table's PrimaryIndex property to this index.

  • The record buffer disableCache method has not been called with a parameter of true.

The fields in the table's unique index make up the caching key. A record is placed in the cache when the following criteria are met:

  • The table is cached by setting the CacheLookup property to notInTTS, Found, or FoundAndEmpty.

  • The SELECT statement that selects the records uses an equal operator (==) on the caching key. The fields in the WHERE clause of the SELECT statement match the fields in the index referenced by the table's PrimaryIndex property.

The table's CacheLookup property defines how and when records are cached as shown in the following table.

CacheLookup Property Value

Result

None

No data is cached or retrieved from the cache for this table.

This property value should be used for tables that are heavily updated or where it's unacceptable to read outdated data.

NotInTTS

All successful caching key selects are cached.

When in a transaction (after ttsBegin), no caches made outside the transaction are used. When inside a transaction, the record is read once from database and subsequently from cache. The record is select-locked when read in a transaction, which ensures that the record cached is not updated while the transaction is active.

A typical example of the NotInTTS property is the CustTable in the Microsoft Dynamics AX standard application. It's acceptable to read outdated data from the cache outside a transaction, but when data is used for validation or creating references, it is ensured that the data is real-time.

Found

All successful caching key selects are cached. All caching key selects are returned from the cache if the record exists there. A selectforUpdate in a transaction forces reading from the database and replaces the record in the cache.

This is typically used for static (lookup) tables, such as Unit, where the record usually exists.

FoundAndEmpty

All selects on caching keys are cached, including selects that are not returning data.

All caching key selects are returned from caching if the record exists there, or the record is marked as nonexistent in the cache. A selectforUpdate in a transaction forces reading from the database and replaces the record in the cache.

An example of FoundAndEmpty record caching is in the Discount table in the Microsoft Dynamics AX standard application. By default, the Discount table has no records. By using a FoundAndEmpty cache on this table, the keys that are queried for but not found are stored in the cache. Subsequent queries for these same non-existent records can be answered from the cache without a round trip to the database.

EntireTable

Creates a set-based cache on the server. The entire table is cached as soon as at least one record is selected from the table.

The Found and FoundAndEmpty caches cross transaction boundaries. The NotInTTS cache is newly created inside a transaction. The following code example is from Greef, Pontoppidan, et al. 2006. Inside Microsoft Dynamics AX 4.0. 445. Redmond: Microsoft Press. This example, modified for the purposes of this topic, demonstrates how records are retrieved from the cache when the table's CacheLookup property is set to NotInTTS, and the PrimaryIndex property is set to a unique index on the AccountNum field.

static void NotInTTSCache(Args _args)
{
CustTable custTable;
;
// The query looks for records in the cache.
// If records don't exist, the query accesses the database.
select custTable
where custTable.AccountNum == '4000';
// The transaction starts.
ttsbegin;
// The cache is not used. The query accesses the database
// and records are placed in the cache.
select custTable
where custTable.AccountNum == '4000';
// The query uses the database because
// the forupdate keyword is used.
select forupdate custTable
where custTable.AccountNum == '4000';
// The query uses the cache and not the database.
select custTable
where custTable.AccountNum == '4000';
// The query uses the cache because
// the forupdate keyword was used previously.
select forupdate custTable
where custTable.AccountNum == '4000';
// The transaction is committed.
ttscommit;
// The query will use the cache.
select custTable
where custTable.AccountNum == '4000';
}

Reproduced by permission from Greef, Pontoppidan, et al, Inside Microsoft Dynamics AX 4.0 (Redmond, WA: Microsoft Press, 2006), 445.

If the table CacheLookup property was set to Found or FoundAndEmpty, the first select statement inside the transaction (after the TTSBegin statement) would retrieve the record from the cache.

 Cache Location

Caches are used on both the client and the server. The Microsoft Dynamics AX runtime manages the cache by removing old records when new records are added to the cache.

Client Cache

A client-side cache can be used only by the client. The client cache is used when a select is executed from the client tier. If no record is found in the client cache, the client then searches the server cache for the record. If the record isn't located in the server cache, it's retrieved from the database. The maximum number of records maintained in a client cache is 100 records per table for a given company.

Server Cache

A server-side cache can be used by any connection to the server. The server cache is used when a select is executed on the server tier. If no record is found in the cache, it's retrieved from the database. The maximum number of records maintained in a server cache is 2,000 records per table for a given company.

 

2, Set-Based Caching

In Microsoft Dynamics AX, groups of records can be cached all at once with set-based caching. Set-based caching can be implemented in two ways:

  • At design time, by setting the table's CacheLookup property to EntireTable.

  • In code, by using the RecordViewCache class.

 EntireTable Cache

When you set a table's CacheLookup property to EntireTable, all the records in the table are placed in the cache after the first select. This type of caching follows the rules of single record caching in which the SELECT statement WHERE clause fields must match those of the unique index defined in the table's PrimaryIndex property.

The EntireTable cache is located on the server and is shared by all connections to the Application Object Server (AOS). If a select is made on the client tier to a table that is EntireTable cached, it first looks in its own cache and then searches the server-side EntireTable cache. An EntireTable cache is created for each table for a given company. If you have two selects on the same table for different companies the entire table is cached twice.

Joins that include an EntireTable cached table are only performed against the cached copy when all tables participating in the join are EntireTable cached. Otherwise a database join is performed.

NoteNote

Avoid using EntireTable caches for large tables because once the cache size reaches 128 KB the cache is moved from memory to disk. A disk search is much slower than an in-memory search.

For more information about EntireTable caching, see Inside Microsoft Dynamics AX 4.0, Chapter 17.

Flushing the Cache

An EntireTable cache is flushed whenever an insert, update, or delete is made to the table. At the same time, the AOS notifies other AOSs that their caches of the same table must be flushed. After the cache is flushed, a subsequent select on the table causes the entire table to be cached again. Therefore, avoid caching any table that's frequently updated. Regardless of when updates are made, EntireTable caches are flushed every 24 hours by the AOS.

 RecordViewCache Cache

Set-based caching is implemented in code by using the RecordViewCache class. You must first create a record buffer using the nofetch statement and then pass the record buffer to the RecordViewCache class when it's instantiated.

The cache is created on the server and is only accessible by the process that creates the cache object. Once the cache is instantiated, all select statements are issued against the cache, as shown in the following code (from Inside Dynamics AX 4.0, Chapter 17, page 450).

static void RecordViewCache(Args _args)
{
CustTrans       custTrans;
RecordViewCache recordViewCache;
;
// Define records to cache.
select nofetch custTrans
where custTrans.AccountNum == '4000';
// Cache the records.
recordViewCache = new RecordViewCache(custTrans);
// Use cache.
select firstonly custTrans
where custTrans.AccountNum == '4000' &&
custTrans.CurrencyCode == 'USD';
}

Due to concurrency issues, the forUpdate keyword on the instantiating X++ SELECT statement should only be used when all of the records in the result set will be updated. Otherwise it's a better strategy to use selectforUpdate only for the records that are to be updated.

The RecordViewCache class is used in a select when the select is from a table that's cached, the select statement doesn't participate in a join and the select WHERE clause matches the WHERE clause with which the RecordViewCache was instantiated.

The cache created by the RecordViewCache class stores records in a linked list. Therefore Microsoft Dynamics AX searches the cache sequentially for records that match the search criteria. If the SELECT statement contains an ORDER BY clause, a temporary index is placed on the cache and the runtime uses the index when searching records.

The EntireTable Cache

In addition to the three caching methods described so far, a fourth caching option can be set on a table. This option is the EntireTable, which enables a set-based cache. The option causes the AOS to mirror the table in the database by selecting all records in the table and inserting them into a temporary table when any record from the table is selected for the first time. The first process to read from the table could therefore experience a longer response time because the application runtime reads all records from the database. Subsequent select queries then read from the entire-table cache instead of from the database.

A temporary table is usually local to the process that uses it, but the entire-table cache is shared among all processes that access the same AOS. Each company (as defined by the DataAreaId field) has an entire-table cache, so two processes requesting records from the same table from different companies use different caches, and both could experience a longer response time to instantiate the entire-table cache.

The entire-table cache is a server-side cache only. When requesting records from the client tier on a table that is entire-table cached, the table behaves as a Found cached table. If a request for a record is made on the client tier that qualifies for searching the record cache, the client first searches the local Found cache. If the record is not found, the client calls the AOS to search the entire-table cache. When the application runtime returns the record to the client tier, it inserts the record into the client-side Found cache.

The entire-table cache is not used when executing a select statement by which an entire-table-cached table is joined to a table that is not entire-table cached. In this situation, the entire select statement is parsed to the database. However, when select statements are made that access only the single entire-table cached table, or when joining other entire-table cached tables, the entire-table cache is used.

The Dynamics AX application runtime flushes the entire-table cache when records are inserted, updated, or deleted in the table. The next process, which selects records from the table, suffers a degradation in performance because it must re-read the entire table into cache. In addition to flushing its own cache, the AOS that executes the insert, update, or delete also informs other AOSs in the same installation that they must flush their caches on the same table. This prevents old and invalid data from being cached for too long in the entire Dynamics AX application environment. In addition to this flushing mechanism, the AOS flushes all the entire-table caches every 24 hours.

Because of the flushing that results when modifying records in a table that has been entire-table cached, you should avoid setting up entire-table caches on frequently updated tables. Rereading all records into the cache results in a performance loss, which could outweigh the performance gain achieved by caching records on the server tier and avoiding round trips to the database tier. The entire-table cache setting on a specific table can therefore be overwritten at run time when you configure the Dynamics AX application.

Even if the records in a table are fairly static, you might achieve better performance by not using the entire-table cache if the number of records in the table is large. Because the entire-table cache uses temporary tables, it changes from an in-memory structure to a file-based structure when the table uses more than 128 kilobytes (KB) of memory. This results in performance degradation during record searches. The database search engines have also evolved over time and are faster than the ones implemented in the Dynamics AX application runtime. It might be faster to let the database search for the records than to set up and use an entire-table cache, even though a database search involves round trips to the database tier.

 

For PriceDiscTable included Trade Agreement information. When you create a Sales/Purchase line, it become very slow when your pricedisctable has 30000 records because the table's cache (cache lookup) type is entiretable. It is possible to change cache type to Found.



]]>
Axapta褰撲腑鐨凴unOn灞炴?/title><link>http://www.tkk7.com/tinysun/archive/2010/02/03/311832.html</link><dc:creator>浣曞厠鍕?/dc:creator><author>浣曞厠鍕?/author><pubDate>Wed, 03 Feb 2010 10:53:00 GMT</pubDate><guid>http://www.tkk7.com/tinysun/archive/2010/02/03/311832.html</guid><wfw:comment>http://www.tkk7.com/tinysun/comments/311832.html</wfw:comment><comments>http://www.tkk7.com/tinysun/archive/2010/02/03/311832.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/tinysun/comments/commentRss/311832.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/tinysun/services/trackbacks/311832.html</trackback:ping><description><![CDATA[<p>RunOn錛岄【鍚嶆濅箟錛屽氨鏄寚Object鍦ㄩ偅涓灞備笂闈㈣繍琛岋紝瀹㈡埛绔紝榪樻槸鏈嶅姟鍣ㄧ錛熷綋鐒訛紝鍓嶆彁鏄鍦ㄤ笁灞傜粨鏋勪笅闈€侫xapta褰撲腑涓嶳unOn鏈夊叧鐨勶紝澶ф鍦ㄤ互涓嬭繖鍑犱釜鍦版柟錛?/p> <p>鐩稿叧鐨凮bject錛屽Form, Report, Class絳夛紝Class褰撲腑鐨勯潤鎬佹柟娉曪紝浠ュ強MenuItem銆?/p> <p>Form鍜孯eport鏄笉鑳借緗甊unOn灞炴х殑錛孎orm鍙兘鏄繍琛屽湪瀹㈡埛绔紝鑰孯eport鍒欐槸鐢盡enuItem鎵鍐沖畾鐨勶紝鍥犱負瀹冪殑RunOn灞炴у叾瀹炴槸琚涓?Always)Called from鐨勩傚綋鐒訛紝鍋囧Report涓嶇敤MenuItem鎸囧畾嬋媧葷殑璇濓紝濡傜洿鎺ュ湪AOT褰撲腑鐢ㄥ彸閿墦寮(Open)錛岄偅灝辮偗瀹氭槸鍦ㄥ鎴風鐢熸垚浜嗐?/p> <p>閭d箞鍓╀笅鍙互璁ㄨ鐨勫氨鏄疌lass鐨凴unOn灞炴э紝鍜孋lass褰撲腑鐨勯潤鎬佹柟娉曚簡銆?/p> <p>闈欐佹柟娉曪紝鐢卞畠鏈韓鐨刴odifier鎵鍐沖畾銆備笉鍐欑殑鎯呭喌涓嬶紝榛樿涓篶lient server錛堝彲鏄懼紡澹版槑錛屼竴鑸儏鍐典笅涓嶇敤錛夛紝涔熷氨鏄瓑浜嶤alled from錛屽湪鍝噷琚皟鐢ㄥ氨鍦ㄥ摢閲岃繍琛屻?/p> <p>Class鏈韓鐨凴unOn灞炴ф槸鍏鋒湁鏈楂樹紭鍏堢駭鐨勶紝鍙湁褰撹緗負Called from鐨勬椂鍊欙紝鎵嶄細鍙栧喅浜嶮enuItem涓殑RunOn灞炴с傝繕鏈変竴縐嶆儏鍐靛氨鏄紝寰堝Class鐨刴ain鏂規硶涔熸寚瀹氫簡modifier錛岃繖涓椂鍊檓ain鏂規硶鐨刴odifier姣擬enuItem鏇存湁浼樺厛鏉冩潵鍐沖畾Class榪愯鐨勪綅緗?/p> <p>涔熷氨鏄Class鐨凴unOn灞炴?浼樺厛浜?main鏂規硶鐨刴odifier 浼樺厛浜?MenuItem鐨凴unOn灞炴с?/p> <p>閭d箞鎴戜滑鍐嶆潵璁ㄨ榪欎釜RunOn灞炴х殑浣滅敤銆?/p> <p>鎴戜滑鐭ラ亾錛屽湪Axapta涓夊眰緇撴瀯浣撶郴褰撲腑錛屼笉鍚屽眰涔嬮棿鐨勮皟鐢紝鏃犺鏄柟娉曪紝榪樻槸鏁版嵁鐨勪氦鎹紝閮戒細閫犳垚榪愯鏁堢巼鐨勯檷浣庛傛墍浠ユ垜浠繀欏昏灝藉彲鑳藉噺灝戜笉鍚屽眰涔嬮棿鐨勮皟鐢ㄣ傝濡傝錛屾煇涓狢lass鍏蜂綋鐨勪綔鐢ㄦ槸榪涜鏁版嵁榪愮畻錛岄偅涔堣繖涓椂鍊欐垜浠妸瀹冩斁鍦–lient绔繍琛屾槸闈炲父涓嶅悎鐞嗙殑銆傚洜涓鴻繖縐嶆儏鍐典笅瀹冮渶瑕佸拰database榪涜澶ч噺鐨勬暟鎹氦鎹紙涓棿闇瑕侀氳繃AOS錛夛紝鎵浠ユ垜浠氨闇瑕佸己鍒舵х殑鎶婂畠鎸囧畾榪愯鍦ˋOS涓婏紝榪欐牱涔熷彲浠ュ噺灝戜簡緗戝唴閮ㄧ殑甯﹀娑堣楋紝鏇村彲浠ュ厖鍒嗗埄鐢ㄤ笁灞傜粨鏋勭殑浼樼偣錛岄檷浣庝簡瀹㈡埛绔満鍣ㄧ殑璐熻澆銆?/p> <p>鐒跺悗榪樻槸鏈変竴涓狟est Practice鍘熷垯錛屽氨鏄敖閲忔妸RunOn璁劇疆鍦∕enuItem錛岃屼笉瑕佹寚瀹氬湪Class鏈韓鐨勫睘鎬т笂闈紙灝介噺榛樿涓篊alled from錛夈傝繖鏍峰仛鐨勫ソ澶勫湪浜庯紝鍙互鐏墊椿榪愮敤錛屽洜涓烘煇涓涓狢lass鍙互鍦ㄤ笉鍚岀殑鎯呭喌涓嬶紝琚寚瀹氳繍琛屽湪涓嶅悓灞備笂銆傚紑鍙戜漢鍛樺彧闇瑕佹洿鏀瑰拰浣跨敤涓嶅悓鐨凪enuItem錛屽氨鍙互杈懼埌榪欑鏁堟灉銆傝繖涔熸槸Axapta閲岄潰鎵璋撶殑API鍘熷垯錛屽敖閲忛兘閫氳繃MenuItem鍘繪縺媧誨拰鎸囧畾Object鐨勮繍琛岀姸鎬併?/p> <p> </p> <p>鏈枃鏉ヨ嚜CSDN鍗氬錛岃漿杞借鏍囨槑鍑哄錛歨ttp://blog.csdn.net/junevoful/archive/2006/01/06/572496.aspx</p> <img src ="http://www.tkk7.com/tinysun/aggbug/311832.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/tinysun/" target="_blank">浣曞厠鍕?/a> 2010-02-03 18:53 <a href="http://www.tkk7.com/tinysun/archive/2010/02/03/311832.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://77sosoo.com" target="_blank">免费在线观看黄色毛片</a>| <a href="http://zhuanjiao521.com" target="_blank">亚洲一级毛片免费观看</a>| <a href="http://kmyake.com" target="_blank">宅男666在线永久免费观看</a>| <a href="http://53ggk.com" target="_blank">亚洲日韩乱码久久久久久</a>| <a href="http://yy1288.com" target="_blank">99热在线精品免费播放6</a>| <a href="http://2xpp.com" target="_blank">亚洲明星合成图综合区在线</a>| <a href="http://472849.com" target="_blank">16女性下面无遮挡免费</a>| <a href="http://hxpc28.com" target="_blank">亚洲人成高清在线播放</a>| <a href="http://yinyinai155.com" target="_blank">成人免费视频网址</a>| <a href="http://zhnetbar.com" target="_blank">亚洲a∨无码精品色午夜</a>| <a href="http://1992zyzp.com" target="_blank">免费看的成人yellow视频</a>| <a href="http://wwwee2.com" target="_blank">美女被免费视频网站a</a>| <a href="http://1992zyzp.com" target="_blank">亚洲第一黄色网址</a>| <a href="http://05942688.com" target="_blank">GOGOGO高清免费看韩国</a>| <a href="http://www454yu.com" target="_blank">国产亚洲成av片在线观看</a>| <a href="http://beijinzhongliuyiyuan.com" target="_blank">久久青草国产免费观看</a>| <a href="http://jimeng-99.com" target="_blank">亚洲免费在线视频播放</a>| <a href="http://57798b.com" target="_blank">永久免费看mv网站入口</a>| <a href="http://557265.com" target="_blank">人妻无码中文字幕免费视频蜜桃 </a>| <a href="http://dasheng178.com" target="_blank">中文无码亚洲精品字幕</a>| <a href="http://38miao.com" target="_blank">国产伦精品一区二区三区免费迷</a>| <a href="http://by22877.com" target="_blank">国产精品亚洲综合</a>| <a href="http://k5nn.com" target="_blank">伊人久久综在合线亚洲91 </a>| <a href="http://yiren2233.com" target="_blank">99re6在线视频精品免费下载</a>| <a href="http://meinvtaotu.com" target="_blank">亚洲网站在线免费观看</a>| <a href="http://yy1514.com" target="_blank">天天看片天天爽_免费播放</a>| <a href="http://by6174.com" target="_blank">一级做a爰片性色毛片免费网站</a>| <a href="http://baocaoluoli.com" target="_blank">国产专区一va亚洲v天堂</a>| <a href="http://lookvod.com" target="_blank">日韩内射激情视频在线播放免费 </a>| <a href="http://011107.com" target="_blank">成人午夜影视全部免费看</a>| <a href="http://jcmy5188.com" target="_blank">亚洲人精品午夜射精日韩 </a>| <a href="http://455zx.com" target="_blank">免费人成又黄又爽的视频在线电影</a>| <a href="http://haiwaizhuyun.com" target="_blank">亚洲人成电影网站国产精品</a>| <a href="http://4466n.com" target="_blank">免费在线看黄的网站</a>| <a href="http://sese3366.com" target="_blank">亚洲天堂2017无码中文</a>| <a href="http://tha2008.com" target="_blank">亚洲成av人片一区二区三区</a>| <a href="http://323799.com" target="_blank">99视频免费播放</a>| <a href="http://82nnn.com" target="_blank">特级毛片爽www免费版</a>| <a href="http://benjiebf.com" target="_blank">亚洲视频在线免费看</a>| <a href="http://qixiresort.com" target="_blank">免费一级特黄特色大片在线 </a>| <a href="http://zbvip888.com" target="_blank">三年片在线观看免费观看高清电影</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>