Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noticeable CPU usage when net._http_response has high count #70

Closed
steve-chavez opened this issue Sep 13, 2022 · 0 comments
Closed

Noticeable CPU usage when net._http_response has high count #70

steve-chavez opened this issue Sep 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@steve-chavez
Copy link
Member

This will be fixed on #68. Opening the issue to make the bug clear.


When having

postgres=# select count(*) from net._http_response;
-[ RECORD 1 ]
count | 50001

postgres=# select count(*) from net.http_request_queue;
-[ RECORD 1 ]
count | 0

Usage stays mostly at 2.6%CPU. Also notice the 6.7% MEM, which indicates there's a memory leak.

Screenshot from 2022-09-12 23-03-34

This is due to this DELETE:

pg_net/src/worker.c

Lines 442 to 445 in 70ea4cd

char *sql = "DELETE FROM\n"
" net._http_response\n"
"WHERE\n"
" clock_timestamp() - created > $1::interval";

clock_timestamp() generates a full table scan each time it runs.

@steve-chavez steve-chavez added the bug Something isn't working label Sep 13, 2022
steve-chavez added a commit to steve-chavez/pg_net that referenced this issue Sep 13, 2022
also use now() instead of clock_timestamp
steve-chavez added a commit to steve-chavez/pg_net that referenced this issue Sep 15, 2022
also use now() instead of clock_timestamp
steve-chavez added a commit to steve-chavez/pg_net that referenced this issue Sep 15, 2022
also use now() instead of clock_timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant