cancel
Showing results for 
Search instead for 
Did you mean: 

Identifying Session Persistence method

SOLVED
Highlighted
Contributor

Identifying Session Persistence method

Hello all, could anyone help with the following question?

How can you identify which Session Persistence method is
being used by a connection.

My question comes from the need to confirm that  ‘connection.setPersistence’ is working
correctly in my Traffic Script.

I cannot seem to find anywhere is the GUI ect.. where this
can be confirmed.

Any suggestions?

10 REPLIES
Moderator

Re: Identifying Session Persistence method

Mathew,

     easiest way is actually with TrafficScript: Use the connection.getPersistence() function and it will return the name of the persistence class in use for the current connection.

connection.getPersistence()

In a Response rule this function returns the name of the current Session Persistence class used for this connection, or whatever class has been set by a previous use of connection.setPersistence().

$class = connection.getPersistence();

You can then log the result out to the event log while you are debugging or troubleshooting with a log.info() function.  I wrote an article on setting up debug logging in TS to make it easier to toggle debugging on or off that might be of use:

Adding Debug Logging to your TrafficScript | Riverbed Splash

hth.

--

Aidan.

Contributor

Re: Re: Identifying Session Persistence method

Thanks Aidan, I have seen your debug guide I thought for now though I would start simple


$class = connection.getPersistence();


log.info ($class);


This is the repsonse I'm recieving in the event log


01/Feb/2013:10:41:43 +0800 INFO Rule ID Persistence, Virtual Server SharePoint: 


01/Feb/2013:10:41:43 +0800 INFO Rule ID Persistence, Virtual Server SharePoint: 


01/Feb/2013:10:41:43 +0800 INFO Rule ID Persistence, Virtual Server SharePoint:


Can I take it that there is no persistence being seen?

Moderator

Re: Re: Identifying Session Persistence method

Mat,

     Can you post the full rule (sanitised of course of any sensitive info) and advise if you are running it as a request rule, a response rule or both?

--

A

Contributor

Re: Re: Re: Identifying Session Persistence method




Sure thing Aidan, I have included a basic topology so you
can understand what I’m trying to achieve.

In short there are three SharePoint web services, I have
been asked to create a separate Virtual server for each one even though they
are served off the same severs.

You’ll notice there are a couple of extra pools, these are
used for content checks.

The servers need to query their own front end to ensure the
content is not stale and to do so must be load balanced to themselves.

Sharepoint.jpg

Request Rule





$teamsite_pool = "Sharepoint Teamsite Pool";
$companynet_pool = "Sharepoint companynet Pool";
$mysite_pool = "Sharepoint Mysite Pool";



$transparent_session_persistence = "Sharepoint Cookie Insert Persistence";



$url = http.getheader( "Host");
$sessiondata = "";


