Hi everyone, im running Hivemq on amazon ec2 on container which has 1 cpu, 475 mb ram, 8.65 gb disk space. there i have 2 connections and total inbound publish messages are 319 and total outbound publish messages are 313. problem is that cpu is always on 100%, ram 150-200/475mb and dis space 3.70/8.65. can anyone help me identify why cpu always run on 100%?
im using my authentication extension
public class CustomAuthenticatorService implements SimpleAuthenticator {
private static final Logger logger = LoggerFactory.getLogger(CustomAuthenticatorService.class);
private final HttpClient httpClient = HttpClient.newHttpClient();
@Override
public void onConnect(@NotNull SimpleAuthInput simpleAuthInput, @NotNull SimpleAuthOutput simpleAuthOutput) {
try {
ConnectPacket connectPacket = simpleAuthInput.getConnectPacket();
String clientId = connectPacket.getClientId();
logger.info("Started authentication of device: " + clientId);
if (connectPacket.getPassword().isEmpty()) {
System.out.println("Authentication failed: invalid client credentials " + clientId);
simpleAuthOutput.failAuthentication("Invalid Client credentials");
return;
}
ByteBuffer readOnlyBuffer = connectPacket.getPassword().get().asReadOnlyBuffer();
CharBuffer charBuffer = StandardCharsets.US_ASCII.decode(readOnlyBuffer);
String text = charBuffer.toString();
WashingDeviceAuthParam washingDeviceAuthParam = new WashingDeviceAuthParam(text, clientId);
String jsonPayload = washingDeviceAuthParam.toJson();
HttpRequest httpRequest = HttpRequest
.newBuilder(URI.create("autentication endpoint"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
if (httpResponse.statusCode() >= 200 && httpResponse.statusCode() <= 299 && httpResponse.body().equals("1")) {
logger.info("Client successfully authenticated: " + clientId);
simpleAuthOutput.authenticateSuccessfully();
} else {
logger.info("Client failed authentication: " + clientId);
simpleAuthOutput.failAuthentication("Invalid credentials");
}
} catch (Exception exception) {
logger.info("Client failed authentication: ");
logger.info("Exception during authentication: " + exception);
simpleAuthOutput.failAuthentication("Error during authentication");
}
}
}