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

Make runtime of session handling be in O(1) #69

Closed
xb opened this Issue Oct 13, 2011 · 1 comment

Comments

Projects
None yet
2 participants
@xb

xb commented Oct 13, 2011

Currently the time to handle one session (get_cached_session, add_cached_session) is in O(n) (where n is the number of already open sessions). As n can get up to 1000 or more in certain applications, adding and removing sessions can become quite wasteful in terms of CPU and RAM bandwidth. Additionally, because these actions are done while a Mutex is held, this cannot even be "optimized" by adding CPU power.

nahi added a commit that referenced this issue Oct 14, 2011

Optimize cached session access performance
Change @sess_pool from an Array to a Hash with Site as a key.  Each
value is an Array of sessions.  This should improve cache access
performance if multiple sites are in cache.

In addition to the change, do scrub the cache every @keep_alive_timeout
seconds.  This also should improve cache access performance since it was
scrubbing the cache every time.  See #69
@nahi

This comment has been minimized.

Show comment
Hide comment
@nahi

nahi Oct 16, 2011

Owner

@xb, thanks for filing this as a ticket.

I added some optimization at 0190684 though it might not be an ideal O(1) code... Let me know if you have suggestions.

Owner

nahi commented Oct 16, 2011

@xb, thanks for filing this as a ticket.

I added some optimization at 0190684 though it might not be an ideal O(1) code... Let me know if you have suggestions.

@nahi nahi closed this Oct 16, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment