Reputation: 1170
I am working on a project in which we are using ehcache. We are using the search API heavily and have about 5-7 search attributes of the values that we are using.
So, I am wondering would having these many search attributes reduce the performance of cache ?
Upvotes: 1
Views: 713
Reputation: 9102
EhCache documentation states following
Search operations perform in O(n) time.....The test shows search performance of an average of representative queries at 4.6 ms for a 10,000 entry cache, and 427 ms for a 1,000,000 entry cache. Accordingly, standalone implementation is suitable for development and testing.
When using standalone Ehcache without BigMemory for production, it is recommended to search only caches that are less than 1 million elements. Performance of different Criteria vary. For example, here are some queries and their execute times on a 200,000 element cache. (Note that these results are all faster than the times given above because they execute a single Criteria).
Two important things mentioned here are - Performance of different Criteria vary and it matters if there is a single Criteria versus multiple Criteria. Although the actual impact on performance can be found only by benchmarking for your use case - the documentation suggests it has some effect. The best way is to benchmark it yourself.
Upvotes: 1
Reputation: 14500
In Open Source Ehcache, the search functionality uses brute force. This means that search cost is paid as follows:
Given this, yes the number of attributes has a direct performance impact on put
but none on get
.
Upvotes: 1