Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: simple performance / scalability fixes. #316

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

@Kartiiyer12 Kartiiyer12 Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @matiwinnetou Is there a reason why this is turned off? This helps in easier debugging.

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}