[openstack-dev] [Ceilometer] time consuming of listing resource

刘胜 liusheng1175 at 126.com
Sat Dec 28 10:51:57 UTC 2013


Hi all:
I have reported a bug about time consuming of “resource-list” in ceilometer CLI:
https://bugs.launchpad.net/ceilometer/+bug/1264434


In order to Identify the causes of this phenomenon, I have pdb the codes in my invironment(configured  mysql as db driver):
the most import part of process of listing resource is implemented in following codes:


code of get_resources() in /ceilometer/storage/impl_sqlalchemy.py:
…………
 for meter, first_ts, last_ts in query.all():
            yield api_models.Resource(
                resource_id=meter.resource_id,
                project_id=meter.project_id,
                first_sample_timestamp=first_ts,
                last_sample_timestamp=last_ts,
                source=meter.sources[0].id,
                user_id=meter.user_id,
                metadata=meter.resource_metadata,
                meter=[
                    api_models.ResourceMeter(
                        counter_name=m.counter_name,
                        counter_type=m.counter_type,
                        counter_unit=m.counter_unit,
                    )
                    for m in meter.resource.meters
                ],
            )
The method  generate iterator of object of   api_models.Resource for ceilometer API to show.
1.The operation “query.all()” will query the DB table “meter” with the expression generated forward,in my invironment the DB table “meter” have more than 300000 items, so this operation may consume about 30 seconds;
2.The operation  "for m in meter.resource.meters" will circulate the meters of this resource . a resource of server may have more than 100000 meter iterms in my invironment.  So the time of whole process is too long. I think the meter of Resource object can be reduced and I have tested this modification, it is OK for listing resource,and reduce the most time consumption


I have noticed that there are many methods of db operation may time consumption. 


ps: I have configured the ceilometer pulling interval from 600s to 60s in /etc/ceilometer/pipeline.yaml, but the invironment has just run 10 days!


I'm a beginner of ceilometer,and want to fix this bug,but I haven't found a suitable way
may be someone can help me with this?


Best Regards
liusheng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131228/0cd1bf3d/attachment.html>


More information about the OpenStack-dev mailing list