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

Increase default request rate #160

Open
steve-chavez opened this issue Oct 17, 2024 · 5 comments
Open

Increase default request rate #160

steve-chavez opened this issue Oct 17, 2024 · 5 comments
Labels

Comments

@steve-chavez
Copy link
Member

steve-chavez commented Oct 17, 2024

Problem

The current request rate of 200 req/s (pg_net.batch_size) is too low for several cases. It's limited this way to save on CPU usage, but this can be improved.

For example, right now the net._http_response tables store the response headers as jsonb. For this, processing is needed on each request/response to convert the headers to jsonb, which consumes CPU.

Solution

Store the response headers as binary and then provide a view that converts them to json on demand. This can be done without a breaking change. Then increase the default request rate.

Notes

@begank
Copy link

begank commented Oct 18, 2024

+1, I think the value of pg_net.batch_size is far less than 200.
By the way, how can I check the value of pg_net.batch_size? @steve-chavez

@steve-chavez
Copy link
Member Author

@begank Try

show pg_net.batch_size;

@riderx
Copy link

riderx commented Dec 21, 2024

do we have a way to have in our migration file the set of batch_size ?
when i add that to migrations: alter system set pg_net.batch_size to 2000;
ERROR: ALTER SYSTEM cannot be executed within a pipeline (SQLSTATE 25001)
At statement 61: alter system set pg_net.batch_size to 2000

@steve-chavez
Copy link
Member Author

@riderx Looks like your migration tool is using libpq pipeline mode, which is incompatible with some SQL statements (COPY being another one).

For now, you could use another migration tool as a workaround.

Once #163 is done we won't require ALTER SYSTEM anymore.

@riderx
Copy link

riderx commented Dec 28, 2024

I use the one in supabase CLI, so I don’t know exactly witch one it is but i believe your team does :)
I would live to have that not require alter and be a method like set_batch_size like we have in others plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants