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

并发性能出现柱塞,性能下降 #2087

Open
2 tasks done
wuchaococo opened this issue Mar 1, 2025 · 0 comments
Open
2 tasks done

并发性能出现柱塞,性能下降 #2087

wuchaococo opened this issue Mar 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@wuchaococo
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Version

V 0.7

Component(s)

Java

Minimal reproduce step

构建了一个线程并发的的fury
ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA).requireClassRegistration(false)
.withJdkClassSerializableCheck(false).withRefTracking(false)
.withCompatibleMode(CompatibleMode.COMPATIBLE).withAsyncCompilation(true).withRefTracking(true)
.buildThreadSafeFuryPool(10, 1000);
@OverRide
public R execute(Function<Fury, R> action) {
ClassLoaderFuryPooled pooledCache = null;
Fury fury = null;
try {
pooledCache = furyPooledObjectFactory.getPooledCache();
fury = pooledCache.getFury();
return action.apply(fury);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (pooledCache != null) {
pooledCache.returnFury(fury);
}
}
}

What did you expect to see?

多线程并发下的性能如何操作

What did you see instead?

--多线程请求并发的场景下 这里锁的时间很长,
public Fury getFury() {
try {
lock.lock();
Fury fury = idleCacheQueue.poll();
while (fury == null) {
if (activeCacheNumber.get() < maxPoolSize) {
addFury();
} else {
furyCondition.await();
}
fury = idleCacheQueue.poll();
}
activeCacheNumber.incrementAndGet();
return fury;
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
lock.unlock();
}
}

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@wuchaococo wuchaococo added the bug Something isn't working label Mar 1, 2025
@wuchaococo wuchaococo changed the title 并发性能出现注释 并发性能出现柱塞,性能下降 Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant