【问题标题】:Jco Adapter pooling performance deadlock?Jco Adapter pooling 性能死锁?
【发布时间】:2017-11-30 14:31:25
【问题描述】:

我们正在运行一个企业级 SAP 应用程序,前端 springboot 客户端通过 Oracle VM 上的 Jco 适配器 3.0 使用连接池(大小 100)进行连接。我们遇到了超过 10 秒的非系统性长时间运行请求,这些请求在 SAP 应用程序服务器日志中不可见,即瓶颈似乎不在 SAP 端。

查看示例请求的跟踪文件(级别 4),我们可以看到,当适配器线程尝试从池中获取客户端时,时间似乎丢失了(其他线程继续执行,为了清楚起见删除了不相关的线程):

[20:05:50:259]: [JCoAPI] JCoContext.isStateful(P-foo-CPIC0) in session ID Client-53-1 returns false
[20:05:50:259]: [JCoAPI] JCoContext.begin(P-foo-CPIC0) in session ID Client-53-1
[20:05:50:259]: [JCoAPI] Started context for session Client-53-1
[20:05:50:259]: [JCoAPI] JCoContext.begin() for destination PFOO_200 (P-foo-CPIC0) on context with id Client-53-1; current state counter is 1
[20:05:50:259]: [JCoAPI] destination PFOO_200 destinationID=P-foo-CPIC0 executes Z_foo sessionID=Client-53-1, threadID=0x35
[20:05:50:259]: [JCoAPI] Context.getConnection on destination PFOO_200 (state: destination = STATEFUL, default = STATELESS)
[20:05:50:259]: [JCoAPI] PoolingFactory.getClient() on pool P-foo-CPIC0
--> time lost here
[20:06:20:840]: [JCoAPI] PoolingFactory.getClient() returns handle [3/84977415]
[20:06:20:840]: [JCoAPI] Context.getConnection on destination PFOO_200 nothing found in the context - got client from ConnectionManager [3/84977415]
[20:06:20:840]: [JCoAPI] JCoClient before execute(Z_foo) on handle [3/84977415]
[20:06:20:840]: [JCoRFC] Executing function Z_foo on handle [3/84977415]
[20:06:20:866]: [JCoAPI] JCoClient after execute(Z_foo) on handle [3/84977415] returns after 26 ms
[20:06:20:866]: [JCoAPI] Context.releaseConnection on destination PFOO_200 [3/84977415]
[20:06:20:867]: [JCoAPI] JCoContext.end(P-foo-CPIC0) in session ID Client-53-1
[20:06:20:867]: [JCoAPI] PoolingFactory.releaseClient() handle [3/84977415] into pool P-foo-CPIC0 [pool size: 3, peak limit: 100, waiting threads: 0, currently used: 1]
[20:06:20:879]: [JCoAPI] Finished context for session Client-53-1
[20:06:20:879]: [JCoAPI] JCoContext.end() for destination PFOO_200 (P-foo-CPIC0) on context with id Client-53-1; current state counter is 0

对于典型的请求,该步骤以毫秒为单位处理。

对于 Jco 适配器的池处理是否有任何已知的限制或配置,无论是在适配器端还是在 SAP 端?

更新我们已经在 J​​co 适配器 3.0.16 上,现在将仔细检查 3.0.17。 DNS 似乎不太可能,因为我们正在监视 dig/nslookup,并且它们正在毫无延迟地运行。

【问题讨论】:

    标签: spring-boot saprfc jco


    【解决方案1】:

    您使用哪个 JCo 补丁级别? 您是否尝试先更新到最新的 JCo 补丁级别 3.0.17?

    在您的时间间隔内,将打开 RFC 连接并完成 RFC 登录,如果此时池为空。您是否仔细查看了更高级别的跟踪,还是查看了 RFC 跟踪?

    这可能是任何事情,从 ABAP 端没有免费的对话工作流程,到 SAP 系统数据库问题(RFC 登录身份验证检查所需),SAP 消息服务器的响应时间缓慢(如果使用负载平衡登录), SNC 握手问题(如果使用 SNC)或 DNS 的一般网络问题(尝试使用 IP 地址而不是主机名)。

    【讨论】:

      【解决方案2】:

      另一点值得检查:您说您的连接池大小为 100。您的程序有可能有超过 100 个线程吗?然后可能不时发生,所有连接当前都在其他线程中忙碌,当前线程必须等待,直到另一个线程中的函数调用完成并将连接返回到池中。 (可以通过“池等待时间”参数自定义线程在空池上等待的时间。)

      【讨论】: