Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP Cache #60

Closed
patrikx3 opened this issue Mar 6, 2017 · 5 comments
Closed

LDAP Cache #60

patrikx3 opened this issue Mar 6, 2017 · 5 comments

Comments

@patrikx3
Copy link

patrikx3 commented Mar 6, 2017

I have Cache Time-To-Live to 600 seconds (is that right config?), still when I refresh or download 100+ files, it hits a new request it uses a new LDAP request.
How can I cache or keep it in the session instead of authorize LDAP every reload/refresh or anything?
Right now my CPU usage is too high for this.
(Samba is also slow, but *cloud could use the session isnit?)

@PVince81
Copy link
Contributor

PVince81 commented Mar 6, 2017

Did you enable memcache ? That should reduce the requests a bit but not completely.

@patrikx3
Copy link
Author

patrikx3 commented Mar 6, 2017

What do you mean?
Doesn't the session keep the auth?
Why does it generate a new Auth for every request? Why do I need a memcache for a simple session?
The session knows the used login, name, etc, so that it doesn't create a new request.
This way I can use a plain Http Basic Auth and it is the same.

The session is to keep instead of hitting the backend every request.

I add in memcache and it is still not working with the session kept?
Weird!
Thanks!

@PVince81
Copy link
Contributor

PVince81 commented Mar 6, 2017

@jvillafanez

@jvillafanez
Copy link
Member

I think there are some misunderstandings about how the LDAP app is working.

  • Each request will use fresh resources, in particular LDAP connections. Each request will use a new LDAP connection that will need to be authenticated and will requests data to the LDAP server. ownCloud can't do anything about this. I think it's apache the one that spawns a new php process to handle that request, so as said, ownCloud can't do anything.

  • ownCloud can cache data from the LDAP server, and use that data during next requests instead of connecting to the LDAP server. This is different than reusing LDAP connections.

    In order to enable caching, you need to set up either redis or memcached to be used by ownCloud as memory cache. Once it's properly set and configured (including some changes required in the ownCloud's config.php file), the LDAP app should start to use it and reduce the number of requests to the LDAP server. (There is documentation about how to setup redis / memcached in ownCloud)

  • The cache time-to-live is used when caching is enabled. After the ttl expires, the data cached will be removed from the cache and new requests will be done to the LDAP server to fetch fresh data.

A couple of notes:

  • If there isn't any cache active, the LDAP app will connect to the LDAP as requested.
  • Each request will use a fresh connection to the LDAP if needed. This means:
    • Different requests will need to be authenticated, even if they're using the same credentials
    • The connection is made directly to the LDAP server. The LDAP app isn't connecting to a proxy or any other service that could be in between ownCloud and the LDAP server to handle the connections.

@patrikx3
Copy link
Author

patrikx3 commented Mar 7, 2017

this is weird why you need redis/memcache, you just not use simple php session ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants