JDO性能優(yōu)化參考_第1頁
JDO性能優(yōu)化參考_第2頁
JDO性能優(yōu)化參考_第3頁
JDO性能優(yōu)化參考_第4頁
JDO性能優(yōu)化參考_第5頁
已閱讀5頁,還剩11頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、JDO性能優(yōu)化參考1.參數(shù)設置使用VOA3.2.18開發(fā)的應用,可通過設置JDO配置文件(一般是 /WEB-INF/classes/perties)來進行性能優(yōu)化或調(diào)節(jié)??稍?VOA 的 workbench 中進 行設置(推薦方式),也可以直接修改配置文件。在數(shù)據(jù)庫性能調(diào)節(jié)方面有以下調(diào)節(jié)選項可 供使用(等號后面是默認值):versant.maxActive=10數(shù)據(jù)庫連接池大?。↗DO自己管理連接池的方式)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連接池慢時是否等待。此選項表示如果連接池已用滿,新的請求是否等待。如果不等待, 會直接扔出異常并且返回。象評論系統(tǒng)這種影響不大的應用,

5、數(shù)據(jù)庫連接滿時扔異常提前返 回就比較合適,可以減緩HTTP請求堵塞的情況。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的批處理功能可將一組相關語句集中起來一起提 交到數(shù)據(jù)庫,提高性能,減少網(wǎng)絡傳輸量。但執(zhí)行出錯時(比如主、外鍵沖突之類)返回的

8、錯誤信息很少,查問題困難,而且有時候在大壓力下事務失敗的幾率會增高。所以建議取消 (非默認)。|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繼承關系多類同表方式的類識別字段內(nèi)容。JDO支持數(shù)據(jù)類之間有繼承關系,并且同一繼承樹的所有類可放入同一個表(平板模式),此時,表中需

10、要一個字段來記錄每條記錄 屬于哪個數(shù)據(jù)類。默認是一個整數(shù)字段,用類的hash值來識別每個類。不過在DBA查數(shù)據(jù)時就比較痛苦,因為這個hash值太不直觀了。建議設為類名name。另外,如果應用中有 多個包下有同名的數(shù)據(jù)類名并且之間有繼承關系,則設為完整類名更好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引擎初始化時是否檢查表結構完整性。比較重要的應用可以設為true,在初始化時 檢查表結構,不過啟動速度會比較慢。對一些啟動速度要求較高的應用,可以不檢查(默認)。 比如有些表很偶然才會用到,此時其它功能可正常執(zhí)行,只有訪問到這些表時才會出數(shù)據(jù)庫 錯誤。有時應用升級時也會出現(xiàn)少少數(shù)據(jù)結構差異,此時應不檢查。 |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)存(樂觀)事務鎖。JDO默認會在內(nèi)存中進行事務操作,然后在提交事務 的瞬間再鎖定數(shù)據(jù)庫并完成更新。這樣在應用事務操作期間不會鎖定數(shù)據(jù)庫,以提供更好的 性能。這也是JDO的精華。如果應用修改數(shù)據(jù)特別多,引起太多的并發(fā)沖突,可將此設置 設為false,每項事務都采用數(shù)據(jù)庫鎖,這樣可能性能會下降,但可大大提高每個事務成功 的幾率。丫 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是否允許事務外的數(shù)據(jù)對象訪問。這條配置更多的是與應用開發(fā)相關。默認是不允許的, 對數(shù)據(jù)對象的訪問(如getXxx()必須在事務中進行。不過多數(shù)情況下我們需要將其設為true,以便不開啟事務便訪問數(shù)據(jù)對象。曰 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ù)對象修改后是否在內(nèi)存中保留。如果一個數(shù)據(jù)對象修改了,默認會提交數(shù)據(jù)庫并清 除該對象的緩沖,下次再讀就從數(shù)據(jù)庫重新讀出來。建議將這個改為true,可以在修改后不 從緩沖中清除,可減少一條數(shù)據(jù)庫查詢。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對象緩沖大小。JDO數(shù)據(jù)對象的緩沖池大小,加大可提高應用性能

26、,不過需要占用更 多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查詢對象數(shù)這個一般用默認值就可以了,因為查詢

28、緩沖只有相關類的對象有任何修改都會馬上清掉的, 設大了也沒什么用。不過對于基本只讀的應用來說,設大些效果會比較好。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服務器內(nèi)存中記錄的最大事件數(shù),用console連上去時可看到之前的這么多條日志versant.logDownloader.maxFileSizeK=1000配置JDO單個日志文件

30、的字節(jié)數(shù),與滾動文件數(shù)結合起來使用。如果這個設大了,那 每次滾動的時候丟失的最舊的日志就多,如果設小了,那幾個滾動文件記錄的總?cè)罩玖烤捅?較少。電腦論壇設的是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保留多少個滾動日志。一般用默認的3個即可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每條性能日志間隔時間(毫秒)。對我們的線上應用,1秒短了點,造成日志很多。改 為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日志的記錄級別。默認的normal會記錄每條語句的執(zhí)行時間,如果改為all,可 以進一步記錄每條SQL語句執(zhí)行時的相關參數(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是否打開遠程監(jiān)控端口,打開后可用VOA的workbench中的Console來遠程連接此應 用,從而實時觀察服務器運行狀況。右邊還有一個選項是versant.rmiRegistryPort=2388,是 設定監(jiān)聽的端口號

38、,如果同一機器有多個JDO引擎需要遠程監(jiān)控,就需要設此端口,將不 同的應用分開。需要注意的是,服務器與監(jiān)控機的VOA版本一定要保持完全一樣,比如都 是3.2.18。如果是下載日志文件本地打開就允許版本稍有差異。協(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)控說明這里順便簡單介紹一下遠程監(jiān)控的作用。在VOA的workbench中,左邊工作區(qū)第六項就是監(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.實時監(jiān)控與離線監(jiān)控監(jiān)控分實時和離線兩種。實時就是連接上遠程應用的JDO引擎的監(jiān)聽端口,實時地觀 察和統(tǒng)計運行狀況。離線方式是將服務器上的日志文件拉下來,在監(jiān)控界面中打開文件來觀 察。JDO的日志分兩類,一類是性能日志,在服務器上可以看到日志文件的格式是 jdo_xxx_jdoperf.*,用于記錄服務器的性能數(shù)據(jù),如每秒事務數(shù)、緩沖命中率等等;另一類 是SQL日志,日志文件格式是jdo_xxx_jdolog.*,用于記錄每條數(shù)據(jù)庫操作語句的執(zhí)行情況, 包括語句、參數(shù)(視配置而定)、執(zhí)行時間等等。離線監(jiān)控時,對性能日志,是在監(jiān)控界面的“ Performance”頁(第一頁)中,在任一 表格的空白處點右鍵,Choose Metrics.Type峰 Most Recent SampleD Properties.Export CSV.Edit Layout口 Add View Delete View.FileQ Open.Layo

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論