orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Optimize user login

Open lvca opened this issue 12 years ago • 10 comments

Most of the times users are logged using "admin" user, but in many cases OrientDB executes a query against the database (HTTP access). We'd need to cache at least "admin" user, or the most used with a LRU cache.

lvca avatar Apr 06 '14 10:04 lvca

Implemented used a ConcurrentLinkedHashMap limite to 100, by default, defined by the new setting:

SECURITY_MAX_CACHED_USERS("security.maxCachedUsers", "Maximum users cached in RAM. This speeds up authentication for the most used users",
  Integer.class, 100),

lvca avatar Apr 07 '14 07:04 lvca

Hi, Luca. what do you mean by "cached user"? Do you intend to store users' credential in memory so to avoid db access to authenticate them?

giastfader avatar Apr 07 '14 08:04 giastfader

I want to store in RAM OUser objects.

lvca avatar Apr 07 '14 08:04 lvca

I've introduced also caching for roles, to allow all test against restricted to pass.

lvca avatar Apr 07 '14 09:04 lvca

Ok, I see. Just pay attention in case users change their password or roles.

giastfader avatar Apr 07 '14 09:04 giastfader

Yes, the trigger on user change remove the object from the cache to force reloading.

lvca avatar Apr 07 '14 09:04 lvca

@lvca what about remote client? how does remote client will figure out that user is changed on server by someone else?

enisher avatar Apr 07 '14 10:04 enisher

@enisher remote clients don't cache them.

lvca avatar Apr 07 '14 12:04 lvca

On HTTP requests the improvement is huge.

lvca avatar Apr 07 '14 16:04 lvca

+80% on diple HTTP GET requests

lvca avatar Apr 07 '14 17:04 lvca