Replies: 3 comments 1 reply
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
https://trio.readthedocs.io/en/latest/reference-io.html#asynchronous-filesystem-i-o great article about your question |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
The logging module itself has minimal impact —
import logging
import logging.handlers
from queue import Queue
handler = logging.handlers.RotatingFileHandler("app.log")
queue = Queue(-1)
queue_handler = logging.handlers.QueueHandler(queue)
listener = logging.handlers.QueueListener(queue, handler)
logger = logging.getLogger("myapp")
logger.addHandler(queue_handler)
listener.start()
# Bad — always evaluates str(obj)
logger.debug(f"Processing: {expensive_call()}")
# Good — only formats if DEBUG is enabled
logger.debug("Processing: %s", expensive_call())
For most apps, logging takes <1% of CPU time. The async handler fix addresses the only real issue (blocking I/O in the event loop). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that the aiohttp uses standard logging for tracking the library activity, But the logging module is threading safe, namely it contains many acquire and release lock operations. will this cause a bad performance to aiohttp in high concurrency environment?
Beta Was this translation helpful? Give feedback.
All reactions