Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1560740 - Katello Event Queue db queries need improvement
Katello Event Queue db queries need improvement
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Performance (Show other bugs)
6.3.0
Unspecified Unspecified
high Severity high (vote)
: 6.3.2
: Unused
Assigned To: Partha Aji
Ranjan Kumar
: PrioBumpField, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-26 17:49 EDT by Partha Aji
Modified: 2018-08-31 11 EDT (History)
7 users (show)

See Also:
Fixed In Version: tfm-rubygem-katello-3.4.5.69-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1572306 (view as bug list)
Environment:
Last Closed: 2018-06-19 16:17:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 22978 None None None 2018-03-26 17:50 EDT
Red Hat Product Errata RHBA-2018:1950 None None None 2018-06-19 16:17 EDT

  None (edit)
Description Partha Aji 2018-03-26 17:49:21 EDT
KatelloEventQueue involves the following operations

1) Pick an event thats not in-progress and mark the rest of the duplicate events below it as "in progress"
2) Do the operation
3) Delete all the duplicates

In a large scale environment where over 10's of 1000s of events (with many duplicates) gets queued up in the EventQueue we need a quicker way to handle all 3

The last part seems to delete 1 event at a time instead of deleting the duplicates en masse


To test this
1) create activation key with subs attached
2)Do simultaneou/multiple registers and unregisters in quick succession  in the 100s , 
3) sudo su - postgres; psql foreman; select count(*) from katello_events
make sure you have a lot of import_pools running
4) Notice that duplicate events are not immediately cleared after the first event pool. As in they happen slowly


other approach to repro this scenario

1) Stop foreman-tasks
2) foreman-rake console
3) Katello::Pool.first.id
>> 3 #note down the id
4) 30000.times {   ::Katello::EventQueue.push_event(::Katello::Events::ImportPool::EVENT_TYPE, 3) }

exit
5) sudo su - postgres; psql foreman; select count(*) from katello_events
make sure you have a lot of import_pools running
6) start foreman-tasks
7) Keep monitoring the counts in katello_events

It takes a long time to clear all the events and go to 0 (5 min in our demo sat)
Comment 1 Partha Aji 2018-03-26 17:50:56 EDT
Connecting redmine issue http://projects.theforeman.org/issues/22978 from this bug
Comment 4 pm-sat@redhat.com 2018-03-26 18:22:07 EDT
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/22978 has been resolved.
Comment 8 errata-xmlrpc 2018-06-19 16:17:00 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:1950

Note You need to log in before you can comment on or make changes to this bug.