fix performance regression
The last improvement of memory usage introduced a performance regression. The ingestion performance dropped by 50%-80%, because for every inserted entry the Tags were created inefficient.
This commit is contained in:
@@ -24,6 +24,7 @@ import javax.annotation.PreDestroy;
|
||||
|
||||
import org.lucares.pdb.api.Entry;
|
||||
import org.lucares.pdb.api.Tags;
|
||||
import org.lucares.pdb.api.TagsBuilder;
|
||||
import org.lucares.performance.db.BlockingQueueIterator;
|
||||
import org.lucares.performance.db.PerformanceDb;
|
||||
import org.lucares.recommind.logs.Config;
|
||||
@@ -124,7 +125,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
||||
}
|
||||
|
||||
private Tags createTags(final Map<String, Object> map) {
|
||||
Tags tags = Tags.create();
|
||||
final TagsBuilder tags = TagsBuilder.create();
|
||||
for (final java.util.Map.Entry<String, Object> e : map.entrySet()) {
|
||||
|
||||
final String key = e.getKey();
|
||||
@@ -139,11 +140,15 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
||||
// ignore: we only support key/value tags
|
||||
break;
|
||||
default:
|
||||
tags = tags.copyAddIfNotNull(key, String.valueOf(value));
|
||||
if (value instanceof String) {
|
||||
tags.add(key, (String) value);
|
||||
} else {
|
||||
tags.add(key, String.valueOf(value));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tags;
|
||||
return tags.build();
|
||||
}
|
||||
|
||||
private OffsetDateTime getDate(final Map<String, Object> map) {
|
||||
|
||||
Reference in New Issue
Block a user