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

Haomai Wang haomai at unitedstack.com
Sat Dec 28 11:27:47 UTC 2013


I think the better way is save meters as a field in resource table.

You can look at MongoDB model and may get some ideas.

Beside above, sql backend can introduce Memcache to improve performance.
IMO, the best way may be redesign the sql model to match workload.



On Sat, Dec 28, 2013 at 6:51 PM, 刘胜 <liusheng1175 at 126.com> wrote:

> 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
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>


-- 

Best regards,

Haomai Wang, UnitedStack Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131228/674c1452/attachment.html>


More information about the OpenStack-dev mailing list