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

[question] Is ehcache virtual thread / loom friendly? #3211

Open
wyhasany opened this issue Jan 23, 2024 · 2 comments
Open

[question] Is ehcache virtual thread / loom friendly? #3211

wyhasany opened this issue Jan 23, 2024 · 2 comments

Comments

@wyhasany
Copy link

I wonder if ehcache is loom-friendly - e.g. does not pin the platform threads?

@JT-Alchemy
Copy link

Would also like to know this. Also any suggested patterns for leveraging virtual threads with EH Cache if it's not directly supportive of them yet 🙏

@VIJAY-SUBRAMANIAM
Copy link

It seems no, that ConcurrentHashMap is blocking the carrier thread. ehcache uses a ConcurrentHashMap that is built on synchronized blocks, such as computeIfAbsent.

This was the issue noticed when switched spring framework to use virtual threads

"org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#0-1" #34 [41] prio=5 os_prio=0 cpu=83638.00ms elapsed=21635.21s tid=0x00007fb31f83b1e0 nid=41 waiting for monitor entry [0x00007fb3208ff000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.ehcache.impl.internal.concurrent.ConcurrentHashMap.computeIfPresent(ConcurrentHashMap.java:1840)
- waiting to lock <0x00000000c8a79370> (a org.ehcache.impl.internal.concurrent.ConcurrentHashMap$Node)
at org.ehcache.impl.internal.store.heap.SimpleBackend.computeIfPresent(SimpleBackend.java:121)
at org.ehcache.impl.internal.store.heap.OnHeapStore.evict(OnHeapStore.java:1591)
at org.ehcache.impl.internal.store.heap.OnHeapStore.enforceCapacity(OnHeapStore.java:1558)
at org.ehcache.impl.internal.store.heap.OnHeapStore.resolveFault(OnHeapStore.java:785)
at org.ehcache.impl.internal.store.heap.OnHeapStore.getOrComputeIfAbsent(OnHeapStore.java:705)
at org.ehcache.impl.internal.store.tiering.TieredStore.get(TieredStore.java:88)
at org.ehcache.core.Ehcache.doGet(Ehcache.java:89)
at org.ehcache.core.EhcacheBase.get(EhcacheBase.java:125)
at org.ehcache.jsr107.Eh107Cache.get(Eh107Cache.java:90)
at org.springframework.cache.jcache.JCacheCache.lookup(JCacheCache.java:84)
at org.springframework.cache.support.AbstractValueAdaptingCache.get(AbstractValueAdaptingCache.java:58)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:78)
at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:538)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedValue(CacheAspectSupport.java:495)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:445)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:409)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:65)

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

3 participants