A lot of objects are being created
See original GitHub issueWhat happened:
Whenever I use the extension after a while I start getting: distributed.utils_perf - WARNING - full garbage collections took x% CPU time recently (threshold: 10%)
, and the percentage just keeps increasing.
What you expected to happen: Not getting these warnings.
Minimal Complete Verifiable Example:
import gc
from collections import Counter
from dask.distributed import Client
def add(x, y):
return x + y
def obj_types(n=10):
return Counter(str(type(obj)) for obj in gc.get_objects()).most_common(n)
client = Client()
Link the extension to the created client.
future = client.submit(add, 1, 2)
By just running the code above and leaving the notebook idle I can see that the counts for bokeh objects start to rise. Run 1:
client.run_on_scheduler(obj_types)
# [("<class 'dict'>", 143178),
# ("<class 'tuple'>", 60317),
# ("<class 'list'>", 42544),
# ("<class 'set'>", 41334),
# ("<class 'function'>", 35093),
# ("<class 'bokeh.core.property.wrappers.PropertyValueDict'>", 23340),
# ("<class 'parso.python.tree.Operator'>", 17625),
# ("<class 'bokeh.core.property.wrappers.PropertyValueList'>", 13784),
# ("<class 'parso.python.tree.PythonNode'>", 13126),
# ("<class 'parso.python.tree.Name'>", 12038)]
Run 2 (after like 10-15 minutes):
client.run_on_scheduler(obj_types)
# [("<class 'dict'>", 510971),
# ("<class 'tuple'>", 212323),
# ("<class 'set'>", 178042),
# ("<class 'bokeh.core.property.wrappers.PropertyValueDict'>", 106980),
# ("<class 'bokeh.core.property.wrappers.PropertyValueList'>", 62999),
# ("<class 'list'>", 59689),
# ("<class 'function'>", 41300),
# ("<class 'cell'>", 21047),
# ("<class 'parso.python.tree.Operator'>", 17625),
# ("<class 'parso.python.tree.PythonNode'>", 13126)]
Anything else we need to know?:
Please let me know if I can provide some more insights. I don’t have much experience with the gc
so I’m not sure if that’s enough information.
Environment:
- Dask version: 2021.2.0
- Python version: 3.8.8
- Operating System: Ubuntu 20.10
- Install method (conda, pip, source): conda
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Should we avoid object creation in Java?
Contrary to most answers - yes, object allocation DOES have a cost associated. It is a low cost, but you should avoid creating...
Read more >Object.create() - JavaScript - MDN Web Docs
The Object.create() method creates a new object, using an existing object as the prototype of the newly created object.
Read more >Quote 1: Avoid creating unnecessary objects and always ...
Quote 1: Avoid creating unnecessary objects and always prefer to do. Lazy Initialization. Object creation in Java is one of the most expensive...
Read more >Does creating too many objects in javascript will affect the ...
In short: "it depends" - we need to know how many objects you're creating, how complex they are (as JavaScript does not have...
Read more >2nd Grade Science : Creation of New Objects from Existing ...
Creation Of New Objects From Existing Objects : Example Question #6. Once an object has been disassembled it's parts are no longer usable....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in
5.0.2
Thanks for the fix! Happy to help.