学习笔记 : WDK Application 性能调优

Documentum Application Performance and Tuning

版本比较旧,针对DM4.2,但是有一部分对5.3还是有用的

 

一 Accessing Objects Efficiently

 

1 Fetching and Querying for Objects

 

Fetching  object(getobject)是非常慢的,这种操作需要生成RDBMS Buffer,server object,dmcl object3中缓存,对于同个客户端的不同session,即使取同一个对象,都会生成独立的dmcl 缓存,并却都要重新去server取这些缓存。下面这种情况要避免Fetching  :

  • 只需要用list显示objects set(r_object_id, object_name, a_content_type等等)的时候(*)
  • 只需要显示小部分对象属性的时候
  • 对象属性只需要在局部使用,而不是贯穿整个工程的时候

使用Query接口(DfQuery)的好处在于

  • 只有被需要的对象属性会被返回给客户端
  • 低带宽占用
  • 数据不会在DMCL或server cache中缓存

当然它的缺点是collection被关闭后,想再获取这些数据,就要重新执行查询。最差的用法是下边把Fetch/Query混用(对一个对象)

DfQuery q0 = new DfQuery();
q0.setDQL("select r_object_id, object_name, a_content_type
….from where….”);
IDfCollection c0 = q0.execute( session, q0.READ_QUERY );
while ( c0.next() ) {
objId = c0.getId( "r_object_id" );
obj = (IDfSysObject ) session.getObject( objId );
objName = obj.getObjectName( );
contentType = obj.getContentType ();

 

2 Underlying eContent Server Caches: the Client DMCL cache

 

"Fetch"使用乐观锁,得到数据后就自动解锁了,所以修改通过它得到的本地的object并试图保存时,可能会得到版本不符的异常。即使使用checkout可以避免这种问题,但开发的时候需要处理“object already locked”错误。

并且,客户端默认client dmcl cache大小是100,这对性能影响非常大。如果被缓存的object超过100,dmcl就要不断的刷新并重新获取object以保证旧的object可用。

 

3 Data Dictionary Access

 

同样对Data Dictionary 的访问不要用Fetch而要用Query(dmi_dd_attr_info).5.3提供DataDictionaryUtil类来做这个工作,可以直接用。

 

4 User Name Caching

 

缓存User Name的好处不用多说,但最大问题是如何保证这个数据是最新的?解决的关键点就是dm_user对象的r_modify_date属性。

(自己设计解决方案吧。。囧,不要鄙视我)

 

5 Template-based Object Create Caching

 

创建docment对象是很费资源的,并且这个过程是同步的。所以可以预先创建一些这样的对象放在tmp目录下,这种技术叫objec-bag技术或bag-refresh,这样程序需要新的docment对象时,只需要去tmp去一个,然后做一些link或rename之类的操作。

 

6 DQL-specific query techniques

Document的对象实际上都会应设成关系数据库的表

(1) Composite Index Restrictions for types

创建索引要注意

  • 索引不能跨类,子类的字段不能创在到父类的索引里,

    所以对象的继承关系在设计阶段就要注意。

  • single和repeating字段也不能建在一个索引里

(2)Multi-type Join Restrictions

single字段(A)和repeating字段(B)是不能这样写查询的

where a = b

应该这样写

where any a = b 或 where a = xx_r.b

 

(3)Type Depth Performance

就像前便说的对象的继承关系在设计阶段就要考虑好,使索引的建立变得可能

 

(4)Full Text Searchable Attributes

下边这种模糊查询很耗资源

Select object_name from dm_document where lower(object_name) like ‘%foo%’

如果有索引服务器,应该使用

Select object_name from dm_document search topic ‘object_name <contains> *foo*’

不过还是应该尽量使用精确查询

 

二 Network Tips

 

1 Batch Hint Size

 

在dmcl.ini中可以设置

[DMAPI_CONFIGURATION]
batch_hint_size = 2 # default is 20

 

这个参数是定义在1个message中包含多少个结果以返回给客户端。如果只需要显示用list显示objects set(r_object_id, object_name, a_content_type等等)(If a list of objects needs to be displayed),这个值可以设很大。但是如果查询结果的每一行都要单独显示(each row in the query result is displayed separately),这个值就要尽量小(甚至是1)。通常这个值大一些比较好,传送信息占用的带宽少。(囧,到底该多少得自己调试了,每个项目情况不一样,要不咱们就用默认的吧)。

 

2 Cached Queries

 

对于更新频率非常低的对象,这种query会比较省资源。

用法

  • 设置dmcl.ini 中的 cache_queries = true
  • dm_docbase_config对象中的effective_date要被正确设计(咋设。。等我在查查)
  • IDfCollection c0 = q0.execute( session, q0.CACHE_QUERY );

这样结果集c0就会被缓存在客户客户端了。不用担心缓存的数据是否是时时的,q0.execute执行的时候,会自动对比i_vstamp,如果不是最新数据,旧的缓存会被清空(session.flush(q0)),并缓存新的数据。

 

3 Proxy Recorder

完全没看到/懂怎么用这个技术

 

三 Workflow and Lifecycle Tips

 

1 Asynchronous Execution of Workflow and Lifecycle Commands

 

对客户体验来说同步执行比较慢,schedulePromote比较快,但实际上执行花的时间差不多

 

2 Running Methods in a Java Application Server

 

没什么好说的,使用单独的Java Application Server比较快

 

3 Reducing Automatic Workflow Steps to Improve Latency

 

Automatic activities会引起服务器空转,所以尽量合并它们。

 

4 Multiple-Parallel Workflow Agents

 

创建多个content server 代理来并行向数据库发送请求,减少排队。步骤太狗血了,参考下吧。感觉作用不大

 

The following steps describe how to setup multiple eContent Servers on the same host with a single
docbase:
1. Login to eContent Server and create a new server config object via IAPI. For example,
assuming an existing eContent Server called “wcm” with a service name of “wcm” and is
going to add a new one on the same host with the name of “wcm1”:
API> retrieve,c,dm_server_config
{id-is-returned}
API> set,c,l,object_name
wcm1
API> saveasnew,c,l
OK
2. Create a new server.ini file for this newly created eContent Server:
• Navigate to your docbase subdirectory, for example, $DOCUMENTUM/dba/config/yourdocbase-
name
• Make a copy of server.ini. For example,
$cp server.ini server1.ini
• Edit two lines in server1.ini:
Service = wcm1
Server_config_name = wcm1
3. Edit the /etc/services file to have the new eContent server name with a different port
number. In this case the service name is wcm1.
4. Create START and SHUTDOWN eContent Server scripts. That is, dm_start_wcm1 and
dm_shutdown_wcm1. Simply make a copy of dm_start_wcm and dm_shutdown_wcm and
edit two lines in each. In START script, it is important to create a wcm1.log for this new
server (server1.ini). In SHUTDOWN script, it is a matter of identifying the correcte Content
server for the shutdown command by changing ‘iapi wcm …’ to ‘iapi wcm.wcm1 …’.

5. Boot the eContent Server using the startup script and verify that you can log into it by
specifying the name and check the log file (wcm1.log) to ensure it is up and running
properly:
$ Idql wcm.wcm1 –Uusername –Ppassword
OnWindows NT the registry service entries for the additional eContent server’s need to be “cloned”
from the original ones and modified to reflect the new server.ini and config name in the service
invocation. Cloning a registry service entry involves:
o writing out the key values (using the regedt32 RegistrySave Key menu item),
o adding a new key (using EditAdd Key), and then
o restoring the old key values on the newly defined key (RegistryRestore)
The key for the service is located at:
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/DmServerdocbasename
Where docbasename is the name of the docbase involved.

 

四 Large Concurrent User Support

 

1 eContent Server Session Pooling

池的作用不用多说,可以用以下2种方法是池生效

(1)

dmcl.ini:
[DMAPI_CONFIGURATION]
connect_pooling_enabled = T
connect_recycle_interval = 100

(2)

config.xml:

<section>
<name>Session</name>
...
<property>
<name>EnableConnectionPooling</name>
<value>true</value>
</property>
</section>

 

2 RDBMS Blocking && RDBMS Deadlocking

 

Oracle的读操作是不会堵塞和死锁的,但是其他数据库就要小心了,不要让读操作被堵塞。

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值