Performance tweaks (#17155)

* changed default peers from 80 to 40. switched auto db_sync default to NORMAL instead of FULL

* fixed default

* add defaults to config query
This commit is contained in:
wjblanke 2023-12-22 14:28:31 -08:00 committed by GitHub
parent 55c064a292
commit a4cab829ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View File

@ -682,15 +682,15 @@ class ChiaServer:
return True
inbound_count = len(self.get_connections(node_type, outbound=False))
if node_type == NodeType.FULL_NODE:
return inbound_count < cast(int, self.config["target_peer_count"]) - cast(
int, self.config["target_outbound_peer_count"]
return inbound_count < cast(int, self.config.get("target_peer_count", 40)) - cast(
int, self.config.get("target_outbound_peer_count", 8)
)
if node_type == NodeType.WALLET:
return inbound_count < cast(int, self.config["max_inbound_wallet"])
return inbound_count < cast(int, self.config.get("max_inbound_wallet", 20))
if node_type == NodeType.FARMER:
return inbound_count < cast(int, self.config["max_inbound_farmer"])
return inbound_count < cast(int, self.config.get("max_inbound_farmer", 10))
if node_type == NodeType.TIMELORD:
return inbound_count < cast(int, self.config["max_inbound_timelord"])
return inbound_count < cast(int, self.config.get("max_inbound_timelord", 5))
return True
def is_trusted_peer(self, peer: WSChiaConnection, trusted_peers: Dict[str, Any]) -> bool:

View File

@ -90,7 +90,7 @@ def main() -> int:
with maybe_manage_task_instrumentation(enable=os.environ.get("CHIA_INSTRUMENT_NODE") is not None):
service_config = load_config_cli(DEFAULT_ROOT_PATH, "config.yaml", SERVICE_NAME)
target_peer_count = service_config.get("target_peer_count", 80) - service_config.get(
target_peer_count = service_config.get("target_peer_count", 40) - service_config.get(
"target_outbound_peer_count", 8
)
if target_peer_count < 0:

View File

@ -9,7 +9,7 @@ def db_synchronous_on(setting: str) -> str:
if setting == "full":
return "FULL"
# for now, default to synchronous=FULL mode. This can be made more
# for now, default to synchronous=NORMAL mode. This can be made more
# sophisticated in the future. There are still material performance
# improvements to be had in cases where the risks are low.
@ -18,4 +18,4 @@ def db_synchronous_on(setting: str) -> str:
# if type == DRIVE_FIXED or type == DRIVE_RAMDISK:
# return "OFF"
return "FULL"
return "NORMAL"

View File

@ -408,7 +408,7 @@ full_node:
# How long to wait for a peer connection
peer_connect_timeout: 30
# Accept peers until this number of connections
target_peer_count: 80
target_peer_count: 40
# Initiate outbound connections until this number is hit.
target_outbound_peer_count: 8
# IPv4/IPv6 network addresses and CIDR blocks allowed to connect even when target_peer_count has been hit.