Skip to content

Debug fstring bottleneck in sending #2102

@scrameta

Description

@scrameta

In the file cluster.py there is a line that logs the args as debug using a fstring. This is a significant bottleneck when sending large messages even when logging is disabled since the fstring is always evaluated. Please could it be changed as follows:

diff cluster.py cluster.py -u

--- cluster.py 2022-04-12 09:47:46.545790433 +0000

+++ cluster.py 2022-04-12 09:51:55.789286947 +0000

@@ -900,7 +900,7 @@

         node = self.nodes_manager.get_node_from_slot(

             slot, self.read_from_replicas and command in READ_COMMANDS

         )
  •        log.debug(f"Target for {args}: slot {slot}")
    
  •        log.debug("Target for {%s}: slot {%s}",args,slot)
    
           return [node]
    

    def _should_reinitialized(self):

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions