Jira (PDB-2487) Allow for a "resource-events-ttl" to reduce the number of days of events that are stored

31 views
Skip to first unread message

Nick Walker (JIRA)

unread,
Mar 1, 2016, 12:13:04 PM3/1/16
to puppe...@googlegroups.com
Nick Walker created an issue
 
PuppetDB / Improvement PDB-2487
Allow for a "resource-events-ttl" to reduce the number of days of events that are stored
Issue Type: Improvement Improvement
Affects Versions: PDB 4.0.0
Assignee: Unassigned
Created: 2016/03/01 9:12 AM
Labels: tcse
Priority: Normal Normal
Reporter: Nick Walker

Currently we store report-ttl days of events in the resource_events table in the puppetdb database.

Some customer have performance issues using the API endpoints that read from resource_events that could be mitigated or resolved by reducing the number of days of events that are stored in that table.

In cases where customers would like to store more reports like 30-60 days of reports they may not desire storing that many days of events as events tend to be more useful for watching things that changed recently.

I would be good to have an option to seperate these concerns and allow customers to tune in production for their own preferences.

Side note: I'm not tied to the name "resource-events-ttl" I just figured people would know what I meant by reading that.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc)
Atlassian logo

Nick Walker (JIRA)

unread,
Mar 1, 2016, 12:15:06 PM3/1/16
to puppe...@googlegroups.com
Nick Walker updated an issue
Change By: Nick Walker
Currently we store report-ttl days of events in the resource_events table in the puppetdb database.  

Some customer have performance issues using the API endpoints that read from resource_events that could be mitigated or resolved by reducing the number of days of events that are stored in that table.  

In cases where customers would like to store more reports like 30-60 days of reports they may not desire storing that many days of events as events tend to be more useful for watching things that changed recently.  

I would be good to have an option to seperate these concerns and allow customers to tune in production for their own preferences.  

Side note: I'm not tied to the name "resource-events-ttl" I just figured people would know what I meant by reading that.  

{code}
DELETE FROM resource_events 
WHERE timestamp < NOW() - INTERVAL '4 days';
{code}

Nick Walker (JIRA)

unread,
Mar 1, 2016, 12:16:07 PM3/1/16
to puppe...@googlegroups.com
Nick Walker updated an issue
Currently we store report-ttl days of events in the resource_events table in the puppetdb database.  

Some  customer  customers  have performance issues using the API endpoints that read from resource_events that could be mitigated or resolved by reducing the number of days of events that are stored in that table.  


In cases where customers would like to store more reports like 30-60 days of reports they may not desire storing that many days of events as events tend to be more useful for watching things that changed recently.  

I would be good to have an option to seperate these concerns and allow customers to tune in production for their own preferences.  

Side note: I'm not tied to the name "resource-events-ttl" I just figured people would know what I meant by reading that.  

{code}
DELETE FROM resource_events 
WHERE timestamp < NOW() - INTERVAL '4 days';
{code}

Wyatt Alt (JIRA)

unread,
Apr 18, 2016, 2:02:07 PM4/18/16
to puppe...@googlegroups.com
Wyatt Alt updated an issue
Change By: Wyatt Alt
Sprint: Hopper
This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9)
Atlassian logo

Ryan Senior (JIRA)

unread,
Jun 21, 2016, 12:36:04 PM6/21/16
to puppe...@googlegroups.com

Nick Walker (JIRA)

unread,
Mar 9, 2017, 5:18:08 PM3/9/17
to puppe...@googlegroups.com
Nick Walker updated an issue
Change By: Nick Walker
Currently we store report-ttl days of events in the resource_events table in the puppetdb database.  

Some customers have performance issues using the API endpoints that read from resource_events that could be mitigated or resolved by reducing the number of days of events that are stored in that table.  


In cases where customers would like to store more reports like 30-60 days of reports they may not desire storing that many days of events as events tend to be more useful for watching things that changed recently.  

I would be good to have an option to seperate these concerns and allow customers to tune in production for their own preferences.  

Side note: I'm not tied to the name "resource-events-ttl" I just figured people would know what I meant by reading that.  

{code}
DELETE FROM resource_events 
WHERE timestamp < NOW() - INTERVAL '4 days';
{code}

h1.  Another thought

If implemented would resource-events-ttl have it's own GC API command or would it just fall under report-ttl?  It could probably just be under the report-ttl but should run before the delete from reports does.  
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Russell Mull (JIRA)

unread,
May 22, 2017, 6:07:03 PM5/22/17
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
May 22, 2017, 6:08:03 PM5/22/17
to puppe...@googlegroups.com

Rodney Treweek (JIRA)

unread,
May 23, 2017, 11:48:03 AM5/23/17
to puppe...@googlegroups.com

Kenn Hussey (JIRA)

unread,
May 24, 2017, 12:10:06 PM5/24/17
to puppe...@googlegroups.com

Karen Van der Veer (JIRA)

unread,
May 30, 2017, 11:18:04 AM5/30/17
to puppe...@googlegroups.com

Julia Ramer (JIRA)

unread,
Jun 22, 2017, 12:55:04 PM6/22/17
to puppe...@googlegroups.com

Erik Hansen (JIRA)

unread,
Jun 27, 2017, 5:51:03 PM6/27/17
to puppe...@googlegroups.com

Kenn Hussey (JIRA)

unread,
Jul 20, 2017, 11:24:04 AM7/20/17
to puppe...@googlegroups.com

Charlie Sharpsteen (JIRA)

unread,
Aug 4, 2017, 7:57:03 PM8/4/17
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
Aug 22, 2017, 12:42:05 PM8/22/17
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
Aug 22, 2017, 12:42:05 PM8/22/17
to puppe...@googlegroups.com

Owen Rodabaugh (JIRA)

unread,
Sep 14, 2017, 6:59:03 PM9/14/17
to puppe...@googlegroups.com
Owen Rodabaugh updated an issue
Change By: Owen Rodabaugh
CS Priority: Needs Priority Normal
CS Impact: This impacts mostly large customers or those which run everything in noop. This inflates the size of the table in PDB which can use up disk space and grow the table to a size where the queries from event inspector no longer complete.

There is a terrible workaround using a cron job with a delete statement directly against this table.
CS Severity: 3 - Serious
CS Business Value: 4 - $$$$$
CS Frequency: 2 - 5-25% of Customers

Nick Walker (JIRA)

unread,
Sep 27, 2017, 2:06:47 PM9/27/17
to puppe...@googlegroups.com
Nick Walker updated an issue
Change By: Nick Walker
Currently we store report-ttl days of events in the resource_events table in the puppetdb database.  

Some customers have performance issues using the API endpoints that read from resource_events that could be mitigated or resolved by reducing the number of days of events that are stored in that table.  

In cases where customers would like to store more reports like 30-60 days of reports they may not desire storing that many days of events as events tend to be more useful for watching things that changed recently.  

I would be good to have an option to seperate these concerns and allow customers to tune in production for their own preferences.  

Side note: I'm not tied to the name "resource-events-ttl" I just figured people would know what I meant by reading that.  

{code}
DELETE FROM resource_events 
WHERE timestamp < NOW() - INTERVAL ' 4 1  days';

{code}

h1.  Another thought

If implemented would resource-events-ttl have it's own GC API command or would it just fall under report-ttl?  It could probably just be under the report-ttl but should run before the delete from reports does.  

Nick Walker (JIRA)

unread,
Sep 27, 2017, 2:09:02 PM9/27/17
to puppe...@googlegroups.com
Nick Walker updated an issue
Currently we store report-ttl days of events in the resource_events table in the puppetdb database.  

Some customers have performance issues using the API endpoints that read from resource_events that could be mitigated or resolved by reducing the number of days of events that are stored in that table.  

In cases where customers would like to store more reports like 30-60 days of reports they may not desire storing that many days of events as events tend to be more useful for watching things that changed recently.  

I would be good to have an option to seperate these concerns and allow customers to tune in production for their own preferences.  

Side note: I'm not tied to the name "resource-events-ttl" I just figured people would know what I meant by reading that.  

Delete Query:
{code}
DELETE FROM resource_events 
WHERE timestamp < NOW() - INTERVAL '1 days';
{code}

Bash code: 
{code}
echo "DELETE FROM resource_events WHERE timestamp < NOW() - INTERVAL '1 days';" > /tmp/delete_resource_events.sql
su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/bin/psql -d pe-puppetdb -f /tmp/delete_resource_events.sql"
{code}

h1.  Another thought

If implemented would resource-events-ttl have it's own GC API command or would it just fall under report-ttl?  It could probably just be under the report-ttl but should run before the delete from reports does.  

Charlie Sharpsteen (JIRA)

