-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Hi,
When we use NHibernate.Caches.StackExchangeRedis NH Second Level Cache "DistributedLocalCacheRegionStrategy
" with one entity, performance is great.
In our scenario: 300 tables are mostly readonly, using Cache .NonStrictReadWriteCache()
. System has also 100 more online tables that perform insert/update/delete every 1-2ms. So system always takes insert/update/delete operation in every 3-4 ms.
Here lies a bottleneck with UpdateTimestampsCache
: when second level cache is enabled read operations is great only if there is no write operation at the same time. This happens even for entities/spaces which have no need to interact with the "UpdateTimestampsCache".
Am I missing something? This issue is also raised here: nhibernate/nhibernate-core#2735.
Third Level Cache Performance Notes by @maca88 also shows the idea of sync time increases on concurrent requests(our case 300-400 tps), so other clients waits to read/write while executing operation completes. Any cached query read with StandardQueryCache
waits because only one writer can access AsyncReaderWriterLock
-> UpdateTimeStampsCache
at the same time. Any other dml operation waits because there is only one UpdateTimestampsCache
.
Java Implementation have no lock.
Simple possible solution: do not interact with UpdateTimestampsCache
if it is a non cached entity?
NHibernate:5.3.8
NHibernate.Caches.StackExchangeRedis 5.7.0