Forum Discussion
Irule for jsession ID weblogic support
hi all, i am very new to this irules, hence i need you help on the below query.
We have deployed application in two manager servers respectively (Server A and Server B running weblogic)
irule used for Jsession persistance is
when HTTP_REQUEST { set log_prefix "[IP::client_addr]:[TCP::client_port]" log local0. "$log_prefix: Request to [HTTP::uri] with cookie: [HTTP::cookie value JSESSIONID]"
if { [HTTP::cookie "JSESSIONID"] ne "" }{ persist uie [string tolower [HTTP::cookie "JSESSIONID"]] 360
log local0. "$log_prefix: Used persistence record from cookie. Existing key? [persist lookup uie [string tolower [HTTP::cookie "JSESSIONID"]]]"
} else { set jsess [findstr [string tolower [HTTP::path]] "jsessionid=" 11]
if { $jsess != "" } {
persist uie $jsess 360
log local0. "$log_prefix: Used persistence record from path: [persist lookup uie $jsess]"
}
} } when HTTP_RESPONSE { if { [HTTP::cookie "JSESSIONID"] ne "" }{ persist add uie [string tolower [HTTP::cookie "JSESSIONID"]] 360
log local0. "$log_prefix: Added persistence record from cookie: [persist lookup uie [string tolower [HTTP::cookie "JSESSIONID"]]]"
} }
- If Server A is Up and Server B is down then we are processing 2000 transactions in 5 minutes.
- If Server B is Up and Server A is down then we are processing 2000 transactions in 5 minutes.
- If both Server A and Server B servers are Up then we are processing only 100 transactions in 5 minutes and more than 65 transactions getting time out.
We need to understand why this successful transactions is low when both servers are up and troubleshooting commands to analysis this.
20 Replies
- Kevin_Stewart
Employee
This is a simplified version that relies on HTTP cookies:
when HTTP_REQUEST { if { [HTTP::cookie "PAYMENTID"] ne "" } { persist uie [string tolower [HTTP::cookie "PAYMENTID"]] 3600 } } when HTTP_RESPONSE { if { [HTTP::cookie "PAYMENTID"] ne "" } { persist add uie [string tolower [HTTP::cookie "PAYMENTID"]] 3600 } }
You mentioned that this wasn't for browser clients, but you didn't say if the clients supported HTTP cookies? Do they support cookies, or will the PAYMENTID be in the payload or URI?
- Ecesureshkumar
Nimbostratus
Hi kevin, Thanks for your valuable response. Payment ID will be in TCP payload only. The above irule was not helpful, any other rules to test.
- Kevin_Stewart
Employee
Payment ID will be in TCP payload only
I will need a sample of the payload.
Also, just to confirm (again) the PAYMENTID is sent to the client on FIRST response, doesn't change through the life of the session, and the client sends it back to the server in EVERY request. Correct?
- Ecesureshkumar
Nimbostratus
hi kevin, for more details
Request Client --> Vitrualserver_Web (Ssl Persistance) --> virtualserver_app (Payment ID_persistance)
Responsevirtualserver_app --> Vitrualserver_Web --> client
intial request from client to server will not have payment ID, but response from app server will have payment ID and it will be unique till session ends.
Please let me know, where all you need packet capture.
- Kevin_Stewart
Employee
Thanks for the additional detail. Two more things:
-
I don't believe you've cleared this part up, but are you certain that the client sends the PAYMENTID value back to the server in EVERY request? This is important if you want to based persistence on this value.
-
I need to see where the PAYMENTID value is in the request and response payload? This is HTTP, yes?
-
- Ecesureshkumar
Nimbostratus
hi kevin, Thanks for your response. In simple could you please provide which output required and what are the commands need to execute to get those output will be much appreciated.
- Kevin_Stewart
Employee
Here is a start to what that iRule might look like:
when CLIENT_ACCEPTED { TCP::collect } when CLIENT_DATA { if { [TCP::payload] contains "PAYMENTID=" } { log local0. [findstr [TCP::payload] "PAYMENTID=" 10 "\n"] persist uie [findstr [TCP::payload] "PAYMENTID=" 10 "\n"] 3600 } TCP::release TCP::collect } when SERVER_CONNECTED { TCP::collect } when SERVER_DATA { if { [TCP::payload] contains "PAYMENTID=" } { log local0. [findstr [TCP::payload] "PAYMENTID=" 10 ";"] persist add uie [findstr [TCP::payload] "PAYMENTID=" 10 ";"] 3600 } TCP::release TCP::collect }
We're essentially going to collect the payload of each request and response, looking for the PAYMENTID string to use for the uie persistence. Now this probably isn't going to work just yet though. Without being able to see what your TCP data actually looks like, it would be difficult to create an expression to find the PAYMENTID string in the payload. So you'll need to work this one out.
log local0. [findstr [TCP::payload] "PAYMENTID=" 10 "\n"] persist uie [findstr [TCP::payload] "PAYMENTID=" 10 "\n"] 3600 log local0. [findstr [TCP::payload] "PAYMENTID=" 10 ";"] persist add uie [findstr [TCP::payload] "PAYMENTID=" 10 ";"] 3600
The first set are in the client side context (request), and the second set are in the server side context (response). You'll need to capture the payload and see where the PAYMENTID gets inserted by the server, and where the client sends it back, and then create an expression to extract these values.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com