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

core.cache sessions may have a performance impact #2

Closed
yogthos opened this issue Sep 6, 2015 · 7 comments
Closed

core.cache sessions may have a performance impact #2

yogthos opened this issue Sep 6, 2015 · 7 comments

Comments

@yogthos
Copy link
Contributor

yogthos commented Sep 6, 2015

This thread indicates that core.cache may be causing a significant performance hit. Might be worth investigating.

@boechat107
Copy link
Owner

Thanks, @yogthos. I'll use criterium to generate some benchmarks. Perhaps I should have taken this as a very serious warning. I'll investigate it better.

@boechat107
Copy link
Owner

I have created a namespace for performance comparison with the ring's default in-memory implementation. In summary, in the current version (0.1.1) read operations are ~40 times slower; write operations, ~300 times slower.

Looking at core.cache's code and running the VisualVM's profiler, I guess that it's possible to improve the performance by doing some small changes. I'm planning to do it very soon.

Anyway, of course that we should expect some overhead for the TTL session when comparing to the ring's default in-memory implementation.

@yogthos
Copy link
Contributor Author

yogthos commented Sep 11, 2015

Yeah, I think some overhead is definitely to be expected, but would be nice if it could be within an order of magnitude at least. :) Otherwise, running a thread to do session cleanup is probably cheaper overall.

@yogthos
Copy link
Contributor Author

yogthos commented Sep 11, 2015

Another idea might be to compare performance using Java cache libs like Guava cache.

@yogthos
Copy link
Contributor Author

yogthos commented Sep 11, 2015

I made a project wrapping expiringmap Java lib here. It should be trivial to swap in for core.cache and see if it performs better.

@boechat107
Copy link
Owner

Thanks, @yogthos! I'll compare the performance using your lib today.

I agree with you. In the worst case, providing an implementation that uses an additional thread for session cleanup could be a good alternative.

@boechat107
Copy link
Owner

By my last tests, expiring-map can be at most ~2x slower than the bare in-memory store in the worst case, which is a huge improvement over core.cache.

expiring-map became the default implementation.

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