




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、JDO性能優(yōu)化參考1.參數(shù)設(shè)置使用VOA3.2.18開(kāi)發(fā)的應(yīng)用,可通過(guò)設(shè)置JDO配置文件(一般是 /WEB-INF/classes/perties)來(lái)進(jìn)行性能優(yōu)化或調(diào)節(jié)??稍?VOA 的 workbench 中進(jìn) 行設(shè)置(推薦方式),也可以直接修改配置文件。在數(shù)據(jù)庫(kù)性能調(diào)節(jié)方面有以下調(diào)節(jié)選項(xiàng)可 供使用(等號(hào)后面是默認(rèn)值):versant.maxActive=10數(shù)據(jù)庫(kù)連接池大小(JDO自己管理連接池的方式)properties:J ProjectAntClasspath1丫 Project Properties1010true-After Ant filter t.patastore - Po
2、ol Setti. SearchPool max activeElci* wh 日 n fullThe maximum number of connections to create forthe connection pool. If you set this to 10 then Versant Open Access will not open more than 10 connections to the database. You need to use the event log to monitor your production system to decide how man
3、y connections you need. This depends on the transaction mode (optimistic or data store), the length ofyourtransactions and the number of users. shitt-Fi for moreI PM Pooling|_j RMI Socket Factories qj Data storePool SettingsGeneral Settings Java Type Mapping JDBC Type Mapping SCO Factories Name Gene
4、rationSchema Migration PS cache size limitWait for con on startupConnection init SQLConnection validation SQLTest con on allocTest con on releaseTest con on exceptionTest con when idlefalsefalsefalsetruetrueversant.blockWhenFull=true連接池慢時(shí)是否等待。此選項(xiàng)表示如果連接池已用滿,新的請(qǐng)求是否等待。如果不等待, 會(huì)直接扔出異常并且返回。象評(píng)論系統(tǒng)這種影響不大的應(yīng)用,
5、數(shù)據(jù)庫(kù)連接滿時(shí)扔異常提前返 回就比較合適,可以減緩HTTP請(qǐng)求堵塞的情況。Project Propertiespropertiesatastore - Pool Setti. SearchJ Projectl-Q AntI ClasspathI Properties filej JDO Meta Data Files-After Ant filter t.Pool max activeBlock when fullPool max idle1010true1010Threads attempting to obtain a connection will wait until one is a
6、vailable if this property is true (the default). Otherwise a VersantConnectionPoolFullException is thrown. A idbc.pool.full event is logged in either case, shitt-n tor morej user ueimea MeincsI PM PoolingI RMI Socket FactoriesPS cache size limitWait for con on startupfalseRMI Socket FactoriesData st
7、oreI Pool Settings口 General SettingsI Java Type MappingJDBC OptionsJDBC Type MappingFactoriesGeneration一 Li scoI NameTransaction Isolation levelDisable JDBC 2.0 batchingREAD COMMITTEDtrueversant.jdbcNobatching=false取消JDBC2.0批處理功能。JDBC2.0的批處理功能可將一組相關(guān)語(yǔ)句集中起來(lái)一起提 交到數(shù)據(jù)庫(kù),提高性能,減少網(wǎng)絡(luò)傳輸量。但執(zhí)行出錯(cuò)時(shí)(比如主、外鍵沖突之類)返回的
8、錯(cuò)誤信息很少,查問(wèn)題困難,而且有時(shí)候在大壓力下事務(wù)失敗的幾率會(huì)增高。所以建議取消 (非默認(rèn))。|LqSchema MigrationDisable JDBC 2.0 statement batching. Versant Open Access will use batch inserts and updates whenever possible as this feature makes it possible to insert or update multiple rows with a single database call. However JDBC drivers often
9、give veiy poor error messages when a batch fails (e.g. batch update failed instead of unique constraint violated). You might want to disable batching for a while to track down a problem. shitt-Fi for moreversant.ext.jdbc-class-id=hash繼承關(guān)系多類同表方式的類識(shí)別字段內(nèi)容。JDO支持?jǐn)?shù)據(jù)類之間有繼承關(guān)系,并且同一繼承樹(shù)的所有類可放入同一個(gè)表(平板模式),此時(shí),表中需
10、要一個(gè)字段來(lái)記錄每條記錄 屬于哪個(gè)數(shù)據(jù)類。默認(rèn)是一個(gè)整數(shù)字段,用類的hash值來(lái)識(shí)別每個(gè)類。不過(guò)在DBA查數(shù)據(jù)時(shí)就比較痛苦,因?yàn)檫@個(gè)hash值太不直觀了。建議設(shè)為類名name。另外,如果應(yīng)用中有 多個(gè)包下有同名的數(shù)據(jù)類名并且之間有繼承關(guān)系,則設(shè)為完整類名更好fullnameI II-. MI L J J. User Defined MetricsPM PoolingDiscriminator columnRM_ _ _(nameValues used for the discriminator column (jdo class) or(noto not use a discriminator
11、Pool Settings General Settings Java Type Mapping JDBC Type Mapping SCO Factories Name Generation Schema MigrationManaged many-to-manytrueTransaction Isolation levelDisable JDBC 2.0 batchingDisable PreparedStatement cacheValidate mapping on startupREAD_COMMITTEDtruefalsefalseJDBC Optionsversant.valid
12、ateMappingOnStartup=falseJDO引擎初始化時(shí)是否檢查表結(jié)構(gòu)完整性。比較重要的應(yīng)用可以設(shè)為true,在初始化時(shí) 檢查表結(jié)構(gòu),不過(guò)啟動(dòng)速度會(huì)比較慢。對(duì)一些啟動(dòng)速度要求較高的應(yīng)用,可以不檢查(默認(rèn))。 比如有些表很偶然才會(huì)用到,此時(shí)其它功能可正常執(zhí)行,只有訪問(wèn)到這些表時(shí)才會(huì)出數(shù)據(jù)庫(kù) 錯(cuò)誤。有時(shí)應(yīng)用升級(jí)時(shí)也會(huì)出現(xiàn)少少數(shù)據(jù)結(jié)構(gòu)差異,此時(shí)應(yīng)不檢查。 |I RMI Socket Factories J Data storeI Pool Settings|_j General SettingsI Java Type MappingI JDBC Type MappingI SCO Fac
13、toriesI Name GenerationI Schema MigrationManaged one-to-many trueManaged many-to-many trueJDBC OptionsTransaction Isolation levelDisable JDBC 2.0 batchingDisable PreparedStatement cacheValidate mapping on startupREAD_COMMITTEDtruefalsefalseCheckthe mapping against the database schema when the server
14、 starts. If the mapping is invalid then the server will fail with an exception indicating what is wrong (e.g. missing tables and columns). If the mapping is not validated then the application will fail when the invalid class or classes are accessed. shitt-Fi tor more1.6. javax.jdo.option.Optimistic=
15、true是否使用內(nèi)存(樂(lè)觀)事務(wù)鎖。JDO默認(rèn)會(huì)在內(nèi)存中進(jìn)行事務(wù)操作,然后在提交事務(wù) 的瞬間再鎖定數(shù)據(jù)庫(kù)并完成更新。這樣在應(yīng)用事務(wù)操作期間不會(huì)鎖定數(shù)據(jù)庫(kù),以提供更好的 性能。這也是JDO的精華。如果應(yīng)用修改數(shù)據(jù)特別多,引起太多的并發(fā)沖突,可將此設(shè)置 設(shè)為false,每項(xiàng)事務(wù)都采用數(shù)據(jù)庫(kù)鎖,這樣可能性能會(huì)下降,但可大大提高每個(gè)事務(wù)成功 的幾率。丫 Project PropertiesPropertiesSearchU ProjectAntI ClasspathI Properties file_l JDO Meta Data FilesI Externalized TypesI Level 2
16、CacheI Event LoggingI User Defined Metrics-Qj PM PoolingQj RMI Socket Factories_.J Data storeMiscellaneousProject filenameDescriptionHyperdrive classesPrecompile named queriesD:sbgameclubwarWEB-INFclassesWpertieRemote AccessJDO server name versantRemote access UsernameRMI registry portServer port230
17、8autoPool Settings General Settings Java Type Mapping JDBC Type Mapping SCO Factories Name GenerationSchema MigrationRemote PMs PasswordPersistenceManagerFactory ConfigurationUse optimistic transactions Ignore local PM cache for queriesSet the default transaction mode for PMs. With optimistic (true)
18、 transactions database locks are not held during a transaction. Versant Open Access supports several methods of detecting concurrent updates when the transaction commits. With pessimistic or data store transactions (false) a JDBC connection is associated with the PM forthe duration of the transactio
19、n and database locks are accumulated.javax.jdo.option.NontransactionalRead=false是否允許事務(wù)外的數(shù)據(jù)對(duì)象訪問(wèn)。這條配置更多的是與應(yīng)用開(kāi)發(fā)相關(guān)。默認(rèn)是不允許的, 對(duì)數(shù)據(jù)對(duì)象的訪問(wèn)(如getXxx()必須在事務(wù)中進(jìn)行。不過(guò)多數(shù)情況下我們需要將其設(shè)為true,以便不開(kāi)啟事務(wù)便訪問(wèn)數(shù)據(jù)對(duì)象。曰 ProjectAntClasspathProperties file JDO Meta Data Files Externalized Types Level 2 Cache Event LoggingUser Defined Me
20、tricsPM PoolingRMI Socket FactoriesMiscellaneous1/Precompile named queriesU Data storeI Pool SettingsI General SettingsI Java Type MappingI JDBC Type MappingI SCO FactoriesI Name Generation I Schema MigrationJDO server nameversa ntRMI registry portRemote accessRemote PMsUsernamePasswordServer portRe
21、mote Access2338autoPersistenceManagerFactory ConfigurationUse optimistic transactions 1/ Ignore local PM cache for queriesRetain values after commit 1/ Allow non-transactional read 1/Set the default nontransactional read setting for PMs. If nontransactional read is true then references may be naviga
22、ted and queries executed outside of a JDO transaction, shift-n for more1 Q LGI -DLU I C I A IU U n.l I I Hr -.! 1 4_1 11 Ijavax.jdo.optlon.RetalnValues=false數(shù)據(jù)對(duì)象修改后是否在內(nèi)存中保留。如果一個(gè)數(shù)據(jù)對(duì)象修改了,默認(rèn)會(huì)提交數(shù)據(jù)庫(kù)并清 除該對(duì)象的緩沖,下次再讀就從數(shù)據(jù)庫(kù)重新讀出來(lái)。建議將這個(gè)改為true,可以在修改后不 從緩沖中清除,可減少一條數(shù)據(jù)庫(kù)查詢。Properties以 ProjectMiscellaneousSearch_l An
23、tI Classpath Properties file JDO Meta Data Files Externalized Types Level 2 Cache Event LoggingUser Defined MetricsPM PoolingRMI Socket FactoriesProject filename- - - - - - -aHyperdrive classesPrecompile named queriesD:sbgameclubwarWEB-INFclassesWpertieDescriptionData storeI Pool SettingsI General S
24、ettingsI Java Type MappingI JDBC Type MappingI SCO FactoriesI Name Generation|_J Schema MigrationRemote Accessregistry port 2383Server port autoPersistenceManagerFactory ConfigurationUse optimistic transactions 1/ Ignore local PM cache for queriesRetain values after commitAllow non-transactional rea
25、d 1/Set the default retain values setting for PMs. If retain values is true then the PM will not evict instances from its local cache when the transaction commits. This is useful when combined with optimistic transactions, shift-n for moreversant.l2CacheMaxObjects=10000對(duì)象緩沖大小。JDO數(shù)據(jù)對(duì)象的緩沖池大小,加大可提高應(yīng)用性能
26、,不過(guò)需要占用更 多JVM內(nèi)存(堆空間)2S1propertiesproject - Level 2 CacheSearchpr J _ _AntClasspathProperties fileJDO Meta Data File Externalized TypesLevel 2 CacheEvent LoggingUser Defined MetricsPM PoolingRMI Socket Factories 曰 Data storeI Pool SettingsUse level 2 cacheMax objects 10000After Ant filtering1 0000Set
27、 the maximum number of objects stored in the server wide cache. The least recently used objects are evicted when the cache is full, shift-n tor moreClustertransportPcMulticastClusterTransport mon.multicast.voa|LI Project Propertiesversant.l2QueryCacheMaxQueries=1000配置JDO最大CACHE查詢對(duì)象數(shù)這個(gè)一般用默認(rèn)值就可以了,因?yàn)椴樵?/p>
28、緩沖只有相關(guān)類的對(duì)象有任何修改都會(huì)馬上清掉的, 設(shè)大了也沒(méi)什么用。不過(guò)對(duì)于基本只讀的應(yīng)用來(lái)說(shuō),設(shè)大些效果會(huì)比較好。IK Project Propertiespropertiesproject - Level 2 CacheSearch口 Project-Ant_j Classpath_j Properties file_j JDO Meta Data Files_j Externalized TypesUse level 2 cacheMax objects100000After Ant filtering100000Cache query resultsVMax queries to cac
29、heClustertransport1000After Ant filtering1000| Level 2 CachePcMulticastClusterTransport mon.multica:_j Event Logging_j User Defined Metrics.i PM PoolinqPropertyValueAfter Ant filtiversant.logging.maxEvents=10000服務(wù)器內(nèi)存中記錄的最大事件數(shù),用console連上去時(shí)可看到之前的這么多條日志versant.logDownloader.maxFileSizeK=1000配置JDO單個(gè)日志文件
30、的字節(jié)數(shù),與滾動(dòng)文件數(shù)結(jié)合起來(lái)使用。如果這個(gè)設(shè)大了,那 每次滾動(dòng)的時(shí)候丟失的最舊的日志就多,如果設(shè)小了,那幾個(gè)滾動(dòng)文件記錄的總?cè)罩玖烤捅?較少。電腦論壇設(shè)的是10000,即10MI bziernanzea iypesI Level 2 Cache|_j Event LoggingI User Defined Metrics|_J PM PoolingI |_J RMI Socket Factories U Data storeI Pool SettingsI General SettingsI Java Type MappingI JDBC Type MappingI SCO Factorie
31、sI Name GenerationI |_J Schema MigrationMetric snapshot interval 5000Metric store capacity 86400PropertyValueAfter Ant filteringAppendfalseNumber of backups3Date formatHH:mm:ss.SSSWrite event binary filetrueEvent poll seconds1Write event textfilefalseFilenameMax file size in K1000010000Write metric
32、binary file+n i oMaximum size for a file before rollover to backupMetric poll secondsIJ uEvent and metrics downloader LogDownloader com.versant.core.jdo1.13. versant.logDownloader.backups=3保留多少個(gè)滾動(dòng)日志。一般用默認(rèn)的3個(gè)即可Externalized Types Level 2 Cache Event Logging User Defined Metrics PM PoolingRMI Socket Fa
33、ctoriesU Data storeI Pool SettingsI General SettingsI Java Type MappingI JDBC Type MappingI SCO FactoriesI Name GenerationI Schema MigrationMetric snapshot interval 5000Metric store capacity86400PropertyValueAfter Ant filteringAppendfalseNumber of backups3Date formatNumber of old log files to ke(sp
34、(filename.jdolog.1, fiename.jdolog.2,.)Write event binary filetrueEvent poll seconds1Write event textfilefalseFilnriAmHEvent and metrics downloader LogDownloader com.versant.core.jdo1.14. versant.metricSnapshotIntervalMs=1000每條性能日志間隔時(shí)間(毫秒)。對(duì)我們的線上應(yīng)用,1秒短了點(diǎn),造成日志很多。改 為5秒就比較合適。5秒是指每條日志記錄5秒之內(nèi)的所有性能數(shù)據(jù)的平均值-E
35、xternalized TypesLevel 2 CacheEvent LoggingUser Defined MetricsPM PoolingRMI Socket Factories_J Datastore_i Pool Settings-Q General Settings-_| Java Type MappingMetric snapshot interval 5000Event and metrics downertyMetric store capacity86400Interval between performance metric snapshots in milliseco
36、ndsValuef-alCQAfter Ant filtering1.15. versant.logging.logEvents=normalSQL日志的記錄級(jí)別。默認(rèn)的normal會(huì)記錄每條語(yǔ)句的執(zhí)行時(shí)間,如果改為all,可 以進(jìn)一步記錄每條SQL語(yǔ)句執(zhí)行時(shí)的相關(guān)參數(shù)的值。Project PropertiespropertiesprAntClasspathProperties fileJDO Meta Data Files Externalized Types Level 2 Cache Event LoggingUser Defined Metrics PM PoolingProperty
37、ValueAfter Ant filteringEvents to lognormalWrite events to System.outfalsefalseMax events10LCoarse grained control of event loggingproject -Event LoggingSearch1.16. versant.remoteAccess=true是否打開(kāi)遠(yuǎn)程監(jiān)控端口,打開(kāi)后可用VOA的workbench中的Console來(lái)遠(yuǎn)程連接此應(yīng) 用,從而實(shí)時(shí)觀察服務(wù)器運(yùn)行狀況。右邊還有一個(gè)選項(xiàng)是versant.rmiRegistryPort=2388,是 設(shè)定監(jiān)聽(tīng)的端口號(hào)
38、,如果同一機(jī)器有多個(gè)JDO引擎需要遠(yuǎn)程監(jiān)控,就需要設(shè)此端口,將不 同的應(yīng)用分開(kāi)。需要注意的是,服務(wù)器與監(jiān)控機(jī)的VOA版本一定要保持完全一樣,比如都 是3.2.18。如果是下載日志文件本地打開(kāi)就允許版本稍有差異。協(xié) Project PropertiesPropertiesSearchMiscellaneousAntClasspathProperties fileProject filenameDescriptionD:sbgameclubwarWVEB-INFclassesWpertieJDO Meta Data Files Externalized Types Level 2 Cache Ev
39、ent LoggingUser Defined MetricsHyperdrive classesPrecompile named queriesRemote AccessPM PoolingRMI Socket Factories:;口 Data store3- |_j Pool Settingsj _l General Settings、|_j Java Type MappingI JDBC Type MappincJDO server nameRemote accessversantRMI registry port 2388UsernameServer port autoTickthi
40、s box to enable remote connections to the Versant Open Access server. If this is false then the server will not lookup or create a RMI registry and no remote access will be possible. Shift-F1 for more2.性能監(jiān)控說(shuō)明這里順便簡(jiǎn)單介紹一下遠(yuǎn)程監(jiān)控的作用。在VOA的workbench中,左邊工作區(qū)第六項(xiàng)就是監(jiān)控界面。Open Access Workbench - Dzsbg.ameclubwarWEB
41、i-INFch!5!se5versanit-propertie5 *|n| x|File Edit Build Run Window HelpX DisconnectConfigurationEvent LogPersistence ManagersRemote ClientsCluster凸 ConnectNot connected% RefresPerformanceMainoa:oi :ioOS:O1 :4OOS:QT :40Monitor running Open Access servers0.75曰日:曰口 :5 口Consri I pDiagramsGridS.c h e m a
42、U Project口.gGenerate03:00:1003:00:20 03:00:30 05:00:40 OS:QO:5O03:01 :GO03:01:1003:0103:0-1 :3003:01 :4003:01 :5O|O| 10M of11M21.實(shí)時(shí)監(jiān)控與離線監(jiān)控監(jiān)控分實(shí)時(shí)和離線兩種。實(shí)時(shí)就是連接上遠(yuǎn)程應(yīng)用的JDO引擎的監(jiān)聽(tīng)端口,實(shí)時(shí)地觀 察和統(tǒng)計(jì)運(yùn)行狀況。離線方式是將服務(wù)器上的日志文件拉下來(lái),在監(jiān)控界面中打開(kāi)文件來(lái)觀 察。JDO的日志分兩類,一類是性能日志,在服務(wù)器上可以看到日志文件的格式是 jdo_xxx_jdoperf.*,用于記錄服務(wù)器的性能數(shù)據(jù),如每秒事務(wù)數(shù)、緩沖命中率等等;另一類 是SQL日志,日志文件格式是jdo_xxx_jdolog.*,用于記錄每條數(shù)據(jù)庫(kù)操作語(yǔ)句的執(zhí)行情況, 包括語(yǔ)句、參數(shù)(視配置而定)、執(zhí)行時(shí)間等等。離線監(jiān)控時(shí),對(duì)性能日志,是在監(jiān)控界面的“ Performance”頁(yè)(第一頁(yè))中,在任一 表格的空白處點(diǎn)右鍵,Choose Metrics.Type峰 Most Recent SampleD Properties.Export CSV.Edit Layout口 Add View Delete View.FileQ Open.Layo
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- T-ZSM 0052-2024“領(lǐng)跑者”評(píng)價(jià)技術(shù)要求 普通型立式帶鋸床
- T-ZSA 227-2024 低慢小無(wú)人駕駛航空器車載式預(yù)警處置系統(tǒng)
- 2025年度村級(jí)林業(yè)資源監(jiān)測(cè)村級(jí)護(hù)林員職責(zé)合同
- 2025年度美甲服務(wù)連鎖品牌合作協(xié)議
- 二零二五年度汽車維修保養(yǎng)抵押借款合同
- 2025年度美發(fā)店員工勞動(dòng)合同及員工福利政策
- 二零二五年度個(gè)人心理咨詢服務(wù)合同
- 2025年度消防車輛抵押借款合同范本
- 二零二五年度直播平臺(tái)用戶行為數(shù)據(jù)分析合同
- 2025年度石材石材加工定制采購(gòu)協(xié)議
- 2024年湖南省岳陽(yáng)市中考數(shù)學(xué)一模試卷
- DZ∕T 0080-2010 煤炭地球物理測(cè)井規(guī)范(正式版)
- 2024年國(guó)家公務(wù)員考試時(shí)事政治必考試題庫(kù)(完整版)
- 否定副詞“不”和“沒(méi)有”比較研究
- 售樓部銷售禮儀培訓(xùn)內(nèi)容
- (高清版)DZT 0347-2020 礦山閉坑地質(zhì)報(bào)告編寫(xiě)規(guī)范
- 2024年不停電電源UPS相關(guān)項(xiàng)目營(yíng)銷計(jì)劃書(shū)
- 重汽重卡培訓(xùn)課件
- 干式變壓器培訓(xùn)課件
- 公司SWOT分析表模板
- 2023年上海中考語(yǔ)文試卷(附答案)
評(píng)論
0/150
提交評(píng)論