




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、JDO性能优化参考1.参数设置使用VOA3.2.18开发的应用,可通过设置JDO配置文件(一般是 /WEB-INF/classes/perties)来进行性能优化或调节。可在 VOA 的 workbench 中进 行设置(推荐方式),也可以直接修改配置文件。在数据库性能调节方面有以下调节选项可 供使用(等号后面是默认值):versant.maxActive=10数据库连接池大小(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连接池慢时是否等待。此选项表示如果连接池已用满,新的请求是否等待。如果不等待, 会直接扔出异常并且返回。象评论系统这种影响不大的应用,
5、数据库连接满时扔异常提前返 回就比较合适,可以减缓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的批处理功能可将一组相关语句集中起来一起提 交到数据库,提高性能,减少网络传输量。但执行出错时(比如主、外键冲突之类)返回的
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继承关系多类同表方式的类识别字段内容。JDO支持数据类之间有继承关系,并且同一继承树的所有类可放入同一个表(平板模式),此时,表中需
10、要一个字段来记录每条记录 属于哪个数据类。默认是一个整数字段,用类的hash值来识别每个类。不过在DBA查数据时就比较痛苦,因为这个hash值太不直观了。建议设为类名name。另外,如果应用中有 多个包下有同名的数据类名并且之间有继承关系,则设为完整类名更好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,在初始化时 检查表结构,不过启动速度会比较慢。对一些启动速度要求较高的应用,可以不检查(默认)。 比如有些表很偶然才会用到,此时其它功能可正常执行,只有访问到这些表时才会出数据库 错误。有时应用升级时也会出现少少数据结构差异,此时应不检查。 |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是否使用内存(乐观)事务锁。JDO默认会在内存中进行事务操作,然后在提交事务 的瞬间再锁定数据库并完成更新。这样在应用事务操作期间不会锁定数据库,以提供更好的 性能。这也是JDO的精华。如果应用修改数据特别多,引起太多的并发冲突,可将此设置 设为false,每项事务都采用数据库锁,这样可能性能会下降,但可大大提高每个事务成功 的几率。丫 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是否允许事务外的数据对象访问。这条配置更多的是与应用开发相关。默认是不允许的, 对数据对象的访问(如getXxx()必须在事务中进行。不过多数情况下我们需要将其设为true,以便不开启事务便访问数据对象。曰 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数据对象修改后是否在内存中保留。如果一个数据对象修改了,默认会提交数据库并清 除该对象的缓冲,下次再读就从数据库重新读出来。建议将这个改为true,可以在修改后不 从缓冲中清除,可减少一条数据库查询。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数据对象的缓冲池大小,加大可提高应用性能
26、,不过需要占用更 多JVM内存(堆空间)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查询对象数这个一般用默认值就可以了,因为查询
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服务器内存中记录的最大事件数,用console连上去时可看到之前的这么多条日志versant.logDownloader.maxFileSizeK=1000配置JDO单个日志文件
30、的字节数,与滚动文件数结合起来使用。如果这个设大了,那 每次滚动的时候丢失的最旧的日志就多,如果设小了,那几个滚动文件记录的总日志量就比 较少。电脑论坛设的是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秒之内的所有性能数据的平均值-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会记录每条语句的执行时间,如果改为all,可 以进一步记录每条SQL语句执行时的相关参数的值。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是否打开远程监控端口,打开后可用VOA的workbench中的Console来远程连接此应 用,从而实时观察服务器运行状况。右边还有一个选项是versant.rmiRegistryPort=2388,是 设定监听的端口号
38、,如果同一机器有多个JDO引擎需要远程监控,就需要设此端口,将不 同的应用分开。需要注意的是,服务器与监控机的VOA版本一定要保持完全一样,比如都 是3.2.18。如果是下载日志文件本地打开就允许版本稍有差异。协 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.性能监控说明这里顺便简单介绍一下远程监控的作用。在VOA的workbench中,左边工作区第六项就是监控界面。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.实时监控与离线监控监控分实时和离线两种。实时就是连接上远程应用的JDO引擎的监听端口,实时地观 察和统计运行状况。离线方式是将服务器上的日志文件拉下来,在监控界面中打开文件来观 察。JDO的日志分两类,一类是性能日志,在服务器上可以看到日志文件的格式是 jdo_xxx_jdoperf.*,用于记录服务器的性能数据,如每秒事务数、缓冲命中率等等;另一类 是SQL日志,日志文件格式是jdo_xxx_jdolog.*,用于记录每条数据库操作语句的执行情况, 包括语句、参数(视配置而定)、执行时间等等。离线监控时,对性能日志,是在监控界面的“ 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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 居民生活污水收集管网建设工程施工方案
- 3C零部件生产项目建筑工程方案
- 市政管道工程技术交底方案
- 片区污水处理厂项目建设工程方案
- 新能源汽车零部件生产项目技术方案
- 化工园区污水处理厂工程建设工程方案
- 桥梁结构优化设计方案
- 绿色建筑与可持续发展方案
- 初中物理竞赛功和功率试题及答案
- 事业单位职测数量关系模拟试题及答案
- 人教版七年级上学期期中考试数学试卷及答案(共7套)
- 湘艺版九年级上册第四单元《世界民族之声(二)》音乐单元作业设计
- 医院培训课件:《S/D 比值临床价值》
- 器械性压疮的护理
- 《湖南民居特色》课件
- 中国老年患者术后谵妄防治专家共识
- 兄妹断绝协议书范文
- 2025年度火锅店合伙人合作协议书:特色火锅底料配方保密协议
- 岗位化验员述职报告
- 2023年价格鉴证师考试《价格鉴证案例分析》试题真题及答案二
- 工艺管道及阀门安装工程施工方案
评论
0/150
提交评论