关于PC端PATCH /payment-info接口及BC调用的性能优化问询
报价提交更新支付计划流程性能瓶颈排查与优化问询
背景与性能分析
我们针对报价提交更新支付计划的应用流程开展性能瓶颈排查(注:扩展仅用于性能分析,未新增任何调用)。经分析,PC会针对相似数据(保单的有效支付计划与所有可用支付计划)重复调用BC两次。
性能分析结果
目标方法:gw.rest.pl.framework.v1.handler.AbstractApiHandler#patchPaymentInfo
缓存优化POC实现
为解决重复调用问题,我们开发了缓存BC相关调用的POC,核心实现如下:
核心代码(伪代码)
BCBillingSystemPlugin.setDownPaymentInstallmentTotalForAllInstallmentsPlans() // Pseudo code var cache = InstallmentPlanBillingAmountsCache_Ext.getInstance() var installmentPlans = paymentPlans.InstallmentPlans var uncachedPlans = installmentPlans.where(\p -> not cache.hasValidEntry(period.PublicID, p.BillingId)) var cachedPlans = installmentPlans.where(\p -> cache.hasValidEntry(period.PublicID, p.BillingId)) if (uncachedPlans.HasElements) { super.setDownPaymentInstallmentTotalForAllInstallmentsPlans(period, plans) uncachedPlans.each(\p -> cache.put(period.PublicID, p as InstallmentPlanDataImpl)) } cachedPlans.each(\p -> cache.applyTo(period.PublicID, p as InstallmentPlanDataImpl))
测试用例
// BCBillingSystemPluginTest function testThatBCIsCalledOnlyOnceForTwoConsecutiveInvocationsWithSamePlans() { // Given: a real policy period and a plan with a known BillingId var period = MSATestJobUtil.createDraftorQuotedMobilitySAPolicy(Date.CurrentDate, SubmissionStatus.QUOTED) var plan = new InstallmentPlanDataImpl() plan.BillingId = "test-billing-plan-caching-001" var testPlugin = new CountingBCBillingSystemPlugin() // When: setDownPaymentInstallmentTotalForAllInstallmentsPlans is called twice // (mirroring the two OOTB call paths within a single PATCH /jobs/{id}/payment-info request) testPlugin.setDownPaymentInstallmentTotalForAllInstallmentsPlans(period, {plan} as PaymentPlanData[]) testPlugin.setDownPaymentInstallmentTotalForAllInstallmentsPlans(period, {plan} as PaymentPlanData[]) // Then: BC should have been reached only once — the second call was served from cache assertThat(testPlugin.BCCallCount) .as("BC should be called only once when the same plans are requested twice within the cache TTL") .isEqualTo(1) }
POC测试效果与未落地原因
本地环境测试显示,PATCH /payment-info接口耗时从700-900ms降至400-500ms,但因该方案偏离OOTB代码,且自定义缓存存在长期维护成本问题,我们未落地该方案。
正式问询
现正式问询Guidewire:是否愿意继续开展分析,探讨针对该PC端点及下游BC调用的性能优化可能性?
内容的提问来源于stack exchange,提问作者user32817999
相关产品推荐
相关产品推荐

