Topic
  • 5 replies
  • Latest Post - ‏2012-10-29T18:28:24Z by HermannSW
Arnab_Ghosh
Arnab_Ghosh
94 Posts

Pinned topic Caching LDAP data

‏2012-10-23T19:57:26Z |
Hi,
I have written custom stylesheet to grab some attributes from LDAP. I want to cache these data somewhere in Datapower so that i dont need to hit the LDAP each and every time. How can i achieve this?
Thanks,
Arnab
Updated on 2012-10-29T18:28:24Z at 2012-10-29T18:28:24Z by HermannSW
  • HermannSW
    HermannSW
    4657 Posts

    Re: Caching LDAP data

    ‏2012-10-24T08:41:19Z  
    Hi,

    > I have written custom stylesheet to grab some attributes from LDAP.
    > I want to cache these data somewhere in Datapower so that i dont need to hit the LDAP each and every time. How can i achieve this?
    >
    the InfoCenter for dp:ldap-seach() states:
    ...
    Results

    A node set corresponding to an XML fragment that contains the search results.
    ...

    DataPower does provide a document cache, see under XML managers on how to configure/use.

    So if you
    • create a new service on the box
    • accessing LDAP and returning XML node-set
    • with document caching configured/enabled
    • and access the LDAP not directly as you do now, but through the new chained service
    then the LDAP responses get cached (in the document cache of the new service's XML manager).

    Another option might be the use of AAA, especially Defining the authentication method:
    ...
    User Auxiliary LDAP Attribute
    Define the list of LDAP attributes as the auxiliary information for AAA. Use a comma as the delimiter.
    For example, email,cn,userPassword. Results are appended to the context variable var://context/ldap/auxiliary-attributes.
    The LDAP attributes are synchronized to the AAA authentication cache.
    ...

     
    Hermann<myXsltBlog/> <myXsltTweets/>
  • Arnab_Ghosh
    Arnab_Ghosh
    94 Posts

    Re: Caching LDAP data

    ‏2012-10-25T22:14:43Z  
    • HermannSW
    • ‏2012-10-24T08:41:19Z
    Hi,

    > I have written custom stylesheet to grab some attributes from LDAP.
    > I want to cache these data somewhere in Datapower so that i dont need to hit the LDAP each and every time. How can i achieve this?
    >
    the InfoCenter for dp:ldap-seach() states:
    ...
    Results

    A node set corresponding to an XML fragment that contains the search results.
    ...

    DataPower does provide a document cache, see under XML managers on how to configure/use.

    So if you
    • create a new service on the box
    • accessing LDAP and returning XML node-set
    • with document caching configured/enabled
    • and access the LDAP not directly as you do now, but through the new chained service
    then the LDAP responses get cached (in the document cache of the new service's XML manager).

    Another option might be the use of AAA, especially Defining the authentication method:
    ...
    User Auxiliary LDAP Attribute
    Define the list of LDAP attributes as the auxiliary information for AAA. Use a comma as the delimiter.
    For example, email,cn,userPassword. Results are appended to the context variable var://context/ldap/auxiliary-attributes.
    The LDAP attributes are synchronized to the AAA authentication cache.
    ...

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    Thanks Hermann, I have implemented caching as you have mentioned in the option 1. Only one question, is there any limit on the Document Cache Size? How can i know the limit?
  • HermannSW
    HermannSW
    4657 Posts

    Re: Caching LDAP data

    ‏2012-10-26T18:47:17Z  
    Thanks Hermann, I have implemented caching as you have mentioned in the option 1. Only one question, is there any limit on the Document Cache Size? How can i know the limit?
    Hi,

    there is a maximum size you can define in XML manager, little bit more than 160MB.
    You can find the exact value by specifying eg. 200.000.000, then the error message will tell you the exact maximal value.

    But that does not mean that you cannot cache more -- just use many xML
    managers, each of maximal doccache size.

     
    Hermann<myXsltBlog/> <myXsltTweets/>
  • Arnab_Ghosh
    Arnab_Ghosh
    94 Posts

    Re: Caching LDAP data

    ‏2012-10-26T22:53:49Z  
    • HermannSW
    • ‏2012-10-26T18:47:17Z
    Hi,

    there is a maximum size you can define in XML manager, little bit more than 160MB.
    You can find the exact value by specifying eg. 200.000.000, then the error message will tell you the exact maximal value.

    But that does not mean that you cannot cache more -- just use many xML
    managers, each of maximal doccache size.

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    HI Hermann,
    I am having a strange issue. Say i am calling service B from service A. In service A, I am caching the response from service B. Say Cache time is set as 60secs. So if I call second time after 60secs, the response is not retrieved from cache and so its giving a call to the service B but instead of one call its giving two call one with HEAD (this one fails) and the other with GET(this one returns correctly). But this response is not cached by the service A. If I give third call within 60 secs, then only one call goes to Service B as expected and the response is also cached properly.

    I check the Document Cache Status and its showed that, after 60secs of the first call, the document cache size is not 0(say X bytes) but after second call(the one which triggers two call -HEAD and GET), the document count remains 1 but size is 0 bytes. After 3rd call, the cache size changes to X bytes again.

    Can you let me know I am doing something wrong? From where two calls are going to the service B from Service A and why the first one is HEAD? I tried to call the service service B from SOAP UI using GET and the service B is working properly but service A is behaving strangely

    Thanks,
    Arnab
  • HermannSW
    HermannSW
    4657 Posts

    Re: Caching LDAP data

    ‏2012-10-29T18:28:24Z  
    HI Hermann,
    I am having a strange issue. Say i am calling service B from service A. In service A, I am caching the response from service B. Say Cache time is set as 60secs. So if I call second time after 60secs, the response is not retrieved from cache and so its giving a call to the service B but instead of one call its giving two call one with HEAD (this one fails) and the other with GET(this one returns correctly). But this response is not cached by the service A. If I give third call within 60 secs, then only one call goes to Service B as expected and the response is also cached properly.

    I check the Document Cache Status and its showed that, after 60secs of the first call, the document cache size is not 0(say X bytes) but after second call(the one which triggers two call -HEAD and GET), the document count remains 1 but size is 0 bytes. After 3rd call, the cache size changes to X bytes again.

    Can you let me know I am doing something wrong? From where two calls are going to the service B from Service A and why the first one is HEAD? I tried to call the service service B from SOAP UI using GET and the service B is working properly but service A is behaving strangely

    Thanks,
    Arnab
    Hi,

    the HEAD can be OK (to determine whether remote ressource is unchanged).
    But as you said the 2nd HEAD+GET should end with an entry in document cache.
    Please create a PMR, then Level2 support will collect the necessary data (firmware version, service export) for investigation.

     
    Hermann<myXsltBlog/> <myXsltTweets/>