remove time measurements
For each entry we executed two calls to System.nanoTime(). The resulting numbers aren't very reliable and calling nanoTime that often (160k - 300k per second) is quite expensive.
This commit is contained in:
@@ -78,26 +78,14 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
||||
final ObjectMapper objectMapper = new ObjectMapper();
|
||||
final ObjectReader objectReader = objectMapper.readerFor(typeReferenceForMap);
|
||||
|
||||
double duration = 0.0;
|
||||
int count = 0;
|
||||
LOGGER.debug("reading from stream");
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
final long start = System.nanoTime();
|
||||
try {
|
||||
final Map<String, Object> object = objectReader.readValue(line);
|
||||
|
||||
final Optional<Entry> entry = createEntry(object);
|
||||
final long end = System.nanoTime();
|
||||
duration += (end - start) / 1_000_000.0;
|
||||
|
||||
count++;
|
||||
if (count == 100000) {
|
||||
METRICS_LOGGER.debug("reading {} took {} ms", count, duration);
|
||||
duration = 0.0;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
if (entry.isPresent()) {
|
||||
LOGGER.debug("adding entry to queue: {}", entry);
|
||||
@@ -108,7 +96,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
||||
}
|
||||
}
|
||||
LOGGER.debug("connection closed: " + clientAddress);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
LOGGER.warn("Stream handling failed", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user