Prolonged high CPU usage when the net tables grow too big

Open
#166 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
postgresql
Domain
api, backend, database

Research direction

No files, tests, or entry points are named; first locate the in-memory request queue and its producer and consumer path. Define the bounded-queue behavior and warning or error handling, then verify producers are handled when capacity is exhausted without spilling to disk.

Written by the indexing model from the issue text.

Description

idea

Problem

There was a case where a user imported data causing millions of rows to be inserted into a table that had webhooks enabled. This caused high CPU usage for a prolonged period of time.

Proposal

With an in-memory queue, it's possible to bound it to a certain size. Once this size is surpassed, we could:

  • Block the producers of http requests, until there's more capacity in the queue.
  • Log an ERROR or WARNING.

Note

Spill over to disk is not an option (inserting into another table), as it would make the usage more complex.

Dominant language
Python
Stars
371
Forks
43
Avg merge
22h 33m
Merged PRs (30d)
10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/pg_net

All issues in supabase/pg_net

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.