aiomonitor | adds monitor and python REPL capabilities | Reactive Programming library
kandi X-RAY | aiomonitor Summary
kandi X-RAY | aiomonitor Summary
aiomonitor is module that adds monitor and python REPL capabilities for asyncio application
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- List available commands
- Return a generator of CmdName instances that startswith
- Start the server
- Parse command
- Interactive loop
- Call the post command
- Start a console
- Proxy to telnet proxy
- Close the UI thread
- Show all tasks
- Read the version number from the init directory
- Cancel a task
- Cancel a task
- Start a telnet connection
- Show stack info
- Format the task stack
- Get frames from a coroutine
aiomonitor Key Features
aiomonitor Examples and Code Snippets
Community Discussions
Trending Discussions on aiomonitor
QUESTION
Is there a module to measure asyncio event loop metrics? or for asyncio event loop, what metrics we should monitor for performance analysis purpose?
e.g.
- how many tasks in the event loop?
- how many tasks in waiting states?
I'm not trying to measure the coroutine functions. aiomonitor has the functionality, but is not exactly what I need.
...ANSWER
Answered 2019-Jan-10 at 00:02I hardly believe number of pending tasks or tasks summary will tell you much. Let's say you have 10000 tasks, 8000 of them pending: is it much, is it not? Who knows.
Thing is - each asyncio
task (or any other Python object) can consume different amount of different machine resources.
Instead of trying to monitor asyncio
specific objects I think it's better to monitor general metrics:
- CPU usage
- RAM usage
- Network I/O (in case you're dealing with it)
- Hard drive I/O (in case you're dealing with it)
What comes to asyncio
you should probably always use asyncio.Semaphore to limit max number of currently running jobs and implement a convenient way to change value of semaphore(s) (for example, through config file).
It'll allow to alter workload on a concrete machine depending on its available and actually utilized resources.
Upd:
My question, will asyncio still accept new connections during this block?
If your event loop is blocked by some CPU calculation, asyncio
will start to process new connections later - when event loop is free again (if they're not time-outed at this moment).
You should always avoid situation of freezing event loop. Freezed somewhere event loop means that all tasks everywhere in code are freezed also! Any kind of loop freezing breaks whole idea of using asynchronous approach regardless of number of tasks. Any kind of code, where event loop is freezed will have performance issues.
As you noted, you can use ProcessPoolExecutor
with run_in_executor to await for CPU-bound stuff, but you can use ThreadPoolExecutor
to avoid freezing as well.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aiomonitor
You can use aiomonitor like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page