You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're having concourse jobs stuck in pending state for a very long time, all while seeing lots of slow queries on our postgres server. Also seeing resources being slow to trigger, sometimes taking hours, even when check_every not set (defaulting to 1m). When things get really bad, the list of jobs on the left in the GUI is not updated.
The first time this happened, we got some relief by reducing amount of logs being retained via build_logs_to_retain for a job on a 3m timer.
The problem recently struck again and we found another job that needed the build_logs_to_retain treatment. However, once addressed, we still the pending state and slow triggers. Also seeing the job run but it take minutes for tasks to get going.
Clues in database:
Several instances of query REFRESH MATERIALIZED VIEW CONCURRENTLY latest_completed_builds_per_job are often running in parallel. Nominally taking a few seconds when things seem fine, often minutes or over an hour when experiencing aforementioned issues.
Load average on database often 30-40, with 8 cores at hand.
Usually seeing 40-50 active connections into database, sometimes over 100 reported, from concourse
Table concourseinfrastructureprod.builds went from 20000+ down to 4000 when we most recently removed/refactored a job with excessive build logs retained.
@timrchavez - Default overlay filesystem driver is being used to my knowledge. We're deploying via concourse-deployment with just a small set of ops files to change scale, get https, and use an externalized postgres. Is there a good clue in our interpolated bosh manifest which shows which one? I don't see btrfs or overlay in the manifest.
On the database front, I did some more postgres sleuthing and noticed that the jobs table has lots of tuples relative to rows. Perhaps there is a garbage collection issue inside the database? We tried vaccuming tables but maybe we need a steam cleaner?
The naive driver is the default (for binaries, at least - I know nothing about bosh), which has poor performance. Perhaps you need to explicitly set overlay or btrfs.
Update - our friends at Crunchy Data helped us discover that a long-running query/transaction within another schema on the same database was causing our issue. This query was keeping auto vacuum from cleaning up dead rows across all schemas, including our concourse schema. Dead rows can cause major performance problems evidently.
It was a good lesson for us on what the blast radius can be between schemas within the same database. Monitoring is being added to catch both long-running transactions and accumulation of dead tuples.
For reference, the query we ran to find the guilty query (will show itself in output):
select *, now() - xact_start as txn_runtime from pg_stat_activity
where state != 'idle' order by xact_start;
Thanks for the replies and suggestions on how to go after this. Happy Concoursing!
Activity
timrchavez commentedon Mar 24, 2018
Are you using btrfs or overlay (the current default) for your filesystem driver?
aleliaert commentedon Mar 24, 2018
@timrchavez - Default overlay filesystem driver is being used to my knowledge. We're deploying via concourse-deployment with just a small set of ops files to change scale, get https, and use an externalized postgres. Is there a good clue in our interpolated bosh manifest which shows which one? I don't see
btrfsoroverlayin the manifest.On the database front, I did some more postgres sleuthing and noticed that the
jobstable has lots of tuples relative to rows. Perhaps there is a garbage collection issue inside the database? We tried vaccuming tables but maybe we need a steam cleaner?Then...
It sounds like tuples should normally be close to rows?
phillbaker commentedon Mar 26, 2018
This also looks similar to #1298.
troykinsella commentedon Mar 27, 2018
The naive driver is the default (for binaries, at least - I know nothing about bosh), which has poor performance. Perhaps you need to explicitly set
overlayorbtrfs.aleliaert commentedon Apr 12, 2018
Update - our friends at Crunchy Data helped us discover that a long-running query/transaction within another schema on the same database was causing our issue. This query was keeping auto vacuum from cleaning up dead rows across all schemas, including our concourse schema. Dead rows can cause major performance problems evidently.
It was a good lesson for us on what the blast radius can be between schemas within the same database. Monitoring is being added to catch both long-running transactions and accumulation of dead tuples.
For reference, the query we ran to find the guilty query (will show itself in output):
Thanks for the replies and suggestions on how to go after this. Happy Concoursing!
bump etree tsa handlers mux clockwork goxmldsig genproto grpc
keithkroeger commentedon Mar 22, 2019
We are also seeing a similar problem in our 3.13 environment.
Once you found the queries, did you kill the sessions or take some other approach?
aleliaert commentedon Mar 22, 2019