Skip to content

Commit

Permalink
feat: simple performance / scalability fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
matiwinnetou committed Mar 7, 2025
1 parent 9a7f9b1 commit a01568c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public AccountBalanceResponse getAccountBalance(AccountBalanceRequest accountBal
CardanoAddressUtils.verifyAddress(accountAddress);

PartialBlockIdentifier blockIdentifier = accountBalanceRequest.getBlockIdentifier();
log.info("[accountBalance] Looking for block: {} || latest}", blockIdentifier);
log.debug("[accountBalance] Looking for block: {} || latest}", blockIdentifier);

if (Objects.nonNull(blockIdentifier)) {
index = blockIdentifier.getIndex();
Expand Down Expand Up @@ -92,7 +92,7 @@ private AccountBalanceResponse findBalanceDataByAddressAndBlock(String address,

return findBlockOrLast(number, hash)
.map(blockDto -> {
log.info("Looking for utxos for address {} and block {}",
log.debug("Looking for utxos for address {} and block {}",
address,
blockDto.getHash()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ public class BlockServiceImpl implements BlockService {

@Override
public Block findBlock(Long index, String hash) {
log.info("[block] Looking for block: hash={}, index={}", hash, index);
log.debug("[block] Looking for block: hash={}, index={}", hash, index);

Optional<Block> blockOpt = ledgerBlockService.findBlock(index, hash);
if (blockOpt.isPresent()) {
var block = blockOpt.get();
log.info("Block was found, hash={}", block.getHash());
log.debug("Block was found, hash={}", block.getHash());

block.setPoolDeposit(String.valueOf(protocolParamService.findProtocolParameters().getPoolDeposit()));
log.debug("full data {}", block);

return block;
}
log.error("Block was not found");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public Network getSupportedNetwork() {

private NetworkStatus networkStatus() {
log.info("[networkStatus] Looking for latest block");

BlockIdentifierExtended latestBlock = ledgerBlockService.findLatestBlockIdentifier();
log.debug("[networkStatus] Latest block found {}", latestBlock);

Expand Down
18 changes: 10 additions & 8 deletions api/src/main/resources/config/application-online.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ spring:
password: ${DB_SECRET:weakpwd#123_d}
url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5433}/${DB_NAME:test}?currentSchema=${DB_SCHEMA:preprod}
hikari:
# default connection-timeout is 30 seconds
connectionTimeout: 100000
# default pool size is 10
# connections = ((core_count * 2) + effective_spindle_count)
maximumPoolSize: 12
# for developing purposes
connectionTimeout: 100000 #default connection-timeout is 30 seconds
minimumIdle: 2
connections: 48 # ((core_count * 2) + effective_spindle_count), 48 for 16 cores, NVMe Storage, spindle count 16

keepaliveTime: 60000 # Sends a keep-alive query every 60s to prevent connection closure

maximumPoolSize: 20 # default pool size is 10
leakDetectionThreshold: 60000

jpa:
properties:
hibernate:
format_sql: true
hibernate:
ddl-auto: none
show-sql: true
show-sql: false
mvc:
log-resolved-exception: true
output:
Expand All @@ -29,4 +31,4 @@ cardano:
OFFLINE_MODE: false
YACI_HTTP_BASE_URL: ${YACI_HTTP_BASE_URL:http://localhost:9095}
HTTP_CONNECT_TIMEOUT_SECONDS: ${HTTP_CONNECT_TIMEOUT_SECONDS:5}
HTTP_REQUEST_TIMEOUT_SECONDS: ${HTTP_REQUEST_TIMEOUT_SECONDS:5}
HTTP_REQUEST_TIMEOUT_SECONDS: ${HTTP_REQUEST_TIMEOUT_SECONDS:5}

0 comments on commit a01568c

Please sign in to comment.