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 ObjectMapper objectMapper = new ObjectMapper();
|
||||||
final ObjectReader objectReader = objectMapper.readerFor(typeReferenceForMap);
|
final ObjectReader objectReader = objectMapper.readerFor(typeReferenceForMap);
|
||||||
|
|
||||||
double duration = 0.0;
|
|
||||||
int count = 0;
|
|
||||||
LOGGER.debug("reading from stream");
|
LOGGER.debug("reading from stream");
|
||||||
String line;
|
String line;
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
|
|
||||||
final long start = System.nanoTime();
|
|
||||||
try {
|
try {
|
||||||
final Map<String, Object> object = objectReader.readValue(line);
|
final Map<String, Object> object = objectReader.readValue(line);
|
||||||
|
|
||||||
final Optional<Entry> entry = createEntry(object);
|
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()) {
|
if (entry.isPresent()) {
|
||||||
LOGGER.debug("adding entry to queue: {}", entry);
|
LOGGER.debug("adding entry to queue: {}", entry);
|
||||||
@@ -108,7 +96,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOGGER.debug("connection closed: " + clientAddress);
|
LOGGER.debug("connection closed: " + clientAddress);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
LOGGER.warn("Stream handling failed", e);
|
LOGGER.warn("Stream handling failed", e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user