event_create is the wrong place to count events

Bug #1263911 reported by Thomas Herve
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Triaged
Low
Unassigned

Bug Description

Everytime we insert an event, we now do a count to check if we should purge the table, when max_events_per_stack is set. That's not really efficient, we should find a way to do the count less often.

Changed in heat:
status: New → Confirmed
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

These counts are extremely efficient actually. The query should result in a single index key scan. Still it isn't free and we can do better. The simplest thing to do is to just avoid even bothering to count again for event_purge_batch_size events being added.

Changed in heat:
status: Confirmed → Triaged
Changed in heat:
milestone: icehouse-3 → none
Changed in heat:
assignee: nobody → Kairat Kushaev (kkushaev)
Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master)

Change abandoned by Kairat Kushaev (<email address hidden>) on branch: master
Review: https://review.openstack.org/160318

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

Hi guys,
I spent some time and analyzed this bug:
1) It seems that creating a cache is too complex for heat.
If we cache somehow event count in heat-engine the it will not work correctly with multiple heat engines.
So without any middleware DB is the right place to improve count performance.
2) MySQL already has created an index for stack_id in event table. So filtering by stack_id and counting should be quite fast.
3) The one of possible solutions is to create trigger that counts and stores somewhere in DB the number of events. But it seems too complex for the bug and requires additional table in DB. I think that it would be reasonable if we would have real bottle-neck here but it seems that there is no performance issues related to event creation yet.
In addiion, I think that the description above is more appropriate for feature.
So I propose either close the bug if the analysis is sufficient for You or change add an issue to wish-list.

Changed in heat:
assignee: Kairat Kushaev (kkushaev) → nobody
Changed in heat:
status: In Progress → Triaged
importance: Medium → Low
Rico Lin (rico-lin)
Changed in heat:
milestone: none → no-priority-tag-bugs
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.