unread,
Dec 15, 2017, 9:39:04 PM12/15/17
to puppe...@googlegroups.com
Charlie Sharpsteen commented on Improvement PDB-2487
 
Re: Allow for a "resource-events-ttl" to reduce the number of days of events that are stored

Wyatt suggested that a better resolution to this issue might be to add a filter or TTL specifically for noop or skip events. Supposedly the report and report_events tables are no longer duplicating data, so adding a TTL specifically for events would impact the ability to retrieve a full report-ttl of complete reporting data if necessary.

This probably ties into a larger epic around making the whole TTL system more flexible. For example, allowing TTLs to be set per node or per event type.

This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db)
Atlassian logo

Russell Mull (JIRA)

unread,
Feb 5, 2018, 11:14:04 AM2/5/18
to puppe...@googlegroups.com
Russell Mull updated an issue
 
Change By: Russell Mull
Fix Version/s: PDB 5.2.0
This message was sent by Atlassian JIRA (v7.5.1#75006-sha1:7df2574)
Atlassian logo

Russell Mull (JIRA)

unread,
Feb 5, 2018, 12:44:02 PM2/5/18
to puppe...@googlegroups.com
Russell Mull commented on Improvement PDB-2487
 
Re: Allow for a "resource-events-ttl" to reduce the number of days of events that are stored

removed the fixversion

On Mon, Feb 5, 2018 at 7:27 AM, Kenn Hussey (JIRA) <

Rob Browning (JIRA)

unread,
Apr 26, 2018, 2:57:05 PM4/26/18
to puppe...@googlegroups.com
Rob Browning updated an issue
 
Change By: Rob Browning
Sprint: Hopper/Triage
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Robert Roland (JIRA)

unread,
Oct 30, 2018, 4:29:09 PM10/30/18
to puppe...@googlegroups.com

Austin Blatt (JIRA)

unread,
Jan 9, 2019, 6:14:07 PM1/9/19
to puppe...@googlegroups.com

Austin Blatt (JIRA)

unread,
Jan 9, 2019, 6:15:04 PM1/9/19
to puppe...@googlegroups.com

Robert Roland (JIRA)

unread,
Jan 9, 2019, 6:29:05 PM1/9/19
to puppe...@googlegroups.com
Robert Roland updated an issue
Change By: Robert Roland
Fix Version/s: PDB 6.0.2
Fix Version/s: PDB 5.2.7

Kyle Hansel (JIRA)

unread,
Jul 9, 2019, 8:21:04 PM7/9/19
to puppe...@googlegroups.com

Jarret Lavallee (JIRA)

unread,
Sep 13, 2019, 7:11:03 PM9/13/19
to puppe...@googlegroups.com

Rob Browning (JIRA)

unread,
Oct 1, 2019, 6:29:05 PM10/1/19
to puppe...@googlegroups.com

Rob Browning (JIRA)

unread,
Oct 2, 2019, 12:02:05 PM10/2/19
to puppe...@googlegroups.com
Rob Browning commented on Improvement PDB-2487

Correction - it's not in Lovejoy, but the current plan for it to still end up in the LTS via the next Y release.

Thomas Kishel (JIRA)

unread,
Oct 2, 2019, 2:18:05 PM10/2/19
to puppe...@googlegroups.com
Thomas Kishel commented on Improvement PDB-2487

Does that mean in a .z of Lovejoy? Because this is a high-impact problem for the above PE users.

Thomas Kishel (JIRA)

unread,
Oct 2, 2019, 2:46:05 PM10/2/19
to puppe...@googlegroups.com
Thomas Kishel commented on Improvement PDB-2487

The workaround used by Support is a single:

su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/bin/psql -d pe-puppetdb -c 'TRUNCATE resource_events'"

and then a scheduled:

su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/bin/psql -d pe-puppetdb -c \"DELETE FROM resource_events WHERE timestamp < NOW() - INTERVAL '2 days'\""';

like:

cron { 'sudo_resource_events_ttl':
  ensure  => 'present',
  command => 'su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/bin/psql -d pe-puppetdb -c \"DELETE FROM resource_events WHERE timestamp < NOW() - INTERVAL \'2 days\'\""',
  hour    => ['8'],
  minute  => ['0'],
  target  => 'root',
  user    => 'root',
}

Rob Browning (JIRA)

unread,
Oct 3, 2019, 4:04:05 PM10/3/19
to puppe...@googlegroups.com
Rob Browning commented on Improvement PDB-2487

The plan is for it to make it in to the next "Y" release which I believe is now planned after Lovejoy, and before the LTS, and so the change would be in the LTS that Lovejoy's feeding in to, just not in Lovejoy proper, assuming I understand the current arrangements correctly.

Dylan Ratcliffe (JIRA)

unread,
Oct 3, 2019, 5:04:06 PM10/3/19
to puppe...@googlegroups.com

Rob Browning Is there nothing we can do to get this moving faster? The ticket's been open for three years, there are at least 45 customers affected (the ones linked here) and it's pretty crippling for those that it does affect, plus it seems that the code is done. Though there is a workaround it's not normally a quick thing to diagnose and the implementation is pretty ugly. Plus if we were to be aggressive and set the ttl to say 2 days (since the console only ever uses one day for the event inspector) then we would likely mean that nobody ever needs to actually raise the ticket in the first place.

Rob Browning (JIRA)

unread,
Oct 3, 2019, 6:29:05 PM10/3/19
to puppe...@googlegroups.com
Rob Browning commented on Improvement PDB-2487

Oh, and perhaps worth noting that the relevant work has actually now been folded in to this PR https://github.com/puppetlabs/puppetdb/pull/3027

Maheswaran Shanmugam (JIRA)

unread,
Oct 7, 2019, 4:00:08 AM10/7/19
to puppe...@googlegroups.com

Another incident from DBS today. https://puppetlabs.zendesk.com/agent/tickets/36552

 db_name | relation | pg_size_pretty ---------------------------------------------------------------------------------- #{database} | public.resource_events | 130 GB #{database} | public.resource_events_resource_timestamp | 61 GB #{database} | public.resource_events_unique | 52 GB #{database} | public.resource_events_resource_title_idx | 33 GB #{database} | public.resource_events_containing_class_idx | 16 GB #{database} | public.resource_events_timestamp_idx | 7739 MB #{database} | public.resource_events_reports_id_idx | 7104 MB #{database} | public.resource_events_status_idx | 7047 MB #{database} | public.resource_events_property_idx | 7042 MB

{{}}

Jarret Lavallee (JIRA)

unread,
Oct 10, 2019, 7:48:04 PM10/10/19
to puppe...@googlegroups.com

Robert Roland (JIRA)

unread,
Nov 19, 2019, 12:13:06 PM11/19/19
to puppe...@googlegroups.com
Robert Roland updated an issue

There is a dev doc here: https://github.com/puppetlabs/puppetdb/blob/master/dev-docs/partitioning.markdown if that helps with updating the release notes or documentation.

Change By: Robert Roland
Release Notes Summary: A configuration parameter, resource-events-ttl, has been added. This parameter rounds up to the nearest day (i.e. 14h rounds up to 1d)

When the TTL is expired, the table containing that day's events is dropped so that there is no need to vacuum the resource_events table.
Release Notes: Enhancement

Austin Boyd (JIRA)

unread,
Dec 5, 2019, 11:28:05 AM12/5/19
to puppe...@googlegroups.com
Austin Boyd updated an issue
Change By: Austin Boyd
Zendesk Ticket IDs: 32574
Zendesk Ticket Count: 1

Austin Boyd (JIRA)

unread,
Dec 5, 2019, 11:28:08 AM12/5/19
to puppe...@googlegroups.com
Austin Boyd updated an issue
Change By: Austin Boyd
Zendesk Ticket IDs: 32574 ,35133
Zendesk Ticket Count: 1 2

Austin Blatt (JIRA)

unread,
Jan 13, 2020, 4:11:04 PM1/13/20
to puppe...@googlegroups.com

Heston Hoffman (JIRA)

unread,
Jan 13, 2020, 5:12:05 PM1/13/20
to puppe...@googlegroups.com

Thomas Kishel (JIRA)

unread,
Feb 3, 2020, 1:16:05 PM2/3/20
to puppe...@googlegroups.com
Thomas Kishel commented on Improvement PDB-2487
 
Re: Allow for a "resource-events-ttl" to reduce the number of days of events that are stored

Nick Walker

resource_events_ttl has been added to PuppetDB 6.8.0 via https://github.com/puppetlabs/puppetdb/pull/3027
So this can be closed, yes?

PE 2019.3 ships with PuppetDB 6.8.1.
I will submit a PR for PE-28222 to express this setting in PE.

Could you close or merge https://github.com/npwalker/pe_databases/pull/32

Reply all
Reply to author
Forward
0 new messages