首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用于UIE的F5 iRule -使用持久uie命令时的延迟

用于UIE的F5 iRule -使用持久uie命令时的延迟
EN

Stack Overflow用户
提问于 2016-06-17 05:55:22
回答 1查看 721关注 0票数 0

我们正在尝试将F5负载均衡器引入我们的服务,为此,我们正在开发一个具有通用持久化特性的持久化会话的iRule。

但是,当尝试使用iRule命令"persist uie“来持久化会话时,我们遇到了延迟。

延迟可以超过1000毫秒...

什么地方出问题了?我们如何才能摆脱这种延迟?

请查看我们的iRule代码和我们记录的日志。

提前感谢

下面是我们的iRule代码:

代码语言:javascript
复制
when HTTP_REQUEST {
                if {[HTTP::host] equals "mpi-lb.creditguard.co.il" } {
                                set txID1 ""
                                set txID2 ""
                                set txID3 ""
                                set txID4 ""
                                set txID5 ""
                                set txID6 ""
                                set txID7 ""
                                set txID8 ""
                                # Log details for the request
                                regexp {(txId|token|mpiTransactionId|transactionID)[=>]([0-9a-z]{8}-([0-9a-z]{4}-){3}[0-9a-z]{12})([&< ]|$)} [HTTP::uri] => txID1 txID2 txID3 txID4
                                regexp {(txId|token|mpiTransactionId|transactionID)[=>]([0-9a-z]{8}-([0-9a-z]{4}-){3}[0-9a-z]{12})([&< ]|$)} [HTTP::payload] => txID5 txID6 txID7 txID8
                                log local0. "uri:[HTTP::uri]:payload: txID2:$txID2 txID6:$txID6"
                                if {$txID2 != ""} {
                                                log local0. "persist lookup uie:[persist lookup uie $txID2] $txID2 in uri"
                                                persist uie $txID2
                                } elseif {$txID6 != ""} {
                                                log local0. "persist lookup uie:[persist lookup uie $txID6] $txID6 in paylod"
                                                persist uie $txID6
                                }
                }
}

when HTTP_RESPONSE {
                if {([IP::server_addr] equals "172.16.100.16") || ([IP::server_addr] equals "172.16.100.17") } {
                                # Trigger collection for up to 1MB of data
                                if {[HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576} {
                                                set content_length [HTTP::header "Content-Length"]
                                } else {
                                                set content_length 1048576
                                }
                                # Check if $content_length is not set to 0
                                if { ([HTTP::status] == 200) && ($content_length > 0)} {
                                                HTTP::collect $content_length
                                }
                }
}

when HTTP_RESPONSE_DATA {
                if {([IP::server_addr] equals "172.16.100.16") || ([IP::server_addr] equals "172.16.100.17") } {
                                # do stuff with the payload
                                #find the application unique identifier between <uid> and </uid> (5 is the length of <uid> string)
                                set txId [string trim [findstr [HTTP::payload] "<txId>" 5 "</txId>"] ">"]
                                if {$txId != ""} {
                                                log local0. "[IP::server_addr] : persist add uie #$txId#"
                                                persist add uie $txId 1800
                                }
                }
}

这里是日志(您可以看到14:16:08到14:17:08之间的延迟)

代码语言:javascript
复制
Tue Jun 14 14:16:03 IDT 2016  info  cgwaf tmm3[10326]    Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/CreateTransactionExtended:payload: txID2: txID6:  
Tue Jun 14 14:16:04 IDT 2016 info cgwaf  tmm3[10326]     Rule /Common/mpi-lb-irule <HTTP_RESPONSE_DATA>: 172.16.100.16 : persist add uie #03f72209-754e-4bde-85f6-69cdf4d27526#  
Tue Jun 14 14:16:08 IDT 2016  info cgwaf tmm1[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/PerformTransaction? txId=03f72209-754e-4bde-85f6-69cdf4d27526:payload: txID2:03f72209-754e-4bde-85f6-69cdf4d27526 txID6:  
Tue Jun 14 14:16:08 IDT 2016  info cgwaf tmm1[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: persist lookup uie:/Common/mpi-lb 172.16.100.16 443 03f72209-754e-4bde-85f6-69cdf4d27526 in uri 
Tue Jun 14 14:17:08 IDT 2016  info cgwaf tmm2[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/merchantPages/ResponsiveWebSources/images/cvv.jpg:payload: txID2: txID6:  
Tue Jun 14 14:17:08 IDT 2016  info  cgwaf tmm[10326]    Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/merchantPages/ResponsiveWebSources/images/mastercard_slice.gif:payload: txID2: txID6:  
Tue Jun 14 14:17:08 IDT 2016  info cgwaf tmm[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/merchantPages/ResponsiveWebSources/images/pci_slice.gif:payload: txID2: txID6:  
Tue Jun 14 14:17:08 IDT 2016  info cgwaf tmm[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/merchantPages/ResponsiveWebSources/images/visa_slice.gif:payload: txID2: txID6:  
Tue Jun 14 14:17:08 IDT 2016  info cgwaf tmm[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/merchantPages/ResponsiveWebSources/images/Logo.gif:payload: txID2: txID6:  
Tue Jun 14 14:17:08 IDT 2016  info  cgwaf tmm3[10326]    Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/merchantPages/ResponsiveWebSources/images/qm.png:payload: txID2: txID6:  
Tue Jun 14 14:18:06 IDT 2016  info  cgwaf tmm2[10326]    Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri://CGMPI_Server/ProcessCreditCard:payload: txID2: txID6:03f72209-754e-4bde-85f6-69cdf4d27526  
Tue Jun 14 14:18:06 IDT 2016  info cgwaf tmm2[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: persist lookup uie:/Common/mpi-lb 172.16.100.16 443 03f72209-754e-4bde-85f6-69cdf4d27526 in paylod  
Tue Jun 14 14:18:07 IDT 2016  info cgwaf tmm2[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri:/CGMPI_Server/merchantPages/nlb/OK.jsp?uniqueID=697536646.622257&lang=EN&authNumber=9125242& responseMac=7e77d7fe857e707ddf1c8990c80da8373f716c79d0ee79b88 f3d898a9ff0afc0&cardToken=1051484189394580& cardExp=0217&personalId=88888888& cardMask=458045******4580& txId=03f72209-754e-4bde-85f6-69cdf4d27526& numberOfPayments=&firstPayment=&periodicalPayment=:payload: txID2:03f72209-754e-4bde-85f6-69cdf4d27526 txID6:  
Tue Jun 14 14:18:07 IDT 2016  info cgwaf tmm2[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: persist lookup uie:/Common/mpi-lb 172.16.100.16 443 03f72209-754e-4bde-85f6-69cdf4d27526 in uri 
Tue Jun 14 14:18:07 IDT 2016  info cgwaf tmm2[10326]     Rule /Common/mpi-lb-irule <HTTP_REQUEST>: uri:/CGMPI_Server/merchantPages/WebSources/images/ssl.png:payload: txID2: txID6:  
EN

回答 1

Stack Overflow用户

发布于 2016-06-18 00:09:28

我看到您在入站和出站流上使用正则表达式查找,这是非常昂贵和耗时的。请记住,F5需要代理数据,保存数据,提取流,执行正则表达式操作,然后将其传递回出口堆栈。如果你想优化时间,试着找到另一种方法来持久化数据流。

也就是说,您可以使用计时命令来查看iRule使用的每个事件处理周期:https://devcentral.f5.com/wiki/iRules.timing.ashx

根据您运行的TMSH版本,您应该在GUI中或通过TMSH命令获取统计信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37869984

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档