CRM one order性能调优指南
要对基于one order framework进行性能调优,需要对one order framework的事件处理有一个最基本的了解。
我通过截图列出了一些关键点,你看看根据这些信息能不能自己找到问题的答案:
通过UI创建一个transaction type为TA的sales order为例:
![](https://user-images.githubusercontent.com/5669954/57193190-43baa500-6f6b-11e9-887d-3e55e832c9f8.png)
transaction type TA对应的transaction category如下:
![](https://user-images.githubusercontent.com/5669954/57193191-43baa500-6f6b-11e9-8244-51c937bf464a.png)
Order修改的所有操作都是通过FM CRM_ORDER_MAINTAIN 统一trigger:
![](https://user-images.githubusercontent.com/5669954/57193192-44533b80-6f6b-11e9-8508-e222e3c64530.png)
最终会调用CRM_ORDER_H_MAINTAIN_OW 或者 CRM_ORDER_I_MAINTAIN_OW处理Header或者Item:
![](https://user-images.githubusercontent.com/5669954/57193194-44ebd200-6f6b-11e9-82e8-584018e89b6a.png)
![](https://user-images.githubusercontent.com/5669954/57193195-44ebd200-6f6b-11e9-8d4d-de568ed4d782.png)
里面的FM CRM_ORDERADM_H_PUBLISH_OW统一raise Order header level的各种事件,从而调用事件上注册的callback。
![](https://user-images.githubusercontent.com/5669954/57193196-45846880-6f6b-11e9-8f5f-1c18991622da.png)
在该function module内搜索关键字 CRM_EVENT_PUBLISH_OW,能找出该FM 负责raise的所有支持的event:
![](https://user-images.githubusercontent.com/5669954/57193197-461cff00-6f6b-11e9-82ba-1fdd2ca13d5b.png)
![](https://user-images.githubusercontent.com/5669954/57193198-461cff00-6f6b-11e9-945b-53dd075396e1.png)
internal table gt_allowed_callbacks_hdr 存放了当前系统注册的所有call back信息。系统理一次进入CRM_EVENT_PUBLISH_OW时,该内表是空的,通过subroutine register_callbacks 初始化。
![](https://user-images.githubusercontent.com/5669954/57193200-474e2c00-6f6b-11e9-83b5-c7408c85502f.png)
当前创建的sales order
![](https://user-images.githubusercontent.com/5669954/57193201-474e2c00-6f6b-11e9-81d0-ad6c7d0ef0f4.png)
gt_pr_assign包含两个从SPRO里维护的category 再加上一个generic的BUS20001:
![](https://user-images.githubusercontent.com/5669954/57193202-487f5900-6f6b-11e9-812a-a4cfcab8a290.png)
register完毕后针对transaction type TA,有411个可用的callback:
![](https://user-images.githubusercontent.com/5669954/57193203-487f5900-6f6b-11e9-9843-8aba0aa5210c.png)
![](https://user-images.githubusercontent.com/5669954/57193205-49b08600-6f6b-11e9-8aae-6e33617c47a8.png)
CRM_EVENT_PUBLISH_OW的执行逻辑就是找出这411个callback中有哪些是注册在Order的header level,且event为after_create:
![](https://user-images.githubusercontent.com/5669954/57193206-4a491c80-6f6b-11e9-8cbc-503a041f534e.png)
lv_guid_hdr: 新创建的sales order guid
lt_atonce_exets: 需要立即执行的function module name
![](https://user-images.githubusercontent.com/5669954/57193207-4ae1b300-6f6b-11e9-8950-44cbab42244f.png)
![](https://user-images.githubusercontent.com/5669954/57193208-4b7a4980-6f6b-11e9-9193-4ec5c4b1c67b.png)
真正的function module 执行发生在这里:
![](https://user-images.githubusercontent.com/5669954/57193209-4b7a4980-6f6b-11e9-9ad9-d6bbd7a1d88c.png)
Sent: Friday, August 15, 2014 5:36 PM
To: Wang, Jerry
Subject: 关于回调函数
首先,有几个概念我有点混淆, call back是指回调函数,对吗?也就是在SPRO里, 最下面那个红框EDIT EVENT Handler Table里定义的
CRMV_EVENT is for predefined callbacks. The customer-defined callbacks should not be registered here. Move them to SPRO.
![](https://user-images.githubusercontent.com/5669954/57193210-4c12e000-6f6b-11e9-9682-4c100d86f1e0.png)
界面如下, 可以看到某个function 比如第3行 ZCRM_CP_PRIN0_ITMCHG_EC被注册到了BUS200001这个general 类型上, immediately执行, event事件是在after_change,即发生改变就触发这个函数,优先度为0,那就是先执行它, 后续可能其他function注册为1,2,3,顺序执行, 执行的触发函数是下面界面的form execute_callbacks_planned; 因为item那项有勾, 只执行ITEM level的也就是item发生改变时执行, header改变的时候不执行,不知道理解的对不对?
![](https://user-images.githubusercontent.com/5669954/57193211-4cab7680-6f6b-11e9-80fc-d4a72ae8536a.png)
但是这个form execute_callbacks_planned的次数, 比如29次是由什么决定的? 还有里面的function, 比如第5行ZER1_YMRP_BTX_QUT_PRODOC_CHK_EC, 被执行了10次, 这是在哪里决定的?
![](https://user-images.githubusercontent.com/5669954/57193212-4ddca380-6f6b-11e9-8cf2-10c69d6a72b5.png)
这个调用堆栈, 看来是由CRM_OREDER_MAINTAIN调到的
![](https://user-images.githubusercontent.com/5669954/57193214-4fa66700-6f6b-11e9-8578-7862a8da82b3.png)
但是在call stack里也见到了如下form EXECUTE_CALLBACKS_AT_ONCE, 它和上面的区别, 按字面是一个是plan, 一个是立即执行, 但是这是如何区分的? 程序如何知道
![](https://user-images.githubusercontent.com/5669954/57193215-503efd80-6f6b-11e9-89d4-044005a6a9d3.png)
看起来也是由Execute_callbacks_planned 最终调用到了EXECUTE_CALLBACKS_AT_ONCE, 但是我不理解 的是那注册在SPRO的那些回调函数到底是由哪个form真正调用的? 或者我的理解是不是已经方向性偏离了?
![](https://user-images.githubusercontent.com/5669954/57193216-50d79400-6f6b-11e9-9c8d-a907401a3e00.png)
看以前同事(已经离职, 最近两年走了很多资深同事, 想咨询也很难了)写的关于回调函数的注意点:
Consider the following:
CRMV_EVENT is for predefined callbacks. The customer-defined callbacks should not be registered here. Move them to SPRO.
Restrict the number of times the callback is planned in for a certain execution time to a minimum.
Register the callback for individual transaction categories instead of for the generic transaction category BUS20001 so that the callbacks do not run unnecessarily for other transactions.
Avoid register the unnecessary callbacks to transaction category BUS2000115 -------115 我知道是CRM Sales Transaction, 注册FM在这个上面,是不是也相当于general的调用, 我看联想很多fm都是注册在这里的,
![](https://user-images.githubusercontent.com/5669954/57193217-5208c100-6f6b-11e9-887a-3f0b64dd4c8b.png)
Consider whether it is absolutely necessary to set the execution time “Immediately”. The other execution times are better for performance since several events might trigger the same callback.-----如果不设置成immediately,
![](https://user-images.githubusercontent.com/5669954/57193218-5339ee00-6f6b-11e9-9d3c-7fe656a36d1f.png)
还有很多选项, 这个完全得看业务需要和实际逻辑了。
Consider carefully which value you set for the parameter Call Callback and restrict the number of times the callback is planned in for a certain execution time to a minimum. ------这个是在哪里设置????是我第一个界面吗?如何限制调用次数?
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
相关文章
- AMD Composable Kernel: 定制化算子融合,大幅提升AI端到端性能
- 实战MySQL分页性能优化指南详解数据库
- 管理Oracle服务器管理指南:提升效率、提高性能(oracle的服务器)
- 性能优化SQL Server 2012性能优化策略指南(sqlserver2012)
- 的配置MySQL .cnf配置指南:增强性能和安全性.(mysql.cnf)
- Linux系统清理指南:优化电脑性能的必备软件(linux清理软件)
- MySQL 5.7性能调优优化指南(mysql5.7调优)
- Linux完全安装指南:实现最佳性能(linux完全安装)
- 优化Oracle索引数据库性能的终极指南(oracle索引数据库)
- MySQL运维内参:优化数据表、备份恢复、安全管理、集群分布式实践、性能调优等详细说明,成为MySQL运维人员必备的指南书籍。(mysql运维内参)
- MySQL:利用位运算提高索引性能(mysql 位运算索引)
- 深入浅出:MySQL性能设计指南(mysql性能设计)
- MSSQL数据库性能优化指南(mssql的优化)
- 怎样评估Redis的性能(怎样评估redis)
- 提升Redis性能如何调整线程数(怎么改redis的线程数)
- Oracle 全表查询性能优化指南(oracle 全表查询慢)
- 给系统性能加速Redis接口缓存技术(接口缓存redis)
- 利用协程提升Redis性能的应用场景(协程redis使用场景)
- Oracle优化指令提升性能的秘密武器(oracle优化指令)
- Redis进阶指南揭秘极限性能优化(redis进阶秘籍)
- Redis配置实现性能极致优化(redis配置性能优化)
- 亮风台首席架构师候晓辉:移动AR产品如何做好性能优化
- IIS网站服务器性能优化指南