You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Nadina Florea (Jira)" <ji...@apache.org> on 2025/03/20 16:29:00 UTC
[jira] [Created] (CAMEL-21888) High CPU usage at startup due to Deque.size() iteration in SimpleLRUCache
Nadina Florea created CAMEL-21888:
-------------------------------------
Summary: High CPU usage at startup due to Deque.size() iteration in SimpleLRUCache
Key: CAMEL-21888
URL: https://issues.apache.org/jira/browse/CAMEL-21888
Project: Camel
Issue Type: Bug
Components: came-core
Affects Versions: 4.7.0
Reporter: Nadina Florea
Hello,
Starting with *Camel 4.7.0,* a change was introduced in *SimpleLRUCache,* where a *Deque* is now used to track *lastChanges.*
This change causes *high CPU usage at startup* when the cache is populated, as *Deque.size() iterates over all cache entries.*
This issue was observed only in production, after migrating to Camel 4.7.0, where the cache size is significantly large (1,200,000 entries at that time). Current stable version is Camel 4.6.0.
We are using {*}KafkaIdempotentRepository{*}, which relies on SimpleLRUCache. In our app, we expose a metric that contains the size of the cache at a certain point.
{code:java}
@Bean
@ConditionalOnBean(KafkaIdempotentRepository.class)
public MeterBinder cacheSize(final KafkaIdempotentRepository idempotentRepository) {
return registry -> Gauge.builder("cacheSize",idempotentRepository::getCacheSize)
.register(registry);
}{code}
Would appreciate any insights on this issue.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)