Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
🔧 Performance improvements
Browse files Browse the repository at this point in the history
- Include mainnet/testnet genesis blocks by default within connector microservice
- Increase API endpoint invocation retry time to reduce pressure on the node
- Ensure 'lisk' DB is always present on the MySQL read replica(s)
  • Loading branch information
sameersubudhi committed Apr 4, 2024
1 parent b5905b1 commit ec02315
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 7 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ services:
endpoint_mode: vip
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=lisk
healthcheck:
test: ['CMD', 'mysqladmin', 'ping', '-hlocalhost', '-ppassword']

Expand Down
2 changes: 1 addition & 1 deletion docker/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# WS_SERVER_PING_INTERVAL=3000
# WS_SERVER_PING_INTERVAL_BUFFER=1000
# ENDPOINT_INVOKE_MAX_RETRIES=3
# ENDPOINT_INVOKE_RETRY_DELAY=50
# ENDPOINT_INVOKE_RETRY_DELAY=500
# CONNECTOR_EXIT_DELAY_IN_HOURS=0

# Moleculer jobs configuration
Expand Down
3 changes: 3 additions & 0 deletions docker/mysql/read/init/01-databases.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Create database(s).
CREATE DATABASE IF NOT EXISTS `lisk`;

-- Create `reader` user for read queries and grant read privilages.
CREATE USER 'reader'@'%' IDENTIFIED WITH caching_sha2_password BY 'password';
GRANT SELECT ON *.* TO 'reader'@'%';
Expand Down
4 changes: 2 additions & 2 deletions docs/antora/modules/ROOT/pages/configuration/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ By default, it is set to `3`.
| `ENDPOINT_INVOKE_RETRY_DELAY`
| number
| Delay (in milliseconds) between each endpoint invocation request retry.
By default, it is set to `50`.
| 50
By default, it is set to `500`.
| 500

| `CONNECTOR_EXIT_DELAY_IN_HOURS`
| number
Expand Down
2 changes: 1 addition & 1 deletion ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module.exports = {
// WS_SERVER_PING_INTERVAL=3000,
// WS_SERVER_PING_INTERVAL_BUFFER=1000,
// ENDPOINT_INVOKE_MAX_RETRIES: 3,
// ENDPOINT_INVOKE_RETRY_DELAY: 50,
// ENDPOINT_INVOKE_RETRY_DELAY: 500,
// CONNECTOR_EXIT_DELAY_IN_HOURS: 0,
// JOB_INTERVAL_CACHE_CLEANUP: 0,
// JOB_SCHEDULE_CACHE_CLEANUP: '0 */12 * * *',
Expand Down
8 changes: 7 additions & 1 deletion services/blockchain-connector/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ xunit-report.xml
db_data

# Data download directory
data
data/*
!data/00000000
data/00000000/*
!data/00000000/genesis_block.json
!data/01000000
data/01000000/*
!data/01000000/genesis_block.json
2 changes: 1 addition & 1 deletion services/blockchain-connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A list of the most commonly used environment variables is presented below:
- `WS_SERVER_PING_INTERVAL`: Interval (in milliseconds) at which the WS server checks for liveliness of all the connected clients. This should not be modified unless explicitly recommended by the development team. By default, it is set to `3000`.
- `WS_SERVER_PING_INTERVAL_BUFFER`: A conservative assumption of the latency (in milliseconds) for WS server pings to arrive at the client. By default, it is set to `1000`.
- `ENDPOINT_INVOKE_MAX_RETRIES`: Maximum number of endpoint invocation request retries to the node. By default, it is set to `3`.
- `ENDPOINT_INVOKE_RETRY_DELAY`: Delay (in milliseconds) between each endpoint invocation request retry. By default, it is set to `50`.
- `ENDPOINT_INVOKE_RETRY_DELAY`: Delay (in milliseconds) between each endpoint invocation request retry. By default, it is set to `500`.
- `CONNECTOR_EXIT_DELAY_IN_HOURS`: Delay (in hours) after which the blockchain-connector microservice exits. The service should restart automatically if deployed using Docker or PM2. To be removed eventually. To enable it, set it higher than `0`. By default, it is set to `0`.
- `JOB_INTERVAL_CACHE_CLEANUP`: Job run interval to cleanup block cache. By default, it is set to `0`.
- `JOB_SCHEDULE_CACHE_CLEANUP`: Job run cron schedule to cleanup block cache. By default, it is set to run every 12 hours (`0 */12 * * *`).
Expand Down
2 changes: 1 addition & 1 deletion services/blockchain-connector/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ config.apiClient = {
pingIntervalBuffer: Number(process.env.WS_SERVER_PING_INTERVAL_BUFFER) || 1000, // in millisecs
request: {
maxRetries: Number(process.env.ENDPOINT_INVOKE_MAX_RETRIES) || 3,
retryDelay: Number(process.env.ENDPOINT_INVOKE_RETRY_DELAY) || 50, // in millisecs
retryDelay: Number(process.env.ENDPOINT_INVOKE_RETRY_DELAY) || 500, // in millisecs
},
};

Expand Down
47 changes: 47 additions & 0 deletions services/blockchain-connector/data/00000000/genesis_block.json

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions services/blockchain-connector/data/01000000/genesis_block.json

Large diffs are not rendered by default.

0 comments on commit ec02315

Please sign in to comment.