# These rules deal with content checks, SP_Server_1 and 02 need to be load balanced to themselves
if( string.ipmaskmatch( request.getremoteip(), "172.172.10.20" )
        && http.getheader( "Host" ) == "teamsites.company.com.au" ){


        pool.use( "SharePoint CC SP_Server_1" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.20" )
        && http.getheader( "Host" ) == "teamsites" ){


        pool.use( "SharePoint CC SP_Server_1" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.20" )
        && http.getheader( "Host" ) == "companynet.company.com.au" ){


        pool.use( "SharePoint CC SP_Server_1" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.20" )
        && http.getheader( "Host" ) == "companynet" ){


        pool.use( "SharePoint CC SP_Server_1" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.20" )
        && http.getheader( "Host" ) == "mysite.company.com.au" ){


        pool.use( "SharePoint CC SP_Server_1" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.20" )
        && http.getheader( "Host" ) == "mysite" ){


        pool.use( "SharePoint CC SP_Server_1" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.30" )
        && http.getheader( "Host" ) == "teamsites.company.com.au" ){


        pool.use( "SharePoint CC SP_Server_2" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.30" )
        && http.getheader( "Host" ) == "teamsites" ){


        pool.use( "SharePoint CC SP_Server_2" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.30" )
        && http.getheader( "Host" ) == "companynet.company.com.au" ){


        pool.use( "SharePoint CC SP_Server_2" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.30" )
        && http.getheader( "Host" ) == "companynet" ){


        pool.use( "SharePoint CC SP_Server_2" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.30" )
        && http.getheader( "Host" ) == "mysite.company.com.au" ){


        pool.use( "SharePoint CC SP_Server_2" );


}
else if( string.ipmaskmatch( request.getremoteip(), "172.172.10.30" )
        && http.getheader( "Host" ) == "mysite" ){


        pool.use( "SharePoint CC SP_Server_2" );



}
# End of content check rules


# Start of normal traffic rules


else if( $url == "teamsites" ) {
      $sessiondata = "none";
        pool.use( "SharePoint Teamsites Pool" );
}
else if( $url == "teamsites.company.com.au" ) {
      $sessiondata = "none";
        pool.use( "SharePoint Teamsites Pool" );
}
else if( string.containsI( $url, "companynet" ) ) {
      $sessiondata = "none";
        pool.use( "SharePoint companynet Pool" );
}
else if( string.containsI( $url, "companynet.company.com.au" ) ) {
      $sessiondata = "none";
        pool.use( "SharePoint companynet Pool" );
}
else if( string.containsI( $url, "mysite" ) ) {
      $sessiondata = "none";
        pool.use( "SharePoint Mysite Pool" );  
}
else if( string.containsI( $url, "mysite.company.com.au" ) ) {
      $sessiondata = "none";
        pool.use( "SharePoint Mysite Pool" );  
}
if( $sessiondata != "none" ) {
   if( $sessiondata ) {
 
      connection.setPersistence( $transparent_session_persistence );
   }
}




Response Rule


$class = connection.getPersistence();


log.info ($class);



Moderator

Re: Re: Re: Re: Identifying Session Persistence method

Mat,

    Lets simplify your rule to figure out what is happening.  If I use 2 rules one to set persistence, one to get persistence, I get the expected result.


#Request Rule set_persistence:


connection.setPersistence("MyNewCookie");


log.info("Request rule Persistence in use is: __" . connection.getPersistence() . "__");



# Response Rule get_persistence:


log.info("Response Rule Persistence in use is: __" . connection.getPersistence() . "__");


INFO07/Feb/2013:10:53:17 +1000INFORule get_persistence, Virtual Server myTestVS: Response Rule Persistence in use is: __MyNewCookie__stmvatest
INFO07/Feb/2013:10:53:17 +1000INFORule set_persistence, Virtual Server myTestVS: Request rule Persistence in use is: __MyNewCookie__stmvatest

I am thinking that your issue might be with the logic in the block where persistence is being set - perhaps your logic conditions are not trigering the way you intend them to?

Contributor

Re: Re: Re: Re: Identifying Session Persistence method

Using the stand alone rules supplied in your last post I can indeed see the persistence being set.

As soon as I embed this into my existing script (removing the old persistence part) I get no result, the persistence is not set.

Frequent Contributor

Re: Identifying Session Persistence method

Hi Matt,

One thing to watch out for... if you call 'pool.use()' in a TrafficScript rule, then we'll immediately stop running rules and hand the connection over to the named pool.

In your example, if any of the pool.use() statements get called, then the rule will never proceed to line 85+ where you set the persistence class.

You should either:

  • Select the persistence class before you invoke pool.use()
  • Use 'pool.select()' instead.  This tells the traffic manager to continue running rules, but once they all complete, the traffic manager will use the named pool rather than the default pool

Owen

Contributor

Re: Re: Identifying Session Persistence method

Thanks for the feedback Owen, during my troubleshooting I kind of work my way around to that conclusion as well and as such placed my persistence rule before the 'pool.use()' rule.

Unfortunately it had no affect.


}


else if( string.containsI( $url, "teamsites.company.com.au" ) ) {


connection.setPersistence("Sharepoint Cookie Insert Persistence"); <-- I'm inserting the rule here


        pool.use( "SharePoint Teamsites Pool" );


The script is directing the traffic to the pools correctly but for some reason it completely ignores the persistence rule.

Here is the persistence rule for ref., no spelling errors between the traffic rule and persistence entry.

per.JPG.jpg

I was thinking about using 'pool.select()' but time has run our now on the project so for now I have hard set the persistence under each pool.

Frequent Contributor

Re: Identifying Session Persistence method

Hi Matthew,

I've looked into this further, and it is indeed a recently-discovered issue in the product - using pool.use() or pool.select() will clear any previously-assigned session persistence class.

We are judging the best way to address this problem - either change the behavior of pool.use()/pool.select() to be less unexpected, or update the documentation to expressly call out the current behavior. 

However, for the time being, your solution (associate the session persistence class with the pool) is the correct one.

Best regards

Owen