machines read (API) call is unreasonably slow
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Expired
|
Medium
|
Unassigned |
Bug Description
When using the CLI or the python-libmass API, the "machines read" or client.
Our maas installation is running maas 2.6.2 from PPA has about 140 deployed machines known to it at this time, and the above call takes anywhere from 2 MINUTES to 4 MINUTES to return. This has been getting progressively slower over time as the number of deployed machines has increased
From our custom code leveraging the python-libmaas API
2020-05-27 10:21:02,075 - INFO - Querying MAAS for machines to see if it knows about the 2 instances specified in the CSV file (demo.csv)
2020-05-27 10:24:32,160 - INFO - Maas knows about 142 machines
Total time spent 3 minutes 30 seconds!
Leveraging the MAAS cli client that came with maas results in similar extraordinarily slow times with times varying from 2 minutes up to 5 at which point the python-libmaas API times out.
# time maas <PROFILE> machines read >/dev/null
real 2m51.982s
user 0m2.517s
sys 0m0.729s
This call returns the full YAML blob for each machine when it really only needs to return the hostname and ID, which should be a very fast query to request, the "maas machine read" provided that ID will return the full data, which currently takes 5+ seconds (not ideal, but not terrible).
When using automation to drive maas, we need to use this call to be fast to ensure the machine exists and can then query it to ensure it is in the correct state, and if not we can take action to add it as needed.
Ideas:
Make "maas <profile> machines read" only return the hostname/ID in yaml so it's fast
Add an API call to return a machine info based on criteria other than ID (i.e. hostname, tags, other)
maas <profile> machines find <search_criteria> i.e. hostname=blah, tag=blah, etc.
Implement caching in memcached to reduce excessive DB querying.
MAAS region controller information:
8 CPU
100G disk (SSD)
18.04
MaaS installed from official PPA
# dpkg -l |grep maas
ii maas-cli 2.6.2-7841-
ii maas-common 2.6.2-7841-
ii maas-proxy 2.6.2-7841-
ii maas-region-api 2.6.2-7841-
ii maas-region-
ii python3-django-maas 2.6.2-7841-
ii python3-maas-client 2.6.2-7841-
ii python3-
description: | updated |
tags: | added: api |
Changed in maas: | |
importance: | Undecided → Medium |
Changed in maas: | |
status: | Incomplete → New |
status: | New → Incomplete |
This has been reported previously and some additional context can be seen in;
https:/ /bugs.launchpad .net/maas/ +bug/1826879/ comments/ 14
and
https:/ /bugs.launchpad .net/maas/ +bug/1